Package org.milyn.payload

Examples of org.milyn.payload.StringResult


        assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>Hi there!", result.getResult());
    }

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

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


    public void test_nodeModel_1(StreamFilterType filterType) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/templating/freemarker/test-configs-ext-05.cdrl");

        smooks.setFilterSettings(new FilterSettings(filterType));

        StringResult result = new StringResult();
        smooks.filterSource(new StringSource("<a><b><c>cvalue1</c><c>cvalue2</c><c>cvalue3</c></b></a>"), result);
        assertEquals("'cvalue1''cvalue2''cvalue3'", result.toString());
    }
View Full Code Here

    }

    private void test(String mapping) throws IOException, SAXException {
    String expected = new String(StreamUtils.readStream(getClass().getResourceAsStream("expected.xml")));
        Smooks smooks = new Smooks();
        StringResult result = new StringResult();

        // Create and initialise the Smooks config for the parser...
        smooks.setReaderConfig(new EDIReaderConfigurator(mapping));
        smooks.filterSource(new StreamSource(getClass().getResourceAsStream("edi-input.txt")), result);

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

    }
    public void test_nodeModel_3(StreamFilterType filterType) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/templating/freemarker/test-configs-ext-07.cdrl");

        smooks.setFilterSettings(new FilterSettings(filterType));
        StringResult result = new StringResult();
        smooks.filterSource(new StringSource("<a><b javabind='javaval'><c>cvalue1</c><c>cvalue2</c><c>cvalue3</c></b></a>"), result);
        assertEquals("'cvalue1''cvalue2''cvalue3' javaVal=javaval", result.toString());
    }
View Full Code Here

        assertEquals("data to outstream", MockOutStreamResource.outputStream.toString());
    }

    public void test_PTIME() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("test-configs-ext-PTIME.cdrl"));
        StringResult result = new StringResult();

        smooks.filterSource(new StringSource("<doc/>"), result);

        // should be able to convert the result to a Long instance...
        new Long(result.toString());
    }
View Full Code Here

        rootObj.getEnums().add(new TheEnumContainer());
        rootObj.getEnums().add(new TheEnumContainer());

        Smooks smooks = new Smooks();
        StringResult res = new StringResult();

        smooks.filterSource(new JavaSource(rootObj), res);

        String expected = StreamUtils.readStreamAsString(getClass().getResourceAsStream("expected.xml"));
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual(expected, res.getResult());
    }
View Full Code Here

            final Smooks smooks = new Smooks(config);

            final String xml = readStringFromFile("validation-test.xml");

            final ExecutionContext context = smooks.createExecutionContext();
            final StringResult result = new StringResult();
            final ValidationResult validationResult = new ValidationResult();

            smooks.filterSource(context, new StringSource(xml), result, validationResult);

            final List<OnFailResult> warnings = validationResult.getWarnings();
View Full Code Here

            assertEquals(truncated, "");
          }
        }
      }, "csv-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

        Smooks smooks = new Smooks(MILYN_364_Test.class.getResourceAsStream("config.xml"));

        smooks.setFilterSettings(FilterSettings.DEFAULT_SAX);
       
        try {
            StringResult xmlResult = new StringResult();
            JavaResult javaResult = new JavaResult();
           
            smooks.filterSource(new StreamSource(MILYN_364_Test.class.getResourceAsStream("order.xml")), xmlResult, javaResult);
           
            Header bean = (Header) javaResult.getBean("header");
View Full Code Here

        new Long(result.toString());
    }

    public void test_PUUID() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("test-configs-ext-PUUID.cdrl"));
        StringResult result = new StringResult();

        smooks.filterSource(new StringSource("<doc/>"), result);
        assertTrue(result.toString().length() > 10);
    }
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.