Examples of filterSource()


Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks(getClass().getResourceAsStream("DefaultWritingOff_No_Serializers_Test.xml"));

        StringSource stringSource = new StringSource("<a>aa<b>bbb<c />bbb</b>aaa</a>");
        StringResult stringResult = new StringResult();

        smooks.filterSource(smooks.createExecutionContext(), stringSource, stringResult);

        // The "default.serialization.on" global param is set to "false" in the config, so
        // nothing should get writen to the result because there are no configured
        // serialization Visitors.
        assertEquals("", stringResult.getResult());
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks(getClass().getResourceAsStream("DefaultWritingOff_One_Serializer_Test.xml"));

        StringSource stringSource = new StringSource("<a>aa<b>bbb<c />bbb</b>aaa</a>");
        StringResult stringResult = new StringResult();

        smooks.filterSource(smooks.createExecutionContext(), stringSource, stringResult);

        // The "default.serialization.on" global param is set to "false" in the config.
        // There's just a single result writing visitor configured on the "b" element...
        assertEquals("<b>bbbbbb</b>", stringResult.getResult());
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

     
      smooks.setReaderConfig(new GenericReaderConfigurator(PooledSAXParser.class));
      smooks.setFilterSettings(FilterSettings.newSAXSettings().setReaderPoolSize(1));
     
      PooledSAXParser.numSetHandlerCalls = 0;
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));     
      assertEquals(3, PooledSAXParser.numSetHandlerCalls);
    }
   
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

      smooks.setReaderConfig(new GenericReaderConfigurator(PooledSAXParser.class));
      smooks.setFilterSettings(FilterSettings.newSAXSettings().setReaderPoolSize(1));
     
      PooledSAXParser.numSetHandlerCalls = 0;
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));     
      assertEquals(3, PooledSAXParser.numSetHandlerCalls);
    }
   
    public void test_readerPool_Unpooled() {
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

      smooks.setFilterSettings(FilterSettings.newSAXSettings().setReaderPoolSize(1));
     
      PooledSAXParser.numSetHandlerCalls = 0;
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));     
      assertEquals(3, PooledSAXParser.numSetHandlerCalls);
    }
   
    public void test_readerPool_Unpooled() {
      Smooks smooks = new Smooks();
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

     
      smooks.setReaderConfig(new GenericReaderConfigurator(UnpooledSAXParser.class));
      smooks.setFilterSettings(FilterSettings.newSAXSettings().setReaderPoolSize(0));
     
      UnpooledSAXParser.numSetHandlerCalls = 0;
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));     
      assertEquals(3, UnpooledSAXParser.numSetHandlerCalls);
    }
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

      smooks.setReaderConfig(new GenericReaderConfigurator(UnpooledSAXParser.class));
      smooks.setFilterSettings(FilterSettings.newSAXSettings().setReaderPoolSize(0));
     
      UnpooledSAXParser.numSetHandlerCalls = 0;
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));     
      assertEquals(3, UnpooledSAXParser.numSetHandlerCalls);
    }

    private class TestParser extends AbstractParser {
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

      smooks.setFilterSettings(FilterSettings.newSAXSettings().setReaderPoolSize(0));
     
      UnpooledSAXParser.numSetHandlerCalls = 0;
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));
      smooks.filterSource(new StringSource("<x/>"));     
      assertEquals(3, UnpooledSAXParser.numSetHandlerCalls);
    }

    private class TestParser extends AbstractParser {
        public TestParser(ExecutionContext execContext) {
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

                assertEquals("&tomfennelly", element.getTextContent());
            }
        }, "element");

        StringResult serializedRes = new StringResult();
        smooks.filterSource(new StringSource("<element attrib=\"&amp;tomfennelly\">&amp;tomfennelly</element>"), serializedRes);

        assertEquals("<element attrib=\"&amp;tomfennelly\">&amp;tomfennelly</element>", serializedRes.getResult());
    }

    public void test_SAX() {
View Full Code Here

Examples of org.milyn.Smooks.filterSource()

        Smooks smooks = new Smooks();

        smooks.addVisitor(new MockSAX(), "element");

        StringResult serializedRes = new StringResult();
        smooks.filterSource(new StringSource("<element attrib=\"&amp;tomfennelly\">&amp;tomfennelly</element>"), serializedRes);

        assertEquals("<element attrib=\"&amp;tomfennelly\">&amp;tomfennelly</element>", serializedRes.getResult());
    }

    @TextConsumer
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.