Examples of filterSource()


Examples of org.milyn.Smooks.filterSource()

        assertTrue(SAXAndDOMVisitor.visited);

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-DOM-02.xml"));
        execContext = smooks.createExecutionContext();
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertFalse(SAXAndDOMVisitor.visited);
    }

    public void test_SAX() throws IOException, SAXException {
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        ExecutionContext execContext;

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-SAX-01.xml"));
        execContext = smooks.createExecutionContext();
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertTrue(SAXAndDOMVisitor.visited);

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-SAX-02.xml"));
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        assertTrue(SAXAndDOMVisitor.visited);

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-SAX-02.xml"));
        execContext = smooks.createExecutionContext();
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertFalse(SAXAndDOMVisitor.visited);
    }
}
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

    public void test_one_writer_per_element() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("OnWriterPerElementTest.xml"));

        try {
            smooks.filterSource(smooks.createExecutionContext(), new StringSource("<a/>"), null);
            fail("Expected SAXWriterAccessException");
        } catch(SmooksException e) {
            assertEquals("Illegal access to the element writer for element 'a' by SAX visitor 'org.milyn.delivery.sax.SAXVisitorWriter02'.  Writer already acquired by SAX visitor 'org.milyn.delivery.sax.SAXVisitorWriter01'.  See SAXElement javadocs (http://milyn.codehaus.org/Smooks).  Change Smooks visitor resource configuration.", e.getCause().getMessage());
        }
    }
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

    public void test_CDATA(String config) throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream(config));
        StringResult result = new StringResult();

        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("in-message.xml")), result);
        assertTrue(StreamUtils.compareCharStreams(new InputStreamReader(getClass().getResourceAsStream("in-message.xml")), new StringReader(result.getResult())));
    }

}
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks(getClass().getResourceAsStream("DefaultWritingTest.xml"));

        StringSource stringSource = new StringSource("<a>aa<b>bbb<c />bbb</b>aaa</a>");
        StringResult stringResult = new StringResult();

        smooks.filterSource(smooks.createExecutionContext(), stringSource, stringResult);
       
        assertEquals(stringSource.getSource(), stringResult.getResult());
        assertTrue(SAXVisitBeforeVisitor.visited);
        assertTrue(SAXVisitAfterAndChildrenVisitor.visited);
        assertTrue(SAXVisitAfterAndChildrenVisitor.onChildElement);
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks(getClass().getResourceAsStream("DefaultWritingOff_No_Serializers_Test.xml"));

        StringSource stringSource = new StringSource("<a>aa<b>bbb<c />bbb</b>aaa</a>");
        StringResult stringResult = new StringResult();

        smooks.filterSource(smooks.createExecutionContext(), stringSource, stringResult);

        // The "default.serialization.on" global param is set to "false" in the config, so
        // nothing should get writen to the result because there are no configured
        // serialization Visitors.
        assertEquals("", stringResult.getResult());
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks(getClass().getResourceAsStream("node-model-02.xml"));

        smooks.setFilterSettings(FilterSettings.DEFAULT_SAX);

        ExecutionContext executionContext = smooks.createExecutionContext();
        smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("order-message.xml")), null);

        DOMModel nodeModel = DOMModel.getModel(executionContext);

        assertTrue(
                StreamUtils.compareCharStreams(
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks(getClass().getResourceAsStream("node-model-02.xml"));

        smooks.setFilterSettings(FilterSettings.DEFAULT_SAX);

        ExecutionContext executionContext = smooks.createExecutionContext();
        smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("order-message-with-ns.xml")), null);

        DOMModel nodeModel = DOMModel.getModel(executionContext);

        assertTrue(
                StreamUtils.compareCharStreams(
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

    public void test_dom() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("node-model-01.xml"));
        ExecutionContext executionContext = smooks.createExecutionContext();

        smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("order-message.xml")));

        DOMModel nodeModel = DOMModel.getModel(executionContext);

        assertTrue(
                StreamUtils.compareCharStreams(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.