ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1797579 - in /webservices/axiom/trunk: components/core-streams/src/main/java/org/apache/axiom/core/stream/sax/ testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/ testing/jaxp-testsuite/src/main/java/org/apache/axiom/ts/jaxp/
Date Sun, 04 Jun 2017 13:41:14 GMT
Author: veithen
Date: Sun Jun  4 13:41:14 2017
New Revision: 1797579

URL: http://svn.apache.org/viewvc?rev=1797579&view=rev
Log:
Include the JRE's XSLT implementation in tests.

Modified:
    webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
    webservices/axiom/trunk/testing/jaxp-testsuite/src/main/java/org/apache/axiom/ts/jaxp/XSLTImplementation.java

Modified: webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java?rev=1797579&r1=1797578&r2=1797579&view=diff
==============================================================================
--- webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
(original)
+++ webservices/axiom/trunk/components/core-streams/src/main/java/org/apache/axiom/core/stream/sax/XmlHandlerContentHandler.java
Sun Jun  4 13:41:14 2017
@@ -193,6 +193,9 @@ public final class XmlHandlerContentHand
     }
 
     public void endDTD() throws SAXException {
+        if (internalSubset == null) {
+            throw new IllegalStateException("endDTD without startDTD");
+        }
         try {
             String internalSubset = this.internalSubset.toString();
             handler.processDocumentTypeDeclaration(dtdName, dtdPublicId, dtdSystemId,

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1797579&r1=1797578&r2=1797579&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
Sun Jun  4 13:41:14 2017
@@ -196,7 +196,8 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.document.TestGetOMDocumentElementAfterDetach(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestGetOMDocumentElementWithParser(metaFactory));
         for (XSLTImplementation xsltImplementation : getInstances(XSLTImplementation.class))
{
-            if (xsltImplementation.supportsLexicalHandlerWithStreamSource()) {
+            // TODO: the XSLT implementation in the JRE is badly broken when it comes to
serializing DTDs; refine this
+            if (!xsltImplementation.getName().equals("jre") && xsltImplementation.supportsLexicalHandlerWithStreamSource())
{
                 for (XMLSample file : getInstances(XMLSample.class)) {
                     addTest(new org.apache.axiom.ts.om.document.TestGetSAXResult(metaFactory,
xsltImplementation, file));
                 }

Modified: webservices/axiom/trunk/testing/jaxp-testsuite/src/main/java/org/apache/axiom/ts/jaxp/XSLTImplementation.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/jaxp-testsuite/src/main/java/org/apache/axiom/ts/jaxp/XSLTImplementation.java?rev=1797579&r1=1797578&r2=1797579&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/jaxp-testsuite/src/main/java/org/apache/axiom/ts/jaxp/XSLTImplementation.java
(original)
+++ webservices/axiom/trunk/testing/jaxp-testsuite/src/main/java/org/apache/axiom/ts/jaxp/XSLTImplementation.java
Sun Jun  4 13:41:14 2017
@@ -24,6 +24,7 @@ import javax.xml.transform.stream.Stream
 
 import net.sf.saxon.FeatureKeys;
 
+import org.apache.axiom.testing.multiton.Instances;
 import org.apache.axiom.testing.multiton.Multiton;
 import org.xml.sax.ext.LexicalHandler;
 
@@ -31,6 +32,10 @@ import org.xml.sax.ext.LexicalHandler;
  * Specifies an XSLT implementation for use in a {@link MatrixTestCase}.
  */
 public abstract class XSLTImplementation extends Multiton {
+    private static final String[] jreTransformerFactoryClassNames = {
+            "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
+    };
+    
     public static final XSLTImplementation XALAN = new XSLTImplementation("xalan", true)
{
         @Override
         public TransformerFactory newTransformerFactory() {
@@ -57,6 +62,29 @@ public abstract class XSLTImplementation
         this.supportsLexicalHandlerWithStreamSource = supportsLexicalHandlerWithStreamSource;
     }
 
+    @Instances
+    private static XSLTImplementation[] instances() {
+        for (String className : jreTransformerFactoryClassNames) {
+            try {
+                final Class<? extends TransformerFactory> clazz = Class.forName(className).asSubclass(TransformerFactory.class);
+                XSLTImplementation implementation = new XSLTImplementation("jre", true) {
+                    @Override
+                    public TransformerFactory newTransformerFactory() {
+                        try {
+                            return clazz.newInstance();
+                        } catch (InstantiationException | IllegalAccessException ex) {
+                            throw new RuntimeException(ex);
+                        }
+                    }
+                };
+                return new XSLTImplementation[] { implementation };
+            } catch (ClassNotFoundException ex) {
+                // Just continue
+            }
+        }
+        return new XSLTImplementation[0];
+    }
+
     public final String getName() {
         return name;
     }



Mime
View raw message