Author: veithen
Date: Tue Sep 1 21:27:59 2015
New Revision: 1700674
URL: http://svn.apache.org/r1700674
Log:
Some cleanup of the Axiom test suite.
Added:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerExtractor.java
- copied, changed from r1700360,
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementExtractor.java
- copied, changed from r1700360,
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementFactory.java
Removed:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementFactory.java
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java
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=1700674&r1=1700673&r2=1700674&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
Tue Sep 1 21:27:59 2015
@@ -34,8 +34,7 @@ import org.apache.axiom.ts.dimension.Ele
import org.apache.axiom.ts.dimension.ExpansionStrategy;
import org.apache.axiom.ts.dimension.NoNamespaceStrategy;
import org.apache.axiom.ts.dimension.serialization.SerializationStrategy;
-import org.apache.axiom.ts.om.container.OMContainerFactory;
-import org.apache.axiom.ts.om.container.OMElementFactory;
+import org.apache.axiom.ts.om.container.OMContainerExtractor;
import org.apache.axiom.ts.om.factory.CreateOMElementParentSupplier;
import org.apache.axiom.ts.om.factory.CreateOMElementVariant;
import org.apache.axiom.ts.om.sourcedelement.OMSourcedElementVariant;
@@ -46,11 +45,6 @@ import org.apache.axiom.ts.xml.StreamTyp
import org.apache.axiom.ts.xml.XMLSample;
public class OMTestSuiteBuilder extends MatrixTestSuiteBuilder {
- private static final OMContainerFactory[] containerFactories = {
- OMContainerFactory.DOCUMENT,
- new OMElementFactory(false),
- new OMElementFactory(true) };
-
private static final QName[] qnames = {
new QName("root"),
new QName("urn:test", "root", "p"),
@@ -138,18 +132,17 @@ public class OMTestSuiteBuilder extends
addTest(new
org.apache.axiom.ts.om.builder.TestRootPartStreaming(metaFactory));
addTest(new
org.apache.axiom.ts.om.builder.TestStandaloneConfiguration(metaFactory));
for (XMLSample file : getInstances(XMLSample.class)) {
- for (int j=0; j<containerFactories.length; j++) {
- OMContainerFactory cf = containerFactories[j];
+ for (OMContainerExtractor ce :
getInstances(OMContainerExtractor.class)) {
for (BuilderFactory bf : getInstances(BuilderFactory.class)) {
- addTest(new
org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, bf,
cf, true));
- addTest(new
org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, bf,
cf, false));
+ addTest(new
org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, bf,
ce, true));
+ addTest(new
org.apache.axiom.ts.om.container.TestGetXMLStreamReader(metaFactory, file, bf,
ce, false));
}
// On a document containing entity references, serialization
tests will only work correctly if
// the entire document is serialized (so that the DTD is
available)
- if (!file.hasEntityReferences() || cf ==
OMContainerFactory.DOCUMENT) {
+ if (!file.hasEntityReferences() || ce ==
OMContainerExtractor.DOCUMENT) {
for (SerializationStrategy ss :
getInstances(SerializationStrategy.class)) {
if (ss.supportsInternalSubset() ||
!file.hasInternalSubset()) {
- addTest(new
org.apache.axiom.ts.om.container.TestSerialize(metaFactory, file,
containerFactories[j], ss));
+ addTest(new
org.apache.axiom.ts.om.container.TestSerialize(metaFactory, file, ce, ss));
}
}
}
Copied:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerExtractor.java
(from r1700360,
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java)
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerExtractor.java?p2=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerExtractor.java&p1=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java&r1=1700360&r2=1700674&rev=1700674&view=diff
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerFactory.java
(original)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMContainerExtractor.java
Tue Sep 1 21:27:59 2015
@@ -24,6 +24,7 @@ import javax.xml.stream.XMLStreamReader;
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.suite.Dimension;
import org.apache.axiom.testutils.suite.MatrixTestCase;
import org.xml.sax.InputSource;
@@ -31,8 +32,8 @@ import org.xml.sax.InputSource;
/**
* Extracts an {@link OMContainer} instance from a test file.
*/
-public interface OMContainerFactory extends Dimension {
- OMContainerFactory DOCUMENT = new OMContainerFactory() {
+public abstract class OMContainerExtractor extends Multiton implements
Dimension {
+ public static final OMContainerExtractor DOCUMENT = new
OMContainerExtractor() {
public void addTestParameters(MatrixTestCase testCase) {
testCase.addTestParameter("container", "document");
}
@@ -50,6 +51,11 @@ public interface OMContainerFactory exte
}
};
+ public static final OMElementExtractor ELEMENT = new
OMElementExtractor(false);
+ public static final OMElementExtractor ELEMENT_DETACHED = new
OMElementExtractor(false);
+
+ OMContainerExtractor() {}
+
/**
* Prepare a control document that has the same content as the container
returned by
* {@link #getContainer(OMXMLParserWrapper)}.
@@ -59,7 +65,7 @@ public interface OMContainerFactory exte
* @return the {@link InputSource} for the control document
* @throws Exception
*/
- InputSource getControl(InputStream testFileContent) throws Exception;
+ public abstract InputSource getControl(InputStream testFileContent) throws
Exception;
/**
* Extract the {@link OMContainer} from the given test file.
@@ -67,7 +73,7 @@ public interface OMContainerFactory exte
* @param builder the builder for the test file
* @return the container
*/
- OMContainer getContainer(OMXMLParserWrapper builder);
+ public abstract OMContainer getContainer(OMXMLParserWrapper builder);
/**
* Filter the given stream so that its content matches the content of the
container returned by
@@ -77,5 +83,5 @@ public interface OMContainerFactory exte
* the original stream reader representing the content of the
test file
* @return the filtered stream reader
*/
- XMLStreamReader filter(XMLStreamReader reader);
+ public abstract XMLStreamReader filter(XMLStreamReader reader);
}
Copied:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementExtractor.java
(from r1700360,
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementFactory.java)
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementExtractor.java?p2=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementExtractor.java&p1=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementFactory.java&r1=1700360&r2=1700674&rev=1700674&view=diff
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementFactory.java
(original)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/OMElementExtractor.java
Tue Sep 1 21:27:59 2015
@@ -34,10 +34,10 @@ import org.apache.xalan.processor.Transf
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-public class OMElementFactory implements OMContainerFactory {
+final class OMElementExtractor extends OMContainerExtractor {
private final boolean detached;
- public OMElementFactory(boolean detached) {
+ OMElementExtractor(boolean detached) {
this.detached = detached;
}
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java?rev=1700674&r1=1700673&r2=1700674&view=diff
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
(original)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
Tue Sep 1 21:27:59 2015
@@ -38,17 +38,17 @@ import org.xml.sax.InputSource;
*/
public class TestGetXMLStreamReader extends ConformanceTestCase {
private final BuilderFactory builderFactory;
- private final OMContainerFactory containerFactory;
+ private final OMContainerExtractor containerExtractor;
private final boolean cache;
public TestGetXMLStreamReader(OMMetaFactory metaFactory, XMLSample file,
- BuilderFactory builderFactory, OMContainerFactory
containerFactory, boolean cache) {
+ BuilderFactory builderFactory, OMContainerExtractor
containerExtractor, boolean cache) {
super(metaFactory, file);
this.builderFactory = builderFactory;
- this.containerFactory = containerFactory;
+ this.containerExtractor = containerExtractor;
this.cache = cache;
builderFactory.addTestParameters(this);
- containerFactory.addTestParameters(this);
+ containerExtractor.addTestParameters(this);
addTestParameter("cache", cache);
}
@@ -59,8 +59,8 @@ public class TestGetXMLStreamReader exte
try {
OMXMLParserWrapper builder =
builderFactory.getBuilder(metaFactory, new
InputSource(file.getUrl().toString()));
try {
- XMLStreamReader actual =
containerFactory.getContainer(builder).getXMLStreamReader(cache);
- XMLStreamReaderComparator comparator = new
XMLStreamReaderComparator(containerFactory.filter(expected),
containerFactory.filter(actual));
+ XMLStreamReader actual =
containerExtractor.getContainer(builder).getXMLStreamReader(cache);
+ XMLStreamReaderComparator comparator = new
XMLStreamReaderComparator(containerExtractor.filter(expected),
containerExtractor.filter(actual));
builderFactory.configureXMLStreamReaderComparator(comparator);
comparator.compare();
} finally {
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java?rev=1700674&r1=1700673&r2=1700674&view=diff
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java
(original)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java
Tue Sep 1 21:27:59 2015
@@ -37,15 +37,15 @@ import org.apache.commons.io.IOUtils;
import org.xml.sax.InputSource;
public class TestSerialize extends ConformanceTestCase {
- private final OMContainerFactory containerFactory;
+ private final OMContainerExtractor containerExtractor;
private final SerializationStrategy serializationStrategy;
public TestSerialize(OMMetaFactory metaFactory, XMLSample file,
- OMContainerFactory containerFactory, SerializationStrategy
serializationStrategy) {
+ OMContainerExtractor containerExtractor, SerializationStrategy
serializationStrategy) {
super(metaFactory, file);
- this.containerFactory = containerFactory;
+ this.containerExtractor = containerExtractor;
this.serializationStrategy = serializationStrategy;
- containerFactory.addTestParameters(this);
+ containerExtractor.addTestParameters(this);
serializationStrategy.addTestParameters(this);
}
@@ -53,10 +53,10 @@ public class TestSerialize extends Confo
OMXMLParserWrapper builder =
metaFactory.createOMBuilder(metaFactory.getOMFactory(),
TEST_PARSER_CONFIGURATION, new
InputSource(file.getUrl().toString()));
try {
- OMContainer container = containerFactory.getContainer(builder);
+ OMContainer container = containerExtractor.getContainer(builder);
// We need to clone the InputSource objects so that we can dump
their contents
// if the test fails
- InputSource control[] =
duplicateInputSource(containerFactory.getControl(file.getInputStream()));
+ InputSource control[] =
duplicateInputSource(containerExtractor.getControl(file.getInputStream()));
XML actual = serializationStrategy.serialize(container);
try {
// Configure the InputSources such that external entities can
be resolved