You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/09/01 21:34:55 UTC
svn commit: r1164224 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-testsuite/ axiom-testsuite/src/main/java/org/apache/axiom/ts/
axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/
axiom-testsuite/src/main/java/org/apache/axiom...
Author: veithen
Date: Thu Sep 1 19:34:55 2011
New Revision: 1164224
URL: http://svn.apache.org/viewvc?rev=1164224&view=rev
Log:
Made the TestSuiteBuilder stuff reusable.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/
webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestCaseEx.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestSuiteBuilder.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/package.html
Modified:
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/AxiomTestCase.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeAndConsumeWithIncompleteDescendant.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestAddAttributeFromOMAttributeMultiple.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/node/TestInsertSiblingAfterLastChild.java
webservices/commons/trunk/modules/axiom/modules/axiom-testutils/pom.xml
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=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/pom.xml Thu Sep 1 19:34:55 2011
@@ -59,12 +59,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <!-- We use this only for LDAP like filters -->
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
- </dependency>
- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>axiom-api</artifactId>
<classifier>tests</classifier>
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java Thu Sep 1 19:34:55 2011
@@ -18,33 +18,20 @@
*/
package org.apache.axiom.ts;
-import java.util.Dictionary;
-import java.util.Hashtable;
import java.util.Iterator;
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.testutils.suite.TestCaseEx;
import org.apache.commons.io.output.NullOutputStream;
-import org.custommonkey.xmlunit.XMLTestCase;
-public abstract class AxiomTestCase extends XMLTestCase {
+public abstract class AxiomTestCase extends TestCaseEx {
protected final OMMetaFactory metaFactory;
- private final Dictionary/*<String,String>*/ properties = new Hashtable();
public AxiomTestCase(OMMetaFactory metaFactory) {
this.metaFactory = metaFactory;
- setName(getClass().getName());
}
- public void addTestProperty(String name, String value) {
- setName(getName() + " [" + name + "=" + value + "]");
- properties.put(name, value);
- }
-
- public Dictionary getTestProperties() {
- return properties;
- }
-
protected void assertConsumed(OMContainer container) {
assertFalse("Expected the node to be incomplete", container.isComplete());
boolean isConsumed;
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java Thu Sep 1 19:34:55 2011
@@ -22,6 +22,7 @@ import java.lang.reflect.Method;
import org.apache.axiom.om.AbstractTestCase;
import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.testutils.suite.TestSuiteBuilder;
import org.apache.axiom.ts.om.container.OMContainerFactory;
import org.apache.axiom.ts.om.container.OMElementFactory;
import org.apache.axiom.ts.om.container.SerializationMethod;
@@ -30,7 +31,7 @@ import org.apache.axiom.ts.om.factory.OM
import org.apache.axiom.ts.xpath.AXIOMXPathTestCase;
import org.apache.axiom.ts.xpath.TestAXIOMXPath;
-public class OMTestSuiteBuilder extends AxiomTestSuiteBuilder {
+public class OMTestSuiteBuilder extends TestSuiteBuilder {
private static final OMContainerFactory[] containerFactories = {
OMContainerFactory.DOCUMENT,
new OMElementFactory(false),
@@ -40,8 +41,10 @@ public class OMTestSuiteBuilder extends
new SerializeToOutputStream(true),
new SerializeToOutputStream(false) };
+ private final OMMetaFactory metaFactory;
+
public OMTestSuiteBuilder(OMMetaFactory metaFactory) {
- super(metaFactory);
+ this.metaFactory = metaFactory;
}
protected void addTests() {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java Thu Sep 1 19:34:55 2011
@@ -19,14 +19,17 @@
package org.apache.axiom.ts;
import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.testutils.suite.TestSuiteBuilder;
import org.apache.axiom.ts.soap.SOAPSpec;
-public class SOAPTestSuiteBuilder extends AxiomTestSuiteBuilder {
+public class SOAPTestSuiteBuilder extends TestSuiteBuilder {
private static final String[] badSOAPFiles = { "wrongSoapNs.xml", "twoheaders.xml", "twoBodymessage.xml",
"envelopeMissing.xml", "haederBodyWrongOrder.xml" };
+ private final OMMetaFactory metaFactory;
+
public SOAPTestSuiteBuilder(OMMetaFactory metaFactory) {
- super(metaFactory);
+ this.metaFactory = metaFactory;
}
private void addTests(SOAPSpec spec) {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromDOMSource.java Thu Sep 1 19:34:55 2011
@@ -31,6 +31,8 @@ import org.apache.axiom.om.OMMetaFactory
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.ts.ConformanceTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
public class TestCreateOMBuilderFromDOMSource extends ConformanceTestCase {
public TestCreateOMBuilderFromDOMSource(OMMetaFactory metaFactory, String file) {
@@ -47,7 +49,7 @@ public class TestCreateOMBuilderFromDOMS
OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(), source);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
builder.getDocument().serialize(baos);
- assertXMLIdentical(compareXML(
+ XMLAssert.assertXMLIdentical(XMLUnit.compareXML(
AbstractTestCase.toDocumentWithoutDTD(getFileAsStream()),
AbstractTestCase.toDocumentWithoutDTD(new ByteArrayInputStream(baos.toByteArray()))), true);
} finally {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestCreateOMBuilderFromSAXSource.java Thu Sep 1 19:34:55 2011
@@ -31,6 +31,8 @@ import org.apache.axiom.om.OMMetaFactory
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.ts.ConformanceTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
import org.xml.sax.InputSource;
public class TestCreateOMBuilderFromSAXSource extends ConformanceTestCase {
@@ -49,7 +51,7 @@ public class TestCreateOMBuilderFromSAXS
OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(), source);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
builder.getDocument().serialize(baos);
- assertXMLIdentical(compareXML(
+ XMLAssert.assertXMLIdentical(XMLUnit.compareXML(
AbstractTestCase.toDocumentWithoutDTD(getFileAsStream()),
AbstractTestCase.toDocumentWithoutDTD(new ByteArrayInputStream(baos.toByteArray()))), true);
} finally {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetSAXSource.java Thu Sep 1 19:34:55 2011
@@ -42,6 +42,8 @@ import org.apache.axiom.ts.ConformanceTe
import org.apache.axiom.util.stax.dialect.StAXDialect;
import org.apache.axiom.util.stax.dialect.StAXDialectDetector;
import org.apache.xalan.processor.TransformerFactoryImpl;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
public class TestGetSAXSource extends ConformanceTestCase {
private final OMContainerFactory containerFactory;
@@ -67,7 +69,7 @@ public class TestGetSAXSource extends Co
} finally {
in.close();
}
- assertXMLIdentical(compareXML(
+ XMLAssert.assertXMLIdentical(XMLUnit.compareXML(
AbstractTestCase.toDocumentWithoutDTD(getFileAsStream()),
AbstractTestCase.toDocumentWithoutDTD(new ByteArrayInputStream(out.toByteArray()))), true);
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestSerialize.java Thu Sep 1 19:34:55 2011
@@ -32,6 +32,8 @@ import org.apache.axiom.om.OMXMLParserWr
import org.apache.axiom.om.util.StAXParserConfiguration;
import org.apache.axiom.ts.ConformanceTestCase;
import org.apache.commons.io.IOUtils;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
import org.xml.sax.InputSource;
public class TestSerialize extends ConformanceTestCase {
@@ -59,7 +61,7 @@ public class TestSerialize extends Confo
InputSource control[] = duplicateInputSource(containerFactory.getControl(getFileAsStream()));
InputSource actual[] = duplicateInputSource(serializationMethod.serialize(container));
try {
- assertXMLIdentical(compareXML(control[0], actual[0]), true);
+ XMLAssert.assertXMLIdentical(XMLUnit.compareXML(control[0], actual[0]), true);
} catch (AssertionFailedError ex) {
System.out.println("Control:");
dumpInputSource(control[1]);
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeAndConsumeWithIncompleteDescendant.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeAndConsumeWithIncompleteDescendant.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeAndConsumeWithIncompleteDescendant.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeAndConsumeWithIncompleteDescendant.java Thu Sep 1 19:34:55 2011
@@ -27,6 +27,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.ts.AxiomTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
/**
* Tests that {@link OMDocument#serializeAndConsume(java.io.Writer)} consumes incomplete descendants,
@@ -49,7 +50,7 @@ public class TestSerializeAndConsumeWith
root.addChild(incompleteElement);
StringWriter out = new StringWriter();
document.serializeAndConsume(out);
- assertXMLEqual("<root><elem>text</elem></root>", out.toString());
+ XMLAssert.assertXMLEqual("<root><elem>text</elem></root>", out.toString());
assertConsumed(incompleteElement);
}
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestAddAttributeFromOMAttributeMultiple.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestAddAttributeFromOMAttributeMultiple.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestAddAttributeFromOMAttributeMultiple.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestAddAttributeFromOMAttributeMultiple.java Thu Sep 1 19:34:55 2011
@@ -27,6 +27,8 @@ import org.apache.axiom.om.OMMetaFactory
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.ts.AxiomTestCase;
import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
/**
* Tests that when {@link OMElement#addAttribute(org.apache.axiom.om.OMAttribute)} is called
@@ -60,7 +62,7 @@ public class TestAddAttributeFromOMAttri
}
assertTrue(nsCount == 2);
- Diff diff = compareXML(expectedXML, omElement.toString());
- assertXMLEqual(diff, true);
+ Diff diff = XMLUnit.compareXML(expectedXML, omElement.toString());
+ XMLAssert.assertXMLEqual(diff, true);
}
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/node/TestInsertSiblingAfterLastChild.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/node/TestInsertSiblingAfterLastChild.java?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/node/TestInsertSiblingAfterLastChild.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/node/TestInsertSiblingAfterLastChild.java Thu Sep 1 19:34:55 2011
@@ -23,6 +23,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.ts.AxiomTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
/**
* Regression test for <a href="https://issues.apache.org/jira/browse/AXIOM-153">AXIOM-153</a>.
@@ -48,7 +49,7 @@ public class TestInsertSiblingAfterLastC
c1.insertSiblingAfter(c2);
// Now add c3 to parent using parent.addChild()
parent.addChild(c3);
- assertXMLEqual("<ns:parent xmlns:ns=\"http://www.testuri.com\">" +
+ XMLAssert.assertXMLEqual("<ns:parent xmlns:ns=\"http://www.testuri.com\">" +
"<ns:c1 /><ns:c2 /><ns:c3 /></ns:parent>", parent.toString());
}
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testutils/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testutils/pom.xml?rev=1164224&r1=1164223&r2=1164224&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testutils/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testutils/pom.xml Thu Sep 1 19:34:55 2011
@@ -56,5 +56,11 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+ <dependency>
+ <!-- We use this only for LDAP like filters -->
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
+ </dependency>
</dependencies>
</project>
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestCaseEx.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestCaseEx.java?rev=1164224&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestCaseEx.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestCaseEx.java Thu Sep 1 19:34:55 2011
@@ -0,0 +1,41 @@
+/*
+ * 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 java.util.Dictionary;
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+public abstract class TestCaseEx extends TestCase {
+ private final Dictionary/*<String,String>*/ properties = new Hashtable();
+
+ public TestCaseEx() {
+ setName(getClass().getName());
+ }
+
+ public final void addTestProperty(String name, String value) {
+ setName(getName() + " [" + name + "=" + value + "]");
+ properties.put(name, value);
+ }
+
+ public final Dictionary getTestProperties() {
+ return properties;
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestCaseEx.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestSuiteBuilder.java?rev=1164224&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestSuiteBuilder.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestSuiteBuilder.java Thu Sep 1 19:34:55 2011
@@ -0,0 +1,82 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestSuite;
+
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+
+public abstract class TestSuiteBuilder {
+ private static class Exclude {
+ private final Class testClass;
+ private final Filter filter;
+
+ public Exclude(Class testClass, Filter filter) {
+ this.testClass = testClass;
+ this.filter = filter;
+ }
+
+ public boolean accept(TestCaseEx test) {
+ return (testClass == null || test.getClass().equals(testClass))
+ && (filter == null || filter.match(test.getTestProperties()));
+ }
+ }
+
+ private final List/*<Exclude>*/ excludes = new ArrayList();
+ private TestSuite suite;
+
+ public final void exclude(Class testClass, String filter) {
+ try {
+ excludes.add(new Exclude(testClass, filter == null ? null : FrameworkUtil.createFilter(filter)));
+ } catch (InvalidSyntaxException ex) {
+ throw new IllegalArgumentException("Invalid filter expression", ex);
+ }
+ }
+
+ public final void exclude(Class testClass) {
+ exclude(testClass, null);
+ }
+
+ public final void exclude(String filter) {
+ exclude(null, filter);
+ }
+
+ protected abstract void addTests();
+
+ public final TestSuite build() {
+ suite = new TestSuite();
+ addTests();
+ return suite;
+ }
+
+ protected final void addTest(TestCaseEx test) {
+ for (Iterator it = excludes.iterator(); it.hasNext(); ) {
+ if (((Exclude)it.next()).accept(test)) {
+ return;
+ }
+ }
+ suite.addTest(test);
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/TestSuiteBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/package.html
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/package.html?rev=1164224&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/package.html (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/suite/package.html Thu Sep 1 19:34:55 2011
@@ -0,0 +1,23 @@
+<!--
+ ~ 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.
+ -->
+<html>
+<body>
+Contains utility classes to build test suites.
+</body>
+</html>
\ No newline at end of file