Examples of JavaResult


Examples of org.milyn.payload.JavaResult

            Result result = FilterResult.getResult(executionContext, JavaResult.class);
            Source source = FilterSource.getSource(executionContext);
            Map<String, Object> beanMap = null;

            if(result != null) {
                JavaResult javaResult = (JavaResult) result;
                beanMap = javaResult.getResultMap();
            }
            if(source instanceof JavaSource) {
                JavaSource javaSource = (JavaSource) source;
                Map<String, Object> sourceBeans = javaSource.getBeans();
View Full Code Here

Examples of org.milyn.payload.JavaResult

    public void test_before_full_extended_config() throws ParserConfigurationException, SAXException, IOException   {
    Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-beforeVisit-full-extended-config.xml"));

    ExecutionContext executionContext = smooks.createExecutionContext();

    JavaResult result = new JavaResult();

    smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("test.xml")), result);

    Long a = (Long) result.getBean("a");

    assertNotNull(a);

    assertEquals(21, a.longValue());

    Long b = (Long) result.getBean("b");

    assertNotNull(b);

    assertEquals(5, b.longValue());
View Full Code Here

Examples of org.milyn.payload.JavaResult

    }

    @Test
    public void test_05() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-05.xml"));
        JavaResult result = new JavaResult();

        smooks.filterSource(new StringSource("a|b|c\n\rd|e|f"), result);

        List<FSTRecord> fstRecords = (List<FSTRecord>) result.getBean("fstRecords");

        Assert.assertEquals(2, fstRecords.size());
        Assert.assertEquals("a|b|c", fstRecords.get(0).toString());
        Assert.assertEquals("d|e|f", fstRecords.get(1).toString());
    }
View Full Code Here

Examples of org.milyn.payload.JavaResult

        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01.xml")), new StringReader(result.toString()));   
  }
 
  public void test_java_binding_simple_messages() throws IOException, SAXException {
    Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-jb-01.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);
   
    List<UNEdifactMessage41> messages = (List<UNEdifactMessage41>) jResult.getBean("unEdifactMessages");

//    System.out.println(sResult);
//    System.out.println(new XStream().toXML(messages));
   
    XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

Examples of org.milyn.payload.JavaResult

        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-02.xml")), new StringReader(new XStream().toXML(messages)));   
  }
 
  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);

//    System.out.println(new XStream().toXML(interchange));
   
    XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-03.xml")), new StringReader(new XStream().toXML(interchange)));   
View Full Code Here

Examples of org.milyn.payload.JavaResult

        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-03.xml")), new StringReader(new XStream().toXML(interchange)));   
  }

    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);

//        System.out.println(new XStream().toXML(interchange));

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-04.xml")), new StringReader(new XStream().toXML(interchange)));
View Full Code Here

Examples of org.milyn.payload.JavaResult

    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");
        assertEquals("1, 2, true, 3.0, 4.0, a, 5, 1163616328000, 6, 7, 8, [9, 10, 11], [12, 13, 14], {integerVal1=15, integerVal2=16, integerVal3=17, integerVal4=18, integerVal5=19, integerVal6=20, integerVal=21, mixedMap={intVal=1, longVal=2, boolVal=true, floatVal=3.0, doubleVal=4.0, charVal=a, integerVal=5, mixedIntValArray=[6, 7, 8]}},", bean.toString().trim());
    }
View Full Code Here

Examples of org.milyn.payload.JavaResult

        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);

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


        assertOrder(order);
    }
View Full Code Here

Examples of org.milyn.payload.JavaResult

        Order inOrder = new Order();
        Header inHeader = new Header();
        List<OrderItem> inOrderItems = new ArrayList<OrderItem>();

        JavaResult result = new JavaResult();
        result.getResultMap().put("order", inOrder);
        result.getResultMap().put("orderItemList", inOrderItems);
        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);

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

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

Examples of org.milyn.payload.JavaResult

    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);

        Employee employee = (Employee) result.getBean("employee");

        assertNotNull(employee);

        assertEquals("111", employee.getFirstName());
        assertEquals("222", employee.getLastName());
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.