Package org.milyn.payload

Examples of org.milyn.payload.StringSource


    });
    enableJMX();
    context.start();
        Exchange response = template.request("direct:a", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody(new StringSource("<coord x='1234' />"));
            }
        });
        assertOutMessageBodyEquals(response, 1234);
    }
View Full Code Here


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

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

      }
    });
    context.start();
        Exchange response = template.request("direct:b", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody(new StringSource("<coord x='1234' y='98765.76' />"));
            }
        });
        Map javaResult = response.getOut().getBody(Map.class);
        Integer x = (Integer) javaResult.get("x");
        assertEquals(1234, (int) x );
View Full Code Here

      }
    });
    context.start();
        Exchange response = template.request("direct:c", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody(new StringSource("<coord x='111' y='222' />"));
            }
        });
       
        Coordinate coord = response.getOut().getBody(Coordinate.class);
       
View Full Code Here

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

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

    public void test_inline_03() throws SAXException, IOException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("inline-03.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

  @Test
    public void test() throws Exception {
        Exchange response = template.request("direct:blah", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody(new StringSource("<x/>"));
            }
        });
        assertNull(response.getOut().getBody());
    }
View Full Code Here

            final ExecutionContext context = smooks.createExecutionContext();
            final StringResult result = new StringResult();
            final ValidationResult validationResult = new ValidationResult();

            smooks.filterSource(context, new StringSource(xml), result, validationResult);

            final List<OnFailResult> warnings = validationResult.getWarnings();

            assertEquals(1, warnings.size());
            assertEquals(0, validationResult.getOKs().size());
View Full Code Here

        Smooks smooks = new Smooks(getClass().getResourceAsStream("config-01.xml"));
        ValidationResult result = new ValidationResult();

        smooks.setFilterSettings(filterSettings);

        smooks.filterSource(new StringSource("<a><b x='Xx'>11</b><b x='C'>Aaa</b></a>"), result);

        List<OnFailResult> warnings = result.getWarnings();
        assertEquals(2, warnings.size());
        assertEquals("RegexRuleEvalResult, matched=false, providerName=regex, ruleName=custom, text=11, pattern=[A-Z]([a-z])+", warnings.get(0).getFailRuleResult().toString());
        assertEquals("RegexRuleEvalResult, matched=false, providerName=regex, ruleName=custom, text=C, pattern=[A-Z]([a-z])+", warnings.get(1).getFailRuleResult().toString());
View Full Code Here

    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("<mybean>ex</mybean><mybean>cx</mybean>", new String(MockOutStreamResource.outputStream.toByteArray()));
    }
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.