Examples of filterSource()


Examples of org.milyn.Smooks.filterSource()

      System.out.println("Parsing [" + fileName + "]");
      Smooks smooks = new Smooks("config-samples/ec2-demo/smooks-config.xml");

      try {
         JavaResult result = new JavaResult();
         smooks.filterSource(new StreamSource(new FileInputStream(fileName.trim())), result);
         return (List<Nucleotide_Protein_Element>) result.getBean("customerList");
      } finally {
         smooks.close();
      }
   }
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

    private void test_exception(String config, boolean expectException) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/delivery/" + config);

        if(expectException) {
            try {
                smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<doc/>")), null);
                fail("Expected SmooksException");
            } catch(SmooksException e) {
                assertEquals("Terminate Exception", e.getCause().getMessage());
            }
        } else {
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

                fail("Expected SmooksException");
            } catch(SmooksException e) {
                assertEquals("Terminate Exception", e.getCause().getMessage());
            }
        } else {
            smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<doc/>")), null);
        }
    }
}
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

                    orderItems.add((String) event.getBean());
                }
            }
        });

        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("order-message.xml")), result, beans);

        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("order-message.xml")), new StringReader(result.toString()));

        assertEquals("header", beans.getBean("header"));
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

    public void test_streamingOff_01() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-eventstream-off.xml"));
        StringResult result = new StringResult();

        smooks.filterSource(new JavaSource(new MyBean1()), result);
        assertEquals("<nullsource-document />", result.getResult());
    }

    public void test_streamingOff_02() throws IOException, SAXException {
        Smooks smooks = new Smooks();
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        StringResult result = new StringResult();

        // Turn streaming off via the JavaSource...
        javaSource.setEventStreamRequired(false);

        smooks.filterSource(javaSource, result);
        assertEquals("<nullsource-document />", result.getResult());
    }

    public void test_streamingOn_01() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-eventstream-on.xml"));
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

    public void test_streamingOn_01() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-eventstream-on.xml"));
        StringResult result = new StringResult();

        smooks.filterSource(new JavaSource(new MyBean1()));
        assertNotSame("<nullsource-document></nullsource-document>", result.getResult());
    }

    public void test_streamingOn_02() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-eventstream-on.xml"));
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        // Explicitly configure it on... should cause an erros because it is explicitly
        // configured 'on' in the config...
        javaSource.setEventStreamRequired(false);

        try {
            smooks.filterSource(javaSource);
        } catch(SmooksException e) {
            assertEquals("Invalid Smooks configuration.  Feature '" + JavaSource.FEATURE_GENERATE_EVENT_STREAM + "' is explicitly configured 'on' in the Smooks configuration, while the supplied JavaSource has explicitly configured event streaming to be off (through a call to JavaSource.setEventStreamRequired).", e.getCause().getMessage());
        }
    }
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks(getClass().getResourceAsStream(config));
        ExecutionContext execContext = smooks.createExecutionContext();
        JavaSource source = new JavaSource(sourceObjects);
        StringWriter result = new StringWriter();

        smooks.filterSource(execContext, source, new StreamResult(result));
        assertEquals(expected, result.toString());
    }

    private static List<Object> SOURCE_1;
    static {
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        ExecutionContext execContext;

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-DOM-01.xml"));
        execContext = smooks.createExecutionContext();
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertTrue(SAXAndDOMVisitor.visited);

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-DOM-02.xml"));
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.