ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1551266 - in /webservices/axiom/trunk/modules: axiom-api/src/main/java/org/apache/axiom/om/impl/builder/ axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/ axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/ axiom-common-impl/src/ma...
Date Mon, 16 Dec 2013 17:08:03 GMT
Author: veithen
Date: Mon Dec 16 17:08:03 2013
New Revision: 1551266

URL: http://svn.apache.org/r1551266
Log:
Deprecated SAXOMBuilder and OMResult. Instead, OMContainer#getSAXResult() should be used.

Added:
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContentHandler.java
      - copied, changed from r1551253, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMContentHandler.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
      - copied, changed from r1551253, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
    webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
  (contents, props changed)
      - copied, changed from r1460240, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
    webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java
      - copied, changed from r1551197, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java
    webservices/axiom/trunk/modules/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/
    webservices/axiom/trunk/modules/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
      - copied, changed from r1551197, webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java
Removed:
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMContentHandler.java
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/
    webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/
    webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/jaxp/
    webservices/axiom/trunk/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/jaxp/
Modified:
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/BuilderUtil.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
    webservices/axiom/trunk/modules/axiom-compat/pom.xml

Modified: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/BuilderUtil.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/BuilderUtil.java?rev=1551266&r1=1551265&r2=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/BuilderUtil.java
(original)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/BuilderUtil.java
Mon Dec 16 17:08:03 2013
@@ -22,10 +22,13 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.OMElementEx;
 
