Package org.milyn.payload

Examples of org.milyn.payload.JavaResult


*/
public class AutoDecodeTest extends TestCase {

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

        try {
            smooks.filterSource(new StreamSource(getClass().getResourceAsStream("../order-01.xml")), jres);
        } finally {
            smooks.close();
        }

        OrderItem orderItem = (OrderItem) jres.getBean("orderItem");

        assertEquals(222, orderItem.getProductId());
        assertEquals(7, (int)orderItem.getQuantity());
        assertEquals(5.2, orderItem.getPrice());
    }
View Full Code Here


  public void test() throws IOException, SAXException {
    Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config.xml"));
    ExecutionContext execCtx = smooks.createExecutionContext();
    BeanContext beanContext = execCtx.getBeanContext();
    JavaResult jResult = new JavaResult();
   
    smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("message.xml")), jResult);
    assertEquals(3, jResult.getResultMap().size());
  }
View Full Code Here

public class MILYN_347_Test extends TestCase {

    public void test() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks.xml"));
        JavaSource source = new JavaSource("x", "XValObject");
        JavaResult result = new JavaResult();

        smooks.filterSource(source, result);

        assertEquals("{xxxx=XValObject}", result.getBean("bean").toString());
    }
View Full Code Here

*/
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

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.