Author: veithen
Date: Thu Dec 30 23:17:41 2010
New Revision: 1054019
URL: http://svn.apache.org/viewvc?rev=1054019&view=rev
Log:
AXIOM-311: Integrated the existing OMStAXWrapperConformanceTestCase into the
new unified test suite.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java
- copied, changed from r1053837,
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperConformanceTestCase.java
Removed:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperConformanceTestCase.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMStAXWrapperConformanceTest.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperConformanceTest.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/pom.xml
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java?rev=1054019&r1=1054018&r2=1054019&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/AbstractTestCase.java
Thu Dec 30 23:17:41 2010
@@ -82,7 +82,7 @@ public abstract class AbstractTestCase
return new URLDataSource(url);
}
- public InputStream getTestResource(String relativePath) {
+ public static InputStream getTestResource(String relativePath) {
InputStream in =
AbstractTestCase.class.getClassLoader().getResourceAsStream(relativePath);
if (in == null) {
fail("The test resource " + relativePath + " could not be found");
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/pom.xml
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/pom.xml?rev=1054019&r1=1054018&r2=1054019&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/pom.xml
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/pom.xml Thu
Dec 30 23:17:41 2010
@@ -60,5 +60,11 @@
<artifactId>axiom-testutils</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axiom-api</artifactId>
+ <classifier>tests</classifier>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java?rev=1054019&r1=1054018&r2=1054019&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
Thu Dec 30 23:17:41 2010
@@ -21,7 +21,9 @@ package org.apache.axiom.ts;
import java.util.HashSet;
import java.util.Set;
+import org.apache.axiom.om.AbstractTestCase;
import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.ts.om.document.TestGetXMLStreamReader;
import junit.framework.TestSuite;
@@ -44,6 +46,10 @@ public class AxiomTestSuiteBuilder {
addTest(new
org.apache.axiom.ts.om.builder.TestGetDocumentElement(metaFactory));
addTest(new
org.apache.axiom.ts.om.builder.TestGetDocumentElementWithDiscardDocument(metaFactory));
addTest(new
org.apache.axiom.ts.om.document.TestSerializeAndConsumeWithIncompleteDescendant(metaFactory));
+ String[] files = AbstractTestCase.getConformanceTestFiles();
+ for (int i=0; i<files.length; i++) {
+ suite.addTest(new TestGetXMLStreamReader(metaFactory, files[i]));
+ }
addTest(new
org.apache.axiom.ts.om.element.TestAddAttributeWithExistingNamespaceDeclarationInScope(metaFactory));
addTest(new
org.apache.axiom.ts.om.element.TestAddAttributeWithExistingNamespaceDeclarationOnSameElement(metaFactory));
addTest(new
org.apache.axiom.ts.om.element.TestAddAttributeWithMaskedNamespaceDeclaration(metaFactory));
Copied:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java
(from r1053837,
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperConformanceTestCase.java)
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperConformanceTestCase.java&r1=1053837&r2=1054019&rev=1054019&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperConformanceTestCase.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java
Thu Dec 30 23:17:41 2010
@@ -16,42 +16,41 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.axiom.om.impl;
+package org.apache.axiom.ts.om.document;
import java.io.InputStream;
import javax.xml.stream.XMLStreamReader;
-import junit.framework.TestSuite;
-
import org.apache.axiom.om.AbstractTestCase;
import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.impl.OMStAXWrapper;
+import org.apache.axiom.om.impl.RootWhitespaceFilter;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.testutils.stax.XMLStreamReaderComparator;
+import org.apache.axiom.ts.AxiomTestCase;
/**
* Test comparing the output of {...@link OMStAXWrapper} with that of a native
StAX parser.
- * {...@link #suite(OMMetaFactory)} can be used to build a complete test suite
from the
- * XML files returned by {...@link AbstractTestCase#getConformanceTestFiles()}.
*/
-public class OMStAXWrapperConformanceTestCase extends AbstractTestCase {
- private final OMMetaFactory omMetaFactory;
+public class TestGetXMLStreamReader extends AxiomTestCase {
private final String file;
- private OMStAXWrapperConformanceTestCase(OMMetaFactory omMetaFactory,
String name, String file) {
- super(name);
- this.omMetaFactory = omMetaFactory;
+ public TestGetXMLStreamReader(OMMetaFactory metaFactory, String file) {
+ super(metaFactory);
this.file = file;
+ int idx = file.lastIndexOf('/');
+ setName(getName() + " [file=" + file.substring(idx+1) + "]");
}
- public void runTest() throws Throwable {
- InputStream in1 = getTestResource(file);
- InputStream in2 = getTestResource(file);
+ protected void runTest() throws Throwable {
+ InputStream in1 = AbstractTestCase.getTestResource(file);
+ InputStream in2 = AbstractTestCase.getTestResource(file);
try {
XMLStreamReader expected = StAXUtils.createXMLStreamReader(in1);
try {
- StAXOMBuilder builder = new
StAXOMBuilder(omMetaFactory.getOMFactory(),
+ StAXOMBuilder builder = new
StAXOMBuilder(metaFactory.getOMFactory(),
StAXUtils.createXMLStreamReader(in2));
try {
XMLStreamReader actual =
builder.getDocument().getXMLStreamReader();
@@ -68,16 +67,4 @@ public class OMStAXWrapperConformanceTes
in2.close();
}
}
-
- public static TestSuite suite(OMMetaFactory omMetaFactory) throws
Exception {
- TestSuite suite = new TestSuite();
- String[] files = getConformanceTestFiles();
- for (int i=0; i<files.length; i++) {
- String file = files[i];
- int idx = file.lastIndexOf('/');
- String name = file.substring(idx+1);
- suite.addTest(new OMStAXWrapperConformanceTestCase(omMetaFactory,
name, file));
- }
- return suite;
- }
}