Author: veithen
Date: Wed Apr 3 12:16:47 2013
New Revision: 1463954
URL: http://svn.apache.org/r1463954
Log:
Promoted some tests from axiom-integration to axiom-testsuite.
Added:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransform.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransformOnFragment.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/resources/org/apache/axiom/ts/om/element/test.xml
- copied unchanged from r1463835,
webservices/axiom/trunk/modules/axiom-integration/src/test/resources/org/apache/axiom/om/impl/jaxp/test.xml
webservices/axiom/trunk/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/XSLTImplementation.java
Removed:
webservices/axiom/trunk/modules/axiom-integration/src/test/java/org/apache/axiom/om/impl/jaxp/
webservices/axiom/trunk/modules/axiom-integration/src/test/resources/org/apache/axiom/om/impl/jaxp/
Modified:
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithIdentityStylesheet.java
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithStylesheet.java
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TransformerTestCase.java
webservices/axiom/trunk/modules/axiom-integration/pom.xml
webservices/axiom/trunk/modules/axiom-testsuite/pom.xml
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
webservices/axiom/trunk/modules/axiom-testutils/pom.xml
Modified:
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
---
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
(original)
+++
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
Wed Apr 3 12:16:47 2013
@@ -24,6 +24,7 @@ import javax.xml.parsers.DocumentBuilder
import org.apache.axiom.testutils.conformance.ConformanceTestFile;
import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
+import org.apache.axiom.testutils.suite.XSLTImplementation;
public class DOMTestSuiteBuilder extends MatrixTestSuiteBuilder {
private static final QName[] validAttrQNames = new QName[] {
@@ -88,10 +89,11 @@ public class DOMTestSuiteBuilder extends
addTest(new
org.apache.axiom.ts.dom.document.TestLookupNamespaceURI(dbf));
addTest(new
org.apache.axiom.ts.dom.document.TestLookupNamespaceURIWithEmptyDocument(dbf));
addTest(new
org.apache.axiom.ts.dom.document.TestNormalizeDocumentNamespace(dbf));
- addTest(new
org.apache.axiom.ts.dom.document.TestTransformerWithIdentityStylesheet(dbf,
org.apache.xalan.processor.TransformerFactoryImpl.class));
- addTest(new
org.apache.axiom.ts.dom.document.TestTransformerWithIdentityStylesheet(dbf,
net.sf.saxon.TransformerFactoryImpl.class));
- addTest(new
org.apache.axiom.ts.dom.document.TestTransformerWithStylesheet(dbf,
org.apache.xalan.processor.TransformerFactoryImpl.class));
- addTest(new
org.apache.axiom.ts.dom.document.TestTransformerWithStylesheet(dbf,
net.sf.saxon.TransformerFactoryImpl.class));
+ for (int i=0; i<XSLTImplementation.INSTANCES.length; i++) {
+ XSLTImplementation xsltImplementation =
XSLTImplementation.INSTANCES[i];
+ addTest(new
org.apache.axiom.ts.dom.document.TestTransformerWithIdentityStylesheet(dbf,
xsltImplementation));
+ addTest(new
org.apache.axiom.ts.dom.document.TestTransformerWithStylesheet(dbf,
xsltImplementation));
+ }
addTest(new org.apache.axiom.ts.dom.document.TestValidator(dbf));
addTest(new
org.apache.axiom.ts.dom.documentfragment.TestCloneNode(dbf));
addTest(new
org.apache.axiom.ts.dom.documentfragment.TestLookupNamespaceURI(dbf));
Modified:
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithIdentityStylesheet.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithIdentityStylesheet.java?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
---
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithIdentityStylesheet.java
(original)
+++
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithIdentityStylesheet.java
Wed Apr 3 12:16:47 2013
@@ -21,10 +21,10 @@ package org.apache.axiom.ts.dom.document
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
+import org.apache.axiom.testutils.suite.XSLTImplementation;
import org.custommonkey.xmlunit.XMLAssert;
import org.custommonkey.xmlunit.XMLUnit;
import org.w3c.dom.Document;
@@ -33,8 +33,8 @@ import org.w3c.dom.Element;
// This test failed with Saxon 8.9 because NodeImpl#compareDocumentPosition
// threw an UnsupportedOperationException instead of a DOMException.
public class TestTransformerWithIdentityStylesheet extends TransformerTestCase
{
- public TestTransformerWithIdentityStylesheet(DocumentBuilderFactory dbf,
Class transformerFactoryClass) {
- super(dbf, transformerFactoryClass);
+ public TestTransformerWithIdentityStylesheet(DocumentBuilderFactory dbf,
XSLTImplementation xsltImplementation) {
+ super(dbf, xsltImplementation);
}
protected void runTest() throws Throwable {
@@ -51,7 +51,7 @@ public class TestTransformerWithIdentity
Document stylesheet
=
builder.parse(TestTransformerWithIdentityStylesheet.class.getResourceAsStream("identity.xslt"));
Document output = builder.newDocument();
- Transformer transformer =
((TransformerFactory)transformerFactoryClass.newInstance()).newTransformer(new
DOMSource(stylesheet));
+ Transformer transformer =
xsltImplementation.newTransformerFactory().newTransformer(new
DOMSource(stylesheet));
transformer.transform(new DOMSource(document), new DOMResult(output));
XMLAssert.assertXMLIdentical(XMLUnit.compareXML(document, output),
true);
}
Modified:
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithStylesheet.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithStylesheet.java?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
---
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithStylesheet.java
(original)
+++
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestTransformerWithStylesheet.java
Wed Apr 3 12:16:47 2013
@@ -21,17 +21,17 @@ package org.apache.axiom.ts.dom.document
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
+import org.apache.axiom.testutils.suite.XSLTImplementation;
import org.custommonkey.xmlunit.XMLAssert;
import org.custommonkey.xmlunit.XMLUnit;
import org.w3c.dom.Document;
public class TestTransformerWithStylesheet extends TransformerTestCase {
- public TestTransformerWithStylesheet(DocumentBuilderFactory dbf, Class
transformerFactoryClass) {
- super(dbf, transformerFactoryClass);
+ public TestTransformerWithStylesheet(DocumentBuilderFactory dbf,
XSLTImplementation xsltImplementation) {
+ super(dbf, xsltImplementation);
}
protected void runTest() throws Throwable {
@@ -41,7 +41,7 @@ public class TestTransformerWithStyleshe
=
builder.parse(TestTransformerWithStylesheet.class.getResourceAsStream("stylesheet.xslt"));
Document expected =
builder.parse(TestTransformerWithStylesheet.class.getResourceAsStream("output.xml"));
Document actual = builder.newDocument();
- Transformer transformer =
((TransformerFactory)transformerFactoryClass.newInstance()).newTransformer(new
DOMSource(stylesheet));
+ Transformer transformer =
xsltImplementation.newTransformerFactory().newTransformer(new
DOMSource(stylesheet));
transformer.transform(new DOMSource(input), new DOMResult(actual));
boolean oldIgnoreWhitespace = XMLUnit.getIgnoreWhitespace();
XMLUnit.setIgnoreWhitespace(true);
Modified:
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TransformerTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TransformerTestCase.java?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
---
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TransformerTestCase.java
(original)
+++
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TransformerTestCase.java
Wed Apr 3 12:16:47 2013
@@ -20,14 +20,15 @@ package org.apache.axiom.ts.dom.document
import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.axiom.testutils.suite.XSLTImplementation;
import org.apache.axiom.ts.dom.DOMTestCase;
public abstract class TransformerTestCase extends DOMTestCase {
- protected final Class transformerFactoryClass;
+ protected final XSLTImplementation xsltImplementation;
- public TransformerTestCase(DocumentBuilderFactory dbf, Class
transformerFactoryClass) {
+ public TransformerTestCase(DocumentBuilderFactory dbf, XSLTImplementation
xsltImplementation) {
super(dbf);
- this.transformerFactoryClass = transformerFactoryClass;
- addTestParameter("transformerFactory",
transformerFactoryClass.getName());
+ this.xsltImplementation = xsltImplementation;
+ xsltImplementation.addTestParameters(this);
}
}
Modified: webservices/axiom/trunk/modules/axiom-integration/pom.xml
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-integration/pom.xml?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-integration/pom.xml (original)
+++ webservices/axiom/trunk/modules/axiom-integration/pom.xml Wed Apr 3
12:16:47 2013
@@ -79,18 +79,6 @@
<artifactId>xercesImpl</artifactId>
</dependency>
<dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- </dependency>
- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>axiom-api</artifactId>
<classifier>tests</classifier>
Modified: webservices/axiom/trunk/modules/axiom-testsuite/pom.xml
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/pom.xml?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/pom.xml (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/pom.xml Wed Apr 3 12:16:47
2013
@@ -69,6 +69,14 @@
<artifactId>xalan</artifactId>
</dependency>
<dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-dom</artifactId>
+ </dependency>
+ <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>axiom-jaxen-testsuite</artifactId>
<version>${project.version}</version>
Modified:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
---
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
(original)
+++
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
Wed Apr 3 12:16:47 2013
@@ -25,6 +25,7 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.testutils.conformance.ConformanceTestFile;
import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
+import org.apache.axiom.testutils.suite.XSLTImplementation;
import org.apache.axiom.ts.dimension.BuilderFactory;
import org.apache.axiom.ts.dimension.ElementContext;
import org.apache.axiom.ts.dimension.ExpansionStrategy;
@@ -258,6 +259,11 @@ public class OMTestSuiteBuilder extends
addTest(new
org.apache.axiom.ts.om.element.TestGetPrefixWithoutNamespace(metaFactory));
addTest(new
org.apache.axiom.ts.om.element.TestGetQNameWithNamespace(metaFactory));
addTest(new
org.apache.axiom.ts.om.element.TestGetQNameWithoutNamespace(metaFactory));
+ for (int i=0; i<XSLTImplementation.INSTANCES.length; i++) {
+ XSLTImplementation xsltImplementation =
XSLTImplementation.INSTANCES[i];
+ addTest(new
org.apache.axiom.ts.om.element.TestGetSAXSourceIdentityTransform(metaFactory,
xsltImplementation));
+ addTest(new
org.apache.axiom.ts.om.element.TestGetSAXSourceIdentityTransformOnFragment(metaFactory,
xsltImplementation));
+ }
addTest(new org.apache.axiom.ts.om.element.TestGetText(metaFactory));
addTest(new
org.apache.axiom.ts.om.element.TestGetTextAsQName(metaFactory));
addTest(new
org.apache.axiom.ts.om.element.TestGetTextAsQNameEmpty(metaFactory));
Added:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransform.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransform.java?rev=1463954&view=auto
==============================================================================
---
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransform.java
(added)
+++
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransform.java
Wed Apr 3 12:16:47 2013
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.element;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
+
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.impl.jaxp.OMResult;
+import org.apache.axiom.om.impl.jaxp.OMSource;
+import org.apache.axiom.testutils.suite.XSLTImplementation;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestGetSAXSourceIdentityTransform extends AxiomTestCase {
+ private final XSLTImplementation xsltImplementation;
+
+ public TestGetSAXSourceIdentityTransform(OMMetaFactory metaFactory,
XSLTImplementation xsltImplementation) {
+ super(metaFactory);
+ this.xsltImplementation = xsltImplementation;
+ xsltImplementation.addTestParameters(this);
+ }
+
+ private InputStream getInput() {
+ return
TestGetSAXSourceIdentityTransform.class.getResourceAsStream("test.xml");
+ }
+
+ protected void runTest() throws Throwable {
+ Transformer transformer =
xsltImplementation.newTransformerFactory().newTransformer();
+
+ OMFactory factory = metaFactory.getOMFactory();
+ OMElement element = OMXMLBuilderFactory.createOMBuilder(factory,
getInput()).getDocumentElement();
+ OMSource omSource = new OMSource(element);
+ OMResult omResult = new OMResult(factory);
+ transformer.transform(omSource, omResult);
+
+ StreamSource streamSource = new StreamSource(getInput());
+ StringWriter out = new StringWriter();
+ StreamResult streamResult = new StreamResult(out);
+ transformer.transform(streamSource, streamResult);
+
+ XMLAssert.assertXMLIdentical(XMLUnit.compareXML(out.toString(),
omResult.getRootElement().toString()), true);
+
+ element.close(false);
+ }
+}
Added:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransformOnFragment.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransformOnFragment.java?rev=1463954&view=auto
==============================================================================
---
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransformOnFragment.java
(added)
+++
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetSAXSourceIdentityTransformOnFragment.java
Wed Apr 3 12:16:47 2013
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.element;
+
+import java.io.InputStream;
+
+import javax.xml.transform.Transformer;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.impl.jaxp.OMResult;
+import org.apache.axiom.om.impl.jaxp.OMSource;
+import org.apache.axiom.testutils.suite.XSLTImplementation;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Test that all namespace mappings in scope of the source element are
available on the result.
+ * This checks for an issue that may arise under the following circumstances:
+ * <ol>
+ * <li>The source element, i.e. the element passed as argument to
+ * {@link OMSource#OMSource(OMElement)} is not the root element of the
document.</li>
+ * <li>One of the ancestors declares a namespace mapping.</li>
+ * <li>The namespace mapping is not used in the name of the source element
or any of its
+ * descendant elements or attributes (but may be used in the value of an
attribute).</li>
+ * </ol>
+ * Example:
+ * <pre><root xmlns:ns="urn:ns"><element
attr="ns:someThing"/><root></pre>
+ * In that case, when constructing an {@link OMSource} from the child element,
the namespace
+ * mapping for the <tt>ns</tt> prefix should be visible to the consumer.
Otherwise it would not
+ * be able to interpret the attribute value correctly. This is relevant e.g.
when validating
+ * a part of a document against an XML schema (see SYNAPSE-501).
+ */
+public class TestGetSAXSourceIdentityTransformOnFragment extends AxiomTestCase
{
+ private final XSLTImplementation xsltImplementation;
+
+ public TestGetSAXSourceIdentityTransformOnFragment(OMMetaFactory
metaFactory, XSLTImplementation xsltImplementation) {
+ super(metaFactory);
+ this.xsltImplementation = xsltImplementation;
+ xsltImplementation.addTestParameters(this);
+ }
+
+ private InputStream getInput() {
+ return
TestGetSAXSourceIdentityTransformOnFragment.class.getResourceAsStream("test.xml");
+ }
+
+ protected void runTest() throws Throwable {
+ Transformer transformer =
xsltImplementation.newTransformerFactory().newTransformer();
+
+ OMFactory factory = metaFactory.getOMFactory();
+ OMElement element = OMXMLBuilderFactory.createOMBuilder(factory,
getInput()).getDocumentElement().getFirstElement();
+ OMSource omSource = new OMSource(element);
+ OMResult omResult = new OMResult(factory);
+ transformer.transform(omSource, omResult);
+
+ OMNamespace ns = omResult.getRootElement().findNamespaceURI("p");
+ assertNotNull(ns);
+ assertEquals("urn:some:namespace", ns.getNamespaceURI());
+
+ element.close(false);
+ }
+}
Modified: webservices/axiom/trunk/modules/axiom-testutils/pom.xml
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testutils/pom.xml?rev=1463954&r1=1463953&r2=1463954&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testutils/pom.xml (original)
+++ webservices/axiom/trunk/modules/axiom-testutils/pom.xml Wed Apr 3 12:16:47
2013
@@ -75,6 +75,16 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <optional>true</optional>
+ </dependency>
</dependencies>
<build>
<resources>
Added:
webservices/axiom/trunk/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/XSLTImplementation.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/XSLTImplementation.java?rev=1463954&view=auto
==============================================================================
---
webservices/axiom/trunk/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/XSLTImplementation.java
(added)
+++
webservices/axiom/trunk/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/XSLTImplementation.java
Wed Apr 3 12:16:47 2013
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.testutils.suite;
+
+import javax.xml.transform.TransformerFactory;
+
+/**
+ * Specifies an XSLT implementation for use in a {@link MatrixTestCase}.
+ */
+public interface XSLTImplementation extends Dimension {
+ XSLTImplementation[] INSTANCES = new XSLTImplementation[] {
+ new XSLTImplementation() {
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("xslt", "xalan");
+ }
+
+ public TransformerFactory newTransformerFactory() {
+ return new org.apache.xalan.processor.TransformerFactoryImpl();
+ }
+ },
+ new XSLTImplementation() {
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("xslt", "saxon");
+ }
+
+ public TransformerFactory newTransformerFactory() {
+ return new net.sf.saxon.TransformerFactoryImpl();
+ }
+ },
+ };
+
+ TransformerFactory newTransformerFactory();
+}