-class BuilderUtil {
+/**
+ * For internal use only.
+ */
+public class BuilderUtil {
     private BuilderUtil() {}
     
-    static void setNamespace(OMElement element, String namespaceURI, String prefix, boolean
namespaceURIInterning) {
+    public static void setNamespace(OMElement element, String namespaceURI, String prefix,
boolean namespaceURIInterning) {
         if (prefix == null) {
             prefix = "";
         }

Copied: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContentHandler.java
(from r1551253, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMContentHandler.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContentHandler.java?p2=webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContentHandler.java&p1=webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMContentHandler.java&r1=1551253&r2=1551266&rev=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/OMContentHandler.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContentHandler.java
Mon Dec 16 17:08:03 2013
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.axiom.om.impl.builder;
+package org.apache.axiom.om.impl.common;
 
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMContainer;

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java?rev=1551266&r1=1551265&r2=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SAXResultContentHandler.java
Mon Dec 16 17:08:03 2013
@@ -22,7 +22,6 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.impl.builder.OMContentHandler;
 
 public class SAXResultContentHandler extends OMContentHandler {
     private final OMContainer root;

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java?rev=1551266&r1=1551265&r2=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
Mon Dec 16 17:08:03 2013
@@ -31,7 +31,6 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.builder.SAXOMBuilder;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.builder.XOPAwareStAXOMBuilder;
 import org.apache.axiom.om.util.StAXParserConfiguration;

Copied: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
(from r1551253, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java?p2=webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java&p1=webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java&r1=1551253&r2=1551266&rev=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
Mon Dec 16 17:08:03 2013
@@ -17,18 +17,19 @@
  * under the License.
  */
 
-package org.apache.axiom.om.impl.builder;
+package org.apache.axiom.om.impl.common.factory;
 
-import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMElementEx;
+import org.apache.axiom.om.impl.builder.BuilderUtil;
+import org.apache.axiom.om.impl.builder.OMFactoryEx;
+import org.apache.axiom.om.impl.common.OMContentHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 
@@ -43,37 +44,12 @@ public class SAXOMBuilder extends OMCont
     
     private final OMFactoryEx factory;
 
-    /**
-     * For internal use only.
-     * 
-     * @param factory
-     * @param source
-     * @param expandEntityReferences
-     */
     public SAXOMBuilder(OMFactory factory, SAXSource source, boolean expandEntityReferences)
{
         super(expandEntityReferences);
         this.factory = (OMFactoryEx)factory;
         this.source = source;
     }
     
-    /**
-     * @deprecated Instead of creating an instance of this class directly, create a
-     *             {@link SAXSource} and use
-     *             {@link OMXMLBuilderFactory#createOMBuilder(OMFactory, SAXSource, boolean)}.
-     */
-    public SAXOMBuilder(OMFactory factory) {
-        this(factory, null, true);
-    }
-    
-    /**
-     * @deprecated Instead of creating an instance of this class directly, create a
-     *             {@link SAXSource} and use
-     *             {@link OMXMLBuilderFactory#createOMBuilder(SAXSource, boolean)}.
-     */
-    public SAXOMBuilder() {
-        this(OMAbstractFactory.getOMFactory());
-    }
-    
     protected OMContainer doStartDocument() {
         document = factory.createOMDocument(this);
         return document;
@@ -113,22 +89,6 @@ public class SAXOMBuilder extends OMCont
         }
     }
     
-    /**
-     * Get the root element of the Axiom tree built by this content handler.
-     * 
-     * @deprecated
-     * @return the root element of the tree
-     * @throws OMException if the tree is not complete
-     */
-    public OMElement getRootElement() {
-        OMElement root = getDocumentElement();
-        if (root != null && root.isComplete()) {
-            return root;
-        } else {
-            throw new OMException("Tree not complete");
-        }
-    }
-
     public int next() throws OMException {
         throw new UnsupportedOperationException();
     }

Modified: webservices/axiom/trunk/modules/axiom-compat/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-compat/pom.xml?rev=1551266&r1=1551265&r2=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-compat/pom.xml (original)
+++ webservices/axiom/trunk/modules/axiom-compat/pom.xml Mon Dec 16 17:08:03 2013
@@ -50,6 +50,12 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>axiom-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>axiom-impl</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
@@ -77,6 +83,11 @@
             <artifactId>xmlunit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

Copied: webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
(from r1460240, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java?p2=webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java&p1=webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java&r1=1460240&r2=1551266&rev=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
Mon Dec 16 17:08:03 2013
@@ -21,6 +21,7 @@ package org.apache.axiom.om.impl.builder
 
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -32,6 +33,7 @@ import org.apache.axiom.om.OMXMLParserWr
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMElementEx;
 import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
@@ -44,8 +46,21 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.XMLConstants;
+import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.sax.SAXSource;
 
+/**
+ * @deprecated To build an Axiom tree from SAX events, either use
+ *             {@link OMXMLBuilderFactory#createOMBuilder(SAXSource, boolean)} (if a
+ *             {@link SAXSource} is available or can be easily constructed), or create an
+ *             {@link OMDocument} (using {@link OMFactory#createOMDocument()}) and use
+ *             {@link OMContainer#getSAXResult()} to create a {@link SAXResult} for that
document.
+ *             After writing the SAX events to the {@link SAXResult}, the root element of
the
+ *             resulting tree can be retrieved using {@link OMDocument#getOMDocumentElement()}.
If
+ *             the application code doesn't support {@link SAXResult} and needs to interface
with a
+ *             {@link ContentHandler} directly, use {@link SAXResult#getHandler()} on the
+ *             {@link SAXResult} returned by {@link OMContainer#getSAXResult()}.
+ */
 public class SAXOMBuilder extends DefaultHandler implements LexicalHandler, DeclHandler,
OMXMLParserWrapper {
     private final SAXSource source;
     private final boolean expandEntityReferences;
@@ -93,33 +108,16 @@ public class SAXOMBuilder extends Defaul
     private boolean inEntityReference;
     private int entityReferenceDepth;
 
-    /**
-     * For internal use only.
-     * 
-     * @param factory
-     * @param source
-     * @param expandEntityReferences
-     */
-    public SAXOMBuilder(OMFactory factory, SAXSource source, boolean expandEntityReferences)
{
+    private SAXOMBuilder(OMFactory factory, SAXSource source, boolean expandEntityReferences)
{
         this.factory = (OMFactoryEx)factory;
         this.source = source;
         this.expandEntityReferences = expandEntityReferences;
     }
     
-    /**
-     * @deprecated Instead of creating an instance of this class directly, create a
-     *             {@link SAXSource} and use
-     *             {@link OMXMLBuilderFactory#createOMBuilder(OMFactory, SAXSource, boolean)}.
-     */
     public SAXOMBuilder(OMFactory factory) {
         this(factory, null, true);
     }
     
-    /**
-     * @deprecated Instead of creating an instance of this class directly, create a
-     *             {@link SAXSource} and use
-     *             {@link OMXMLBuilderFactory#createOMBuilder(SAXSource, boolean)}.
-     */
     public SAXOMBuilder() {
         this(OMAbstractFactory.getOMFactory());
     }

Propchange: webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Dec 16 17:08:03 2013
@@ -0,0 +1,12 @@
+/webservices/axiom/branches/AXIOM-201/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1183599-1433135
+/webservices/axiom/branches/AXIOM-399/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1329379-1331100
+/webservices/axiom/branches/AXIOM-412/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1311325-1325526
+/webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1334121-1336372
+/webservices/axiom/branches/AXIOM-435/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1361507-1366198
+/webservices/axiom/branches/AXIOM-437/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1364041-1364239
+/webservices/axiom/branches/CHECK_PARENT_BUG/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1338398-1338886
+/webservices/axiom/branches/CLONE/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1337822-1339011
+/webservices/axiom/branches/CLONE_NODE/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1346607-1353106
+/webservices/axiom/branches/JAXB2_DS/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1366463-1367737
+/webservices/axiom/branches/namespaceURIInterning/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1293148-1293587
+/webservices/axiom/branches/osgi-redesign/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java:1180368-1180596

Copied: webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java
(from r1551197, webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java?p2=webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java&p1=webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java&r1=1551197&r2=1551266&rev=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java
(original)
+++ webservices/axiom/trunk/modules/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMResult.java
Mon Dec 16 17:08:03 2013
@@ -22,18 +22,15 @@ package org.apache.axiom.om.impl.jaxp;
 import javax.xml.transform.sax.SAXResult;
 
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.impl.builder.SAXOMBuilder;
 
 /**
- * Implementation of {@link javax.xml.transform.Result} for AXIOM.
- * The implementation is based on {@link SAXResult} and transforms the stream
- * of SAX events to an AXIOM tree using {@link SAXOMBuilder}.
- * <p>
- * Note that building {@link org.apache.axiom.om.OMDocType} nodes from DTD information is
- * not supported.
+ * @deprecated In order to create a {@link SAXResult} that builds an Axiom tree, create an
+ *             {@link OMDocument} instance and call {@link OMContainer#getSAXResult()} on
it.
  */
 public class OMResult extends SAXResult {
     private final SAXOMBuilder builder;

Copied: webservices/axiom/trunk/modules/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
(from r1551197, webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java?p2=webservices/axiom/trunk/modules/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java&p1=webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java&r1=1551197&r2=1551266&rev=1551266&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java
(original)
+++ webservices/axiom/trunk/modules/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
Mon Dec 16 17:08:03 2013
@@ -21,47 +21,47 @@ package org.apache.axiom.om.impl.jaxp;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
-import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamSource;
 
 import junit.framework.TestSuite;
 
-import org.apache.axiom.om.AbstractTestCase;
+import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.testutils.XMLAssertEx;
 import org.apache.axiom.testutils.conformance.ConformanceTestFile;
+import org.apache.axiom.testutils.suite.MatrixTestCase;
+import org.apache.xalan.processor.TransformerFactoryImpl;
 
-public class StreamSourceToOMResultTestCase extends AbstractTestCase {
+public class StreamSourceToOMResultTest extends MatrixTestCase {
+    private static final String[] axiomImplementations = { "default", "dom" };
+    
     private final OMMetaFactory omMetaFactory;
-    private final TransformerFactory transformerFactory;
     private final ConformanceTestFile file;
     
-    private StreamSourceToOMResultTestCase(OMMetaFactory omMetaFactory,
-            TransformerFactory transformerFactory, String name, ConformanceTestFile file)
{
-        super(name);
-        this.omMetaFactory = omMetaFactory;
-        this.transformerFactory = transformerFactory;
+    private StreamSourceToOMResultTest(String axiomImplementation, ConformanceTestFile file)
{
+        omMetaFactory = OMAbstractFactory.getMetaFactory(axiomImplementation);
         this.file = file;
+        addTestParameter("axiomImplementation", axiomImplementation);
+        addTestParameter("file", file.getShortName());
     }
     
     protected void runTest() throws Throwable {
         StreamSource source = new StreamSource(file.getUrl().toString());
         OMResult result = new OMResult(omMetaFactory.getOMFactory());
-        transformerFactory.newTransformer().transform(source, result);
+        new TransformerFactoryImpl().newTransformer().transform(source, result);
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         result.getDocument().serialize(out);
         XMLAssertEx.assertXMLIdentical(file.getUrl(),
                 new ByteArrayInputStream(out.toByteArray()), true);
     }
 
-    public static TestSuite suite(OMMetaFactory omMetaFactory,
-            TransformerFactory transformerFactory) throws Exception {
+    public static TestSuite suite() {
         TestSuite suite = new TestSuite();
         ConformanceTestFile[] files = ConformanceTestFile.getConformanceTestFiles();
-        for (int i=0; i<files.length; i++) {
-            ConformanceTestFile file = files[i];
-            suite.addTest(new StreamSourceToOMResultTestCase(omMetaFactory, transformerFactory,
-                    file.getShortName(), file));
+        for (int i=0; i<axiomImplementations.length; i++) {
+            for (int j=0; j<files.length; j++) {
+                suite.addTest(new StreamSourceToOMResultTest(axiomImplementations[i], files[j]));
+            }
         }
         return suite;
     }



Mime
View raw message