Package org.milyn

Examples of org.milyn.Smooks.createExecutionContext()


  }

    private void test_config_file(String testNumber) throws Exception {
        Smooks smooks = new Smooks("/test/" + testNumber + "/smooks-config.xml");

        ExecutionContext context = smooks.createExecutionContext();
        String result = SmooksUtil.filterAndSerialize(context, getClass().getResourceAsStream("/test/" + testNumber + "/input-message.jsn"), smooks);

        if(logger.isDebugEnabled()) {
          logger.debug("Result: " + result);
        }
View Full Code Here


        Smooks smooks = new Smooks(getClass().getResourceAsStream("config-05.xml"));
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);

        ExecutionContext execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("injectedVal", "something");

        smooks.filterSource(execContext, new StringSource("<a/>"), result);

        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

        Smooks smooks = new Smooks(getClass().getResourceAsStream("config-06.xml"));
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);

        ExecutionContext execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("injectedVal", "something");

        smooks.filterSource(execContext, new StringSource("<a/>"), result);

        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setAttribute(new QName("xxx"), "${injectedVal}"), "a");

        ExecutionContext execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("injectedVal", "something");

        smooks.filterSource(execContext, new StringSource("<a/>"), result);

        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

        Map<String, Object> bean = new HashMap<String, Object>();

        DOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("smooks-config-01.xml"));
       
        execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("aBean", bean, null);
        bean.put("a", "hello");
       
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertTrue(DOMVisitor.visited);
View Full Code Here

        assertTrue(DOMVisitor.visited);

        DOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("smooks-config-01.xml"));

        execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("aBean", bean, null);
        bean.put("a", "goodbye");       
       
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertFalse(DOMVisitor.visited);
View Full Code Here

        smooks.setFilterSettings(filterSettings);
        smooks.addVisitor(new SetElementData().setAttribute(new QName("http://www.w3.org/2000/xmlns/", "ns1", "xmlns"), "http://ns1").
                                               setAttribute(new QName("http://ns1", "xxx", "ns1"), "${injectedVal}"), "a");

        ExecutionContext execContext = smooks.createExecutionContext();
        execContext.getBeanContext().addBean("injectedVal", "something");

        smooks.filterSource(execContext, new StringSource("<a/>"), result);

        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

    }

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

        smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<x/>")), null);
        assertFalse(VisitBeforeDOMVisitor.visited);
        assertFalse(VisitAfterDOMVisitor.visited);
        reset();
        smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<a/>")), null);
        assertTrue(VisitBeforeDOMVisitor.visited);
View Full Code Here

        smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<x/>")), null);
        assertFalse(VisitBeforeDOMVisitor.visited);
        assertFalse(VisitAfterDOMVisitor.visited);
        reset();
        smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<a/>")), null);
        assertTrue(VisitBeforeDOMVisitor.visited);
        assertFalse(VisitAfterDOMVisitor.visited);
        reset();
        smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<a><b/></a>")), null);
        assertTrue(VisitBeforeDOMVisitor.visited);
View Full Code Here

        // Test io stream close....
        // We need to +1 this because Xerces always closes input streams/readers and there's no
        // way of turning that off
        TestInputStream inStream = new TestInputStream("<x/>".getBytes(), expectedCloseCallCount + 1);
        TestOutputStream outStream = new TestOutputStream(expectedCloseCallCount);
        execContext = smooks.createExecutionContext(profile);
        smooks.filterSource(execContext, new StreamSource(inStream), new StreamResult(outStream));

        // Test io reader/writer close...
        // We need to +1 this because Xerces always closes input streams/readers and there's no
        // way of turning that off
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.