Package org.milyn.payload

Examples of org.milyn.payload.StringSource


    public void test_1(StreamFilterType filterType) throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("route-to-stream-01.cdrl"));

        smooks.setFilterSettings(new FilterSettings(filterType));
        smooks.filterSource(new StringSource("<a><c x='cx' /><d><e x='ex' /></d></a>"), null);
        assertEquals("xslfrome xslfromd ", new String(MockOutStreamResource.outputStream.toByteArray()));
    }
View Full Code Here


    public void test_2(StreamFilterType filterType) throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("route-to-stream-02.cdrl"));

        smooks.setFilterSettings(new FilterSettings(filterType));
        smooks.filterSource(new StringSource("<a><c x='cx' /><d><e x='ex' /></d></a>"), null);
        assertEquals("xslfromd xslfrome ", new String(MockOutStreamResource.outputStream.toByteArray()));
    }
View Full Code Here

  @Test
    public void test() throws Exception {
        template.request("direct:a", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody(new StringSource("<x/>"));
            }
        });
       
        assertEquals("<x />", DirectBProcessor.inMessage);
    }
View Full Code Here

    @Test
    public void test_05() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-05.xml"));
        JavaResult result = new JavaResult();

        smooks.filterSource(new StringSource("a|b|c\n\rd|e|f"), result);

        List<FSTRecord> fstRecords = (List<FSTRecord>) result.getBean("fstRecords");

        Assert.assertEquals(2, fstRecords.size());
        Assert.assertEquals("a|b|c", fstRecords.get(0).toString());
View Full Code Here

    public void testHelper(String config, String message) throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-" + config + ".xml"));
        String expected = StreamUtils.readStreamAsString(getClass().getResourceAsStream("expected-" + config + ".xml"));

        StringResult result = new StringResult();
        smooks.filterSource(new StringSource(message), result);

//        System.out.println(result);
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual(expected, result.toString());
    }
View Full Code Here

    public void test_nodeModel_1(StreamFilterType filterType) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/templating/freemarker/test-configs-05.cdrl");

        smooks.setFilterSettings(new FilterSettings(filterType));
        StringResult result = new StringResult();
        smooks.filterSource(new StringSource("<a><b><c>cvalue1</c><c>cvalue2</c><c>cvalue3</c></b></a>"), result);
        assertEquals("'cvalue1''cvalue2''cvalue3'", result.toString());
    }
View Full Code Here

    public void test_nodeModel_3(StreamFilterType filterType) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/templating/freemarker/test-configs-07.cdrl");

        smooks.setFilterSettings(new FilterSettings(filterType));
        StringResult result = new StringResult();
        smooks.filterSource(new StringSource("<a><b javabind='javaval'><c>cvalue1</c><c>cvalue2</c><c>cvalue3</c></b></a>"), result);
        assertEquals("'cvalue1''cvalue2''cvalue3' javaVal=javaval", result.toString());
    }
View Full Code Here

    public void test_no_default_ser() throws SAXException, IOException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("test-configs-no-default-ser.cdrl"));

        StringResult result = new StringResult();
        smooks.filterSource(new StringSource("<a><e><b x='xvalueonc1' /><c/><d/><b x='xvalueonc2' /></e></a>"), result);
        assertEquals("<mybean>xvalueonc1</mybean><d /><mybean>xvalueonc2</mybean>", result.toString());
    }
View Full Code Here

    }

    private void test_ftl(Smooks smooks, ExecutionContext context, String input, String expected) throws IOException, SAXException {
        StringResult result = new StringResult();

        smooks.filterSource(context, new StringSource(input), result);
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual(expected, result.getResult());
    }
View Full Code Here

    public void test_inline_01() throws SAXException, IOException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("inline-01.xml"));
        StringResult result = new StringResult();

        smooks.filterSource(new StringSource("<a/>"), result);
        assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><xxxxxx/>", result.getResult());
    }
View Full Code Here

TOP

Related Classes of org.milyn.payload.StringSource

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.