Package org.milyn.payload

Examples of org.milyn.payload.StringResult


    assertOK("expected_02.xml", result);       
  }

  public void test_DOM_03() throws SAXException, IOException {
    Smooks smooks = new Smooks();
    StringResult result = new StringResult();
   
    smooks.addVisitor(new DefaultSerializationUnit(), "items");
    smooks.addVisitor(new DefaultSerializationUnit(), "items/**");
    smooks.setFilterSettings(new FilterSettings().setDefaultSerializationOn(false).setFilterType(StreamFilterType.DOM));
   
View Full Code Here


        Smooks smooks = new Smooks();

        smooks.setFilterSettings(new FilterSettings().setFilterType(StreamFilterType.DOM).setRewriteEntities(true));

        StringResult stringResult = new StringResult();
        smooks.filterSource(new StringSource("<a attrib=\"an &amp; 'attribute\">Bigger &gt; is better!</a>"), stringResult);
        assertEquals("<a attrib=\"an &amp; &apos;attribute\">Bigger &gt; is better!</a>", stringResult.getResult());
    }
View Full Code Here

*/
public class MILYN285Test extends TestCase {

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

        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("message.xml")), result);
        XMLUnit.compareXML("<root>\n" +
                "\t<abc>def</abc>\n" +
                "\t<bla>\n" +
                "\t\tdef\n" +
                "\t</bla>\n" +
                "</root>", result.toString());
    }
View Full Code Here

        test("MILYN-140-02.xml");
    }

    public void test(String config) throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream(config));
        StringResult result = new StringResult();

        smooks.filterSource(new StringSource("<x/>"), result);
        assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>Hi there!", result.getResult());
    }
View Full Code Here

    public void testHelper(String config, String message) throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-" + config + ".xml"));
        String expected = StreamUtils.readStreamAsString(getClass().getResourceAsStream("expected-" + config + ".xml"));

        StringResult result = new StringResult();
        smooks.filterSource(new StringSource(message), result);

//        System.out.println(result);
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual(expected, result.toString());
    }
View Full Code Here

            assertEquals(truncated, "");
          }
        }
      }, "record");

      StringResult result = new StringResult();
      smooks.filterSource(smooks.createExecutionContext(), getSource(), result);
      logger.info(result.toString());
    } finally {
      if (smooks != null) {
        smooks.close();
      }
    }
View Full Code Here

    test(FilterSettings.DEFAULT_SAX);
  }
 
  public void test(FilterSettings filterSettings) throws IOException, SAXException {
    Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-xml.xml");
    StringResult result = new StringResult();
   
    smooks.setFilterSettings(filterSettings);
    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("unedifact-msg-01.edi")), result);
    XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01.xml")), new StringReader(result.toString()));   
  }
View Full Code Here

        test_with_empty_nodes_ignored(FilterSettings.DEFAULT_SAX);
    }

    public void test_with_empty_nodes_ignored(FilterSettings filterSettings) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-xml.xml");
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("unedifact-msg-01-with-empty-nodes.edi")), result);

//        System.out.println(result);

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01-with-empty-nodes-ignored.xml")), new StringReader(result.toString()));
    }
View Full Code Here

        test_with_empty_nodes_not_ignored(FilterSettings.DEFAULT_SAX);
    }

    public void test_with_empty_nodes_not_ignored(FilterSettings filterSettings) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-xml-not-ignored.xml");
        StringResult result = new StringResult();

        smooks.setFilterSettings(filterSettings);
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("unedifact-msg-01-with-empty-nodes.edi")), result);

//        System.out.println(result);

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01-with-empty-nodes-not-ignored.xml")), new StringReader(result.toString()));
    }
View Full Code Here

  public void test_zipped() throws IOException, SAXException, EDIConfigurationException {
    createZip();
   
    Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-zip.xml");
    StringResult result = new StringResult();
   
    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("unedifact-msg-01.edi")), result);

    XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01.xml")), new StringReader(result.toString()));   
  }
View Full Code Here

TOP

Related Classes of org.milyn.payload.StringResult

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.