Package org.milyn.payload

Examples of org.milyn.payload.JavaResult


*/
public class BeanBindingExtendedConfigTest extends TestCase {

    public void test() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("test_bean_01.xml"));
        JavaResult result = new JavaResult();
        ExecutionContext execContext = smooks.createExecutionContext();

        //execContext.setEventListener(new HtmlReportGenerator("/zap/report.html"));
        smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

        ExtendedOrder order = (ExtendedOrder) result.getBean("order");
        assertOrderOK(order, true);

        Map headerHash = (Map) result.getBean("headerBeanHash");
        assertEquals("{privatePerson=, customer=Joe, date=Wed Nov 15 13:45:28 EST 2006}", headerHash.toString());
    }
View Full Code Here


       ExtendedOrder inExtendedOrder = new ExtendedOrder();
       List<OrderItem> inOrderItems = new ArrayList<OrderItem>();
       Header inHeader = new Header();

         JavaResult result = new JavaResult();
       result.getResultMap().put("order", inExtendedOrder);
       result.getResultMap().put("orderItemList", inOrderItems);
       result.getResultMap().put("headerBean", inHeader);

         ExecutionContext execContext = smooks.createExecutionContext();

         //execContext.setEventListener(new HtmlReportGenerator("/target/report.html"));
         smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

         ExtendedOrder order = (ExtendedOrder) result.getBean("order");

         assertSame(inExtendedOrder, order);
         assertSame(inOrderItems, order.getOrderItems());
         assertSame(inHeader, order.getHeader());
View Full Code Here

    }

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

    JavaResult result = new JavaResult();

    ExecutionContext execContext = smooks.createExecutionContext();

    //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execContext, new StreamSource(getInput("flat-01.xml")), result);
View Full Code Here

  }

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

    JavaResult result = new JavaResult();

    ExecutionContext execContext = smooks.createExecutionContext();

    //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execContext, new StreamSource(getInput("flat-01.xml")), result);
View Full Code Here

    }

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

    JavaResult result = new JavaResult();

    ExecutionContext execContext = smooks.createExecutionContext("A");

    //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

    ExtendedOrder order =  (ExtendedOrder) result.getBean("order");
    assertEquals(2d, order.getTotal());

    execContext = smooks.createExecutionContext("B");

    //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

    order =  (ExtendedOrder) result.getBean("order");
    assertEquals(4d, order.getTotal());

  }
View Full Code Here

  }

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

    JavaResult result = new JavaResult();

    ExecutionContext execContext = smooks.createExecutionContext();

    //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

    ExtendedOrder order =  (ExtendedOrder) result.getBean("order");
    assertEquals(2d, order.getTotal());
  }
View Full Code Here

  }

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

        JavaResult result = new JavaResult();

        ExecutionContext execContext = smooks.createExecutionContext();

        //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
        smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

        Map order =  (Map) result.getBean("orderItem");
        assertEquals(154.2d, order.get("total"));
    }
View Full Code Here

    }

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

        JavaResult result = new JavaResult();

        ExecutionContext execContext = smooks.createExecutionContext();

        //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
        smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

        Map<?, ?> order =  (Map<?, ?>) result.getBean("order");

        assertTrue(order instanceof HashMap);
    }
View Full Code Here

    }

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

        JavaResult result = new JavaResult();

        ExecutionContext execContext = smooks.createExecutionContext();

        //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
        smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

        Map<?, ?> order1 =  (Map<?, ?>) result.getBean("default_order");
        Map<?, ?> order2 =  (Map<?, ?>) result.getBean("mvel_order");
        Map<?, ?> order3 =  (Map<?, ?>) result.getBean("mvel_class_order");
        Map<?, ?> order4 =  (Map<?, ?>) result.getBean("basic_order");

        assertTrue(order1 instanceof HashMap);
        assertTrue(order2 instanceof HashMap);
        assertTrue(order3 instanceof HashMap);
        assertTrue(order4 instanceof HashMap);
View Full Code Here


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

        JavaResult result = new JavaResult();

        ExecutionContext execContext = smooks.createExecutionContext();

        //execContext.setEventListener(new HtmlReportGenerator("target/report.html"));
        smooks.filterSource(execContext, new StreamSource(getInput("order-01.xml")), result);

        Map<?, ?> order =  (Map<?, ?>) result.getBean("order");

        assertTrue(order instanceof HashMap);
    }
View Full Code Here

TOP

Related Classes of org.milyn.payload.JavaResult

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.