Package org.milyn

Examples of org.milyn.Smooks.createExecutionContext()


 
  public void test_java_binding_interchange_01() throws IOException, SAXException {
    Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-jb-02.xml");
    JavaResult jResult = new JavaResult();   
    StringResult sResult = new StringResult();   
    ExecutionContext execCtx = smooks.createExecutionContext();
   
    //execCtx.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("unedifact-msg-02.edi")), jResult, sResult);
   
    UNEdifactInterchange41 interchange = jResult.getBean(UNEdifactInterchange41.class);
View Full Code Here


    public void test_java_binding_interchange_02() throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-jb-02.xml");
        JavaResult jResult = new JavaResult();
        StringResult sResult = new StringResult();
        ExecutionContext execCtx = smooks.createExecutionContext();

        //execCtx.setEventListener(new HtmlReportGenerator("target/report.html"));
        smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("unedifact-msg-03.edi")), jResult, sResult);

        UNEdifactInterchange41 interchange = jResult.getBean(UNEdifactInterchange41.class);
View Full Code Here

    }

    public void test_TypePopCheckBean(String configName) throws ParseException, IOException, SAXException {
        String packagePath = ClassUtil.toFilePath(getClass().getPackage());
        Smooks smooks = new Smooks(packagePath + "/" + configName);
        ExecutionContext executionContext = smooks.createExecutionContext();
        JavaResult result = new JavaResult(true);

        smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("type-pop-check-bean-data.xml")), result);

        TypePopCheckBean bean = (TypePopCheckBean) result.getBean("data");
View Full Code Here

    }

    public void test_visit_userBean(String configName) throws SAXException, IOException {

        Smooks smooks = new Smooks(getClass().getResourceAsStream(configName));
        ExecutionContext executionContext = smooks.createExecutionContext();

        smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("testxml.txt")), new DOMResult());

        MyGoodBean bean = (MyGoodBean)executionContext.getBeanContext().getBean("userBean");
        assertNotNull("Null bean", bean);
View Full Code Here

    private void test_populate_Order(String configName) throws SAXException, IOException, InterruptedException {

        String packagePath = ClassUtil.toFilePath(getClass().getPackage());
        Smooks smooks = new Smooks(packagePath + "/" + configName);
        ExecutionContext executionContext = smooks.createExecutionContext();

        String resource = StreamUtils.readStream(new InputStreamReader(getClass().getResourceAsStream("order-01.xml")));
        JavaResult result = new JavaResult();

        smooks.filterSource(executionContext, new StreamSource(new StringReader(resource)), result);
View Full Code Here

        result.getResultMap().put("header", inHeader);


        Smooks smooks = new Smooks(packagePath + "/" + configName);

        ExecutionContext executionContext = smooks.createExecutionContext();

        String resource = StreamUtils.readStream(new InputStreamReader(getClass().getResourceAsStream("order-01.xml")));

        smooks.filterSource(executionContext, new StreamSource(new StringReader(resource)), result);
View Full Code Here

  private void test_populate_Employee(String configName) throws IOException, SAXException {

    String packagePath = ClassUtil.toFilePath(getClass().getPackage());

        Smooks smooks = new Smooks(packagePath + "/" + configName);
        ExecutionContext executionContext = smooks.createExecutionContext();

        JavaResult result = new JavaResult();

        String resource = StreamUtils.readStream(new InputStreamReader(getClass().getResourceAsStream("employee-01.xml")));
        smooks.filterSource(executionContext, new StreamSource(new StringReader(resource)), result);
View Full Code Here


  public void test_factory() throws Exception {
    String packagePath = ClassUtil.toFilePath(getClass().getPackage());
        Smooks smooks = new Smooks(packagePath + "/factory-01-config.xml");
        ExecutionContext executionContext = smooks.createExecutionContext();
        JavaResult result = new JavaResult(true);

        smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("factory-01.xml")), result);

        assertNotNull(result.getBean("arrayList"));
View Full Code Here

    public void test_badxsl() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("bad-xsl-config.xml"));

        try {
            smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<doc/>")), null);
            fail("Expected SmooksConfigurationException.");
        } catch(SmooksConfigurationException e) {
            assertEquals("Error loading Templating resource: Target Profile: [[org.milyn.profile.Profile#default_profile]], Selector: [#document], Selector Namespace URI: [null], Resource: [/org/milyn/templating/xslt/bad-stylesheet.xsl], Num Params: [0]", e.getCause().getMessage());
        }
    }
View Full Code Here

public class CSVReaderTest extends TestCase {

    public void test_02() throws SmooksException, IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-01.xml"));

        ExecutionContext context = smooks.createExecutionContext();
        String result = SmooksUtil.filterAndSerialize(context, getClass().getResourceAsStream("input-message-01.csv"),
                smooks);
        assertEquals(
                "<csv-set><csv-record number=\"1\"><firstname>Tom</firstname><lastname>Fennelly</lastname><gender>Male</gender><age>4</age><country>Ireland</country></csv-record><csv-record number=\"2\"><firstname>Mike</firstname><lastname>Fennelly</lastname><gender>Male</gender><age>2</age><country>Ireland</country></csv-record></csv-set>",
                result);
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.