Package org.milyn.container

Examples of org.milyn.container.ExecutionContext


    }

    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);
        assertEquals("Myself", bean.getName());
        assertEquals("0861070070", bean.getPhoneNumber());
        assertEquals("Skeagh Bridge...", bean.getAddress());
    }
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

        execSmooksArrays(smooks);
    }

    private void execSmooksArrays(Smooks smooks) {
        JavaResult result = new JavaResult();
        ExecutionContext execContext = smooks.createExecutionContext();

        //execContext.setEventListener(new ExecListener());
        smooks.filterSource(execContext, new StreamSource(getClass().getResourceAsStream("order-01.xml")), result);

        Order order = (Order) result.getBean("order");
View Full Code Here

        System.setProperty("javax.xml.transform.TransformerFactory", org.apache.xalan.processor.TransformerFactoryImpl.class.getName());
    SmooksUtil.registerResource(res, smooks);

    try {
      InputStream stream = getClass().getResourceAsStream("htmlpage.html");
            ExecutionContext context = smooks.createExecutionContext();
      transResult = SmooksUtil.filterAndSerialize(context, stream, smooks);
    } catch (SmooksException e) {
      e.printStackTrace();
      fail("unexpected exception: " + e.getMessage());
    }
View Full Code Here

    res.setParameter("action", action);
    SmooksUtil.registerResource(res, smooks);

    try {
      InputStream stream = getClass().getResourceAsStream("htmlpage.html");
            ExecutionContext context = smooks.createExecutionContext();
      transResult = SmooksUtil.filterAndSerialize(context, stream, smooks);
    } catch (SmooksException e) {
      e.printStackTrace();
      fail("unexpected exception: " + e.getMessage());
    }
View Full Code Here

    }

    public void test_xsl_bind(String config) throws SAXException, IOException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream(config));
        StringReader input;
        ExecutionContext context;

        input = new StringReader("<a><b><c/></b></a>");
        context = smooks.createExecutionContext();
        smooks.filterSource(context, new StreamSource(input), null);

        assertEquals("<bind/>", context.getBeanContext().getBean("mybeanTemplate"));

        input = new StringReader("<c/>");
        context = smooks.createExecutionContext();
        smooks.filterSource(context, new StreamSource(input), null);
        assertEquals("<bind/>", context.getBeanContext().getBean("mybeanTemplate"));
    }
View Full Code Here

TOP

Related Classes of org.milyn.container.ExecutionContext

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.