You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by si...@apache.org on 2010/12/10 12:39:29 UTC
svn commit: r1044304 -
/cocoon/cocoon3/trunk/cocoon-sax/src/test/java/org/apache/cocoon/sax/PipelineTest.java
Author: simonetripodi
Date: Fri Dec 10 11:39:28 2010
New Revision: 1044304
URL: http://svn.apache.org/viewvc?rev=1044304&view=rev
Log:
SAXPipeliineBuilder showcase in pipeline with transformer test
Modified:
cocoon/cocoon3/trunk/cocoon-sax/src/test/java/org/apache/cocoon/sax/PipelineTest.java
Modified: cocoon/cocoon3/trunk/cocoon-sax/src/test/java/org/apache/cocoon/sax/PipelineTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/test/java/org/apache/cocoon/sax/PipelineTest.java?rev=1044304&r1=1044303&r2=1044304&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/test/java/org/apache/cocoon/sax/PipelineTest.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/test/java/org/apache/cocoon/sax/PipelineTest.java Fri Dec 10 11:39:28 2010
@@ -24,9 +24,8 @@ import java.util.Map;
import junit.framework.TestCase;
-import org.apache.cocoon.pipeline.NonCachingPipeline;
-import org.apache.cocoon.pipeline.Pipeline;
import org.apache.cocoon.pipeline.builder.PipelineBuilder;
+import org.apache.cocoon.sax.builder.SAXPipelineBuilder;
import org.apache.cocoon.sax.component.XMLGenerator;
import org.apache.cocoon.sax.component.XMLSerializer;
import org.apache.cocoon.sax.component.XSLTTransformer;
@@ -39,14 +38,15 @@ public class PipelineTest extends TestCa
* serializer.
*/
public void testPipelineWithTransformer() throws Exception {
- Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>();
- pipeline.addComponent(new XMLGenerator("<x></x>"));
- pipeline.addComponent(new XSLTTransformer(this.getClass().getResource("/test.xslt")));
- pipeline.addComponent(new XMLSerializer());
-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- pipeline.setup(baos);
- pipeline.execute();
+
+ new SAXPipelineBuilder().newNonCachingPipeline()
+ .setStringGenerator("<x></x>")
+ .addXSLTTransformer(this.getClass().getResource("/test.xslt"))
+ .addSerializer()
+ .withEmptyConfiguration()
+ .setup(baos)
+ .execute();
Diff diff = new Diff("<?xml version=\"1.0\" encoding=\"UTF-8\"?><p></p>", new String(baos.toByteArray()));
assertTrue("XSL transformation didn't work as expected " + diff, diff.identical());