You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2009/02/27 09:06:48 UTC

svn commit: r748423 - in /cocoon/cocoon3/trunk: cocoon-stax/pom.xml cocoon-stax/src/test/java/org/apache/cocoon/stax/sample/test/SubSetTransformerTest.java parent/pom.xml

Author: reinhard
Date: Fri Feb 27 08:06:47 2009
New Revision: 748423

URL: http://svn.apache.org/viewvc?rev=748423&view=rev
Log:
Use Woodstox-ASL for Java 5 support

Modified:
    cocoon/cocoon3/trunk/cocoon-stax/pom.xml
    cocoon/cocoon3/trunk/cocoon-stax/src/test/java/org/apache/cocoon/stax/sample/test/SubSetTransformerTest.java
    cocoon/cocoon3/trunk/parent/pom.xml

Modified: cocoon/cocoon3/trunk/cocoon-stax/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stax/pom.xml?rev=748423&r1=748422&r2=748423&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stax/pom.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-stax/pom.xml Fri Feb 27 08:06:47 2009
@@ -53,10 +53,10 @@
       </exclusions>
     </dependency>
     <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+      <groupId>org.codehaus.woodstox</groupId>
+      <artifactId>wstx-asl</artifactId>
       <optional>true</optional>
-    </dependency>    
+    </dependency>   
     <dependency>
       <groupId>org.apache.cocoon.sax</groupId>
       <artifactId>cocoon-sax</artifactId>

Modified: cocoon/cocoon3/trunk/cocoon-stax/src/test/java/org/apache/cocoon/stax/sample/test/SubSetTransformerTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stax/src/test/java/org/apache/cocoon/stax/sample/test/SubSetTransformerTest.java?rev=748423&r1=748422&r2=748423&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stax/src/test/java/org/apache/cocoon/stax/sample/test/SubSetTransformerTest.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stax/src/test/java/org/apache/cocoon/stax/sample/test/SubSetTransformerTest.java Fri Feb 27 08:06:47 2009
@@ -16,8 +16,7 @@
  */
 package org.apache.cocoon.stax.sample.test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
@@ -38,51 +37,43 @@
 import org.junit.Test;
 
 /**
- * Contains unit tests for a {@link SubSetTransformer} that removes everything
- * in a xml document but a specified sub tree.<br>
+ * Contains unit tests for a {@link SubSetTransformer} that removes everything in a xml document but
+ * a specified sub tree.<br>
  * 
- * * Removes everything but the element "element" with the attribute
- * "attribute='first'".<br>
- * * Removes everything but the element "element" with the attribute
- * "attribute='second'".<br>
- * * Removes everything because specifying two attributes will not trigger
- * elements containing only one of them.<br>
- * * Removes everything but the element "element" with no attribute specified
- * which results in everything is deleted but the first occurrence of a
- * "element" element containing any attributes.
+ * * Removes everything but the element "element" with the attribute "attribute='first'".<br>
+ * * Removes everything but the element "element" with the attribute "attribute='second'".<br>
+ * * Removes everything because specifying two attributes will not trigger elements containing only
+ * one of them.<br>
+ * * Removes everything but the element "element" with no attribute specified which results in
+ * everything is deleted but the first occurrence of a "element" element containing any attributes.
  */
 public class SubSetTransformerTest {
 
     /**
-     * Shows a {@link SubSetTransformer} that removes everything but the element
-     * "element" with the attribute "attribute='first'".
+     * Shows a {@link SubSetTransformer} that removes everything but the element "element" with the
+     * attribute "attribute='first'".
      * 
-     * @exception Exception
-     *                Is thrown if an error occurs loading the files or in the
-     *                pipeline itself.
+     * @exception Exception Is thrown if an error occurs loading the files or in the pipeline
+     *                itself.
      */
     @Test
     public void testFirstSubtree() throws Exception {
-        InputStream input = SubSetTransformerTest.class.getResource(
-        "/org/apache/cocoon/stax/sample/special_root.xml").openStream();
+        InputStream input = SubSetTransformerTest.class.getResource("/org/apache/cocoon/stax/sample/special_root.xml")
+                .openStream();
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
 
         Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
         pipe.addComponent(new StAXGenerator(input));
         XMLEventFactory factory = XMLEventFactory.newInstance();
-        pipe.addComponent(new SubSetTransformer("element", factory
-                .createAttribute(new QName("attribute"), "first")));
+        pipe.addComponent(new SubSetTransformer("element", factory.createAttribute(new QName("attribute"), "first")));
         pipe.addComponent(new StAXSerializer());
         pipe.setup(out);
         pipe.execute();
 
         String created = out.toString();
-        String correctOne = IOUtils
-        .toString(SubSetTransformerTest.class
-                .getResource(
-                "/org/apache/cocoon/stax/sample/special_root_first.xml")
-                .openStream());
+        String correctOne = IOUtils.toString(SubSetTransformerTest.class.getResource(
+                "/org/apache/cocoon/stax/sample/special_root_first.xml").openStream());
 
         XMLUnit.setIgnoreWhitespace(true);
         Diff myDiff = new Diff(correctOne, created);
@@ -90,35 +81,30 @@
     }
 
     /**
-     * Shows a {@link SubSetTransformer} that removes everything but the element
-     * "element" with the attribute "attribute='second'".
+     * Shows a {@link SubSetTransformer} that removes everything but the element "element" with the
+     * attribute "attribute='second'".
      * 
-     * @exception Exception
-     *                Is thrown if an error occurs loading the files or in the
-     *                pipeline itself.
+     * @exception Exception Is thrown if an error occurs loading the files or in the pipeline
+     *                itself.
      */
     @Test
     public void testSecondSubtree() throws Exception {
-        InputStream input = SubSetTransformerTest.class.getResource(
-        "/org/apache/cocoon/stax/sample/special_root.xml").openStream();
+        InputStream input = SubSetTransformerTest.class.getResource("/org/apache/cocoon/stax/sample/special_root.xml")
+                .openStream();
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
 
         Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
         pipe.addComponent(new StAXGenerator(input));
         XMLEventFactory factory = XMLEventFactory.newInstance();
-        pipe.addComponent(new SubSetTransformer("element", factory
-                .createAttribute(new QName("attribute"), "second")));
+        pipe.addComponent(new SubSetTransformer("element", factory.createAttribute(new QName("attribute"), "second")));
         pipe.addComponent(new StAXSerializer());
         pipe.setup(out);
         pipe.execute();
 
         String created = out.toString();
-        String correctOne = IOUtils
-        .toString(SubSetTransformerTest.class
-                .getResource(
-                "/org/apache/cocoon/stax/sample/special_root_second.xml")
-                .openStream());
+        String correctOne = IOUtils.toString(SubSetTransformerTest.class.getResource(
+                "/org/apache/cocoon/stax/sample/special_root_second.xml").openStream());
 
         XMLUnit.setIgnoreWhitespace(true);
         Diff myDiff = new Diff(correctOne, created);
@@ -126,18 +112,16 @@
     }
 
     /**
-     * Shows a {@link SubSetTransformer} that removes everything because
-     * specifying two attributes will not trigger elements containing only one
-     * of them.
+     * Shows a {@link SubSetTransformer} that removes everything because specifying two attributes
+     * will not trigger elements containing only one of them.
      * 
-     * @exception Exception
-     *                Is thrown if an error occurs loading the files or in the
-     *                pipeline itself.
+     * @exception Exception Is thrown if an error occurs loading the files or in the pipeline
+     *                itself.
      */
     @Test
     public void testNoSubtree() throws Exception {
-        InputStream input = SubSetTransformerTest.class.getResource(
-        "/org/apache/cocoon/stax/sample/special_root.xml").openStream();
+        InputStream input = SubSetTransformerTest.class.getResource("/org/apache/cocoon/stax/sample/special_root.xml")
+                .openStream();
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
 
@@ -145,32 +129,31 @@
         pipe.addComponent(new StAXGenerator(input));
         XMLEventFactory factory = XMLEventFactory.newInstance();
         pipe.addComponent(new StAXCleaningTransformer());
-        pipe.addComponent(new SubSetTransformer("element", factory
-                .createAttribute(new QName("attribute"), "second"), factory
-                .createAttribute(new QName("attribute"), "first")));
+        pipe.addComponent(new SubSetTransformer("element", factory.createAttribute(new QName("attribute"), "second"),
+                factory.createAttribute(new QName("attribute"), "first")));
         pipe.addComponent(new StAXSerializer());
         pipe.setup(out);
         pipe.execute();
 
-        String created = out.toString();
+        // The replace step is required since the jdk1.6 default implementation produces other chars
+        // than the woodstox implementation used for jdk1.5
+        String created = out.toString().replace("\'", "\"");
 
         assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", created);
     }
 
     /**
-     * Shows a {@link SubSetTransformer} that removes everything but the element
-     * "element" with no attribute specified which results in everything is
-     * deleted but the first occurrence of a "element" element containing any
-     * attributes.
+     * Shows a {@link SubSetTransformer} that removes everything but the element "element" with no
+     * attribute specified which results in everything is deleted but the first occurrence of a
+     * "element" element containing any attributes.
      * 
-     * @exception Exception
-     *                Is thrown if an error occurs loading the files or in the
-     *                pipeline itself.
+     * @exception Exception Is thrown if an error occurs loading the files or in the pipeline
+     *                itself.
      */
     @Test
     public void testNoAttributesFirstSubtree() throws Exception {
-        InputStream input = SubSetTransformerTest.class.getResource(
-        "/org/apache/cocoon/stax/sample/special_root.xml").openStream();
+        InputStream input = SubSetTransformerTest.class.getResource("/org/apache/cocoon/stax/sample/special_root.xml")
+                .openStream();
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
 
@@ -182,11 +165,8 @@
         pipe.execute();
 
         String created = out.toString();
-        String correctOne = IOUtils
-        .toString(SubSetTransformerTest.class
-                .getResource(
-                "/org/apache/cocoon/stax/sample/special_root_first.xml")
-                .openStream());
+        String correctOne = IOUtils.toString(SubSetTransformerTest.class.getResource(
+                "/org/apache/cocoon/stax/sample/special_root_first.xml").openStream());
 
         XMLUnit.setIgnoreWhitespace(true);
         Diff myDiff = new Diff(correctOne, created);

Modified: cocoon/cocoon3/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/parent/pom.xml?rev=748423&r1=748422&r2=748423&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/parent/pom.xml (original)
+++ cocoon/cocoon3/trunk/parent/pom.xml Fri Feb 27 08:06:47 2009
@@ -251,9 +251,9 @@
         <version>3.0</version>
       </dependency>
       <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-stax-api_1.0_spec</artifactId>
-        <version>1.0.1</version>
+        <groupId>org.codehaus.woodstox</groupId>
+        <artifactId>wstx-asl</artifactId>
+        <version>3.2.7</version>
       </dependency>      
       <dependency>
         <groupId>org.apache.xmlgraphics</groupId>