You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ve...@apache.org on 2009/01/12 22:39:18 UTC

svn commit: r733910 - in /webservices/axis2/trunk/java/modules/saaj: ./ test/org/apache/axis2/saaj/ test/org/apache/axis2/saaj/integration/

Author: veithen
Date: Mon Jan 12 13:39:04 2009
New Revision: 733910

URL: http://svn.apache.org/viewvc?rev=733910&view=rev
Log:
Use JUnit 4 features (custom test runners) to systematically validate test cases against Sun's SAAJ reference implementation. All test cases annotation with @Validated are run twice: once with Sun's SAAJ implementation (to validate the test case itself) and once with axis2-saaj (to validate our code). This should make it easier to write test cases that conform to the SAAJ specs. The mechanism implemented by SAAJTestRunner is completely transparent to Maven's Surefire plugin as well as Eclipse's JUnit launcher.

Added:
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java   (with props)
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/Validated.java   (with props)
Removed:
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestUtil.java
Modified:
    webservices/axis2/trunk/java/modules/saaj/pom.xml
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/TextTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java

Modified: webservices/axis2/trunk/java/modules/saaj/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/pom.xml?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/saaj/pom.xml Mon Jan 12 13:39:04 2009
@@ -76,7 +76,7 @@
         <dependency>
             <groupId>com.sun.xml.messaging.saaj</groupId>
             <artifactId>saaj-impl</artifactId>
-            <version>1.3</version>
+            <version>1.3.2</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
@@ -149,24 +149,6 @@
                     <skip>false</skip>
                     <forkMode>once</forkMode>
                     <argLine>-Djava.endorsed.dirs=${m2Repository}/org/apache/geronimo/specs/geronimo-saaj_1.3_spec/1.0.0/</argLine>
-                    <systemProperties>
-                        <property>
-                            <name>javax.xml.soap.MessageFactory</name>
-                            <value>org.apache.axis2.saaj.MessageFactoryImpl</value>
-                        </property>
-                        <property>
-                            <name>javax.xml.soap.SOAPFactory</name>
-                            <value>org.apache.axis2.saaj.SOAPFactoryImpl</value>
-                        </property>
-                        <property>
-                            <name>javax.xml.soap.SOAPConnectionFactory</name>
-                            <value>org.apache.axis2.saaj.SOAPConnectionFactoryImpl</value>
-                        </property>
-                        <property>
-                            <name>javax.xml.soap.MetaFactory</name>
-                            <value>org.apache.axis2.saaj.SAAJMetaFactoryImpl</value>
-                        </property>
-                    </systemProperties>
                 </configuration>
             </plugin>
         </plugins>

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.activation.DataHandler;
 import javax.activation.FileDataSource;
@@ -32,6 +32,10 @@
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -40,17 +44,15 @@
 import java.io.OutputStream;
 import java.util.Iterator;
 
-public class AttachmentSerializationTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class AttachmentSerializationTest extends Assert {
 
     public static final String MIME_MULTIPART_RELATED = "multipart/related";
     public static final String MIME_APPLICATION_DIME = "application/dime";
     public static final String NS_PREFIX = "jaxmtst";
     public static final String NS_URI = "http://www.jcommerce.net/soap/jaxm/TestJaxm";
 
-    public AttachmentSerializationTest(String name) {
-        super(name);
-    }
-
+    @Validated @Test
     public void testAttachments() throws Exception {
         try {
             ByteArrayOutputStream bais = new ByteArrayOutputStream();
@@ -98,6 +100,8 @@
         ap2.setContentType("image/jpg");
         msg.addAttachmentPart(ap2);
 
+        msg.saveChanges(); // This is only required with Sun's SAAJ implementation
+
         MimeHeaders headers = msg.getMimeHeaders();
         assertTrue(headers != null);
         String [] contentType = headers.getHeader("Content-Type");

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 import org.apache.axiom.attachments.utils.IOUtils;
 import org.apache.axiom.om.util.Base64;
 import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
@@ -28,6 +28,8 @@
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
@@ -48,13 +50,9 @@
 import java.net.URL;
 import java.util.Iterator;
 
-public class AttachmentTest extends TestCase {
-
-    public AttachmentTest(String name) {
-        super(name);
-    }
-
-
+@RunWith(SAAJTestRunner.class)
+public class AttachmentTest extends Assert {
+    @Validated @Test
     public void testStringAttachment() throws Exception {
 
         MessageFactory factory = MessageFactory.newInstance();
@@ -80,7 +78,7 @@
         assertTrue(message.countAttachments() == 0);
     }
 
-
+    @Validated @Test
     public void testMultipleAttachments() throws Exception {
 
         MessageFactory factory = MessageFactory.newInstance();
@@ -113,7 +111,7 @@
         assertTrue(nAttachments == 2);
     }
 
-
+    @Validated @Test
     public void testMultipleAttachments2() throws Exception {
         MessageFactory factory = MessageFactory.newInstance();
         SOAPMessage msg = factory.createMessage();
@@ -145,6 +143,9 @@
         assertTrue(nAttachments == 2);
     }
 
+    // Note: This test case fails with Sun's SAAJ implementation
+    //       and can't be @Validated.
+    @Test
     public void testBadAttSize() throws Exception {
         MessageFactory factory = MessageFactory.newInstance();
         SOAPMessage message = factory.createMessage();
@@ -182,7 +183,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testClearContent() throws Exception {
         try {
             InputStream in1 = new FileInputStream(new File(System.getProperty("basedir", ".") +
@@ -260,7 +261,7 @@
 
     }
 
-
+    @Validated @Test
     public void testGetContent() throws Exception {
         try {
             MessageFactory factory = MessageFactory.newInstance();
@@ -284,6 +285,7 @@
         }
     }
 
+    @Validated @Test
     public void testGetRawContents() {
         try {
             MessageFactory factory = MessageFactory.newInstance();
@@ -302,7 +304,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testSetBase64Content() {
         try {
             MessageFactory factory = MessageFactory.newInstance();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,11 @@
 
 package org.apache.axis2.saaj;
 
-import org.custommonkey.xmlunit.XMLTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
@@ -36,13 +40,16 @@
 /**
  * 
  */
-public class MessageFactoryTest extends XMLTestCase {
+@RunWith(SAAJTestRunner.class)
+public class MessageFactoryTest extends XMLAssert {
     private MessageFactory mf = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         mf = MessageFactory.newInstance();
     }
 
+    @Validated @Test
     public void testCreateMessage() {
         try {
             ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
@@ -71,6 +78,7 @@
         }
     }
 
+    @Validated @Test
     public void testCreateMessage2() {
         try {
             ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
@@ -116,7 +124,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testNewInstane() {
         try {
             MessageFactory mf = MessageFactory.newInstance();
@@ -134,59 +142,50 @@
         }
     }
 
-    // Unit tests for (unresolved) issue AXIS2-4189
-/*    
+    @Validated @Test @Ignore("AXIS2-4189")
     public void testParseMTOMMessage() throws Exception {
-        SAAJTestUtil.execute(new SAAJTestUtil.Test() {
-            public void execute(MessageFactory mf) throws Exception {
-                MimeHeaders headers = new MimeHeaders();
-                headers.addHeader("Content-Type",
-                        "multipart/related; " +
-                        "boundary=\"MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412748909307\"; " +
-                        "type=\"application/xop+xml\"; " +
-                        "start=\"<0....@apache.org>\"; " +
-                        "start-info=\"text/xml\"; " +
-                        "charset=UTF-8;" +
-                        "action=\"mtomSample\"");
-                InputStream in = new FileInputStream(System.getProperty("basedir", ".")
-                        + "/test-resources/message.bin");
-                SOAPMessage message = mf.createMessage(headers, in);
-                SOAPPart soapPart = message.getSOAPPart();
-                assertEquals("<0....@apache.org>",
-                        soapPart.getContentId());
-                Iterator attachments = message.getAttachments();
-                assertTrue(attachments.hasNext());
-                AttachmentPart ap = (AttachmentPart)attachments.next();
-                assertEquals("<1....@apache.org>",
-                        ap.getContentId());
-                assertFalse(attachments.hasNext());
-            }
-        });
+        MimeHeaders headers = new MimeHeaders();
+        headers.addHeader("Content-Type",
+                "multipart/related; " +
+                "boundary=\"MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412748909307\"; " +
+                "type=\"application/xop+xml\"; " +
+                "start=\"<0....@apache.org>\"; " +
+                "start-info=\"text/xml\"; " +
+                "charset=UTF-8;" +
+                "action=\"mtomSample\"");
+        InputStream in = new FileInputStream(System.getProperty("basedir", ".")
+                + "/test-resources/message.bin");
+        SOAPMessage message = mf.createMessage(headers, in);
+        SOAPPart soapPart = message.getSOAPPart();
+        assertEquals("<0....@apache.org>",
+                soapPart.getContentId());
+        Iterator attachments = message.getAttachments();
+        assertTrue(attachments.hasNext());
+        AttachmentPart ap = (AttachmentPart)attachments.next();
+        assertEquals("<1....@apache.org>",
+                ap.getContentId());
+        assertFalse(attachments.hasNext());
     }
 
+    @Validated @Test @Ignore("AXIS2-4189")
     public void testParseSwAMessage() throws Exception {
-        SAAJTestUtil.execute(new SAAJTestUtil.Test() {
-            public void execute(MessageFactory mf) throws Exception {
-                MimeHeaders headers = new MimeHeaders();
-                headers.addHeader("Content-Type",
-                        "multipart/related; " +
-                        "boundary=MIMEBoundaryurn_uuid_E3F7CE4554928DA89B1231365678616; " +
-                        "type=\"text/xml\"; " +
-                        "start=\"<0....@apache.org>\"");
-                InputStream in = new FileInputStream(System.getProperty("basedir", ".")
-                        + "/test-resources/SwAmessage.bin");
-                SOAPMessage message = mf.createMessage(headers, in);
-                SOAPPart soapPart = message.getSOAPPart();
-                assertEquals("<0....@apache.org>",
-                        soapPart.getContentId());
-                Iterator attachments = message.getAttachments();
-                assertTrue(attachments.hasNext());
-                AttachmentPart ap = (AttachmentPart)attachments.next();
-                assertEquals("<urn:uuid:E3F7CE4554928DA89B1231365678347>",
-                        ap.getContentId());
-                assertFalse(attachments.hasNext());
-            }
-        });
+        MimeHeaders headers = new MimeHeaders();
+        headers.addHeader("Content-Type",
+                "multipart/related; " +
+                "boundary=MIMEBoundaryurn_uuid_E3F7CE4554928DA89B1231365678616; " +
+                "type=\"text/xml\"; " +
+                "start=\"<0....@apache.org>\"");
+        InputStream in = new FileInputStream(System.getProperty("basedir", ".")
+                + "/test-resources/SwAmessage.bin");
+        SOAPMessage message = mf.createMessage(headers, in);
+        SOAPPart soapPart = message.getSOAPPart();
+        assertEquals("<0....@apache.org>",
+                soapPart.getContentId());
+        Iterator attachments = message.getAttachments();
+        assertTrue(attachments.hasNext());
+        AttachmentPart ap = (AttachmentPart)attachments.next();
+        assertEquals("<urn:uuid:E3F7CE4554928DA89B1231365678347>",
+                ap.getContentId());
+        assertFalse(attachments.hasNext());
     }
-*/
 }

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPBody;
@@ -29,12 +29,18 @@
 import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.util.Iterator;
 
 /**
  * 
  */
-public class NodeTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class NodeTest extends Assert {
     private SOAPMessage msg = null;
     private SOAPPart sp = null;
     private SOAPBody body = null;
@@ -42,7 +48,8 @@
     private SOAPHeader header = null;
     private SOAPHeaderElement headerEle = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         msg = MessageFactory.newInstance().createMessage();
         sp = msg.getSOAPPart();
         envelope = sp.getEnvelope();
@@ -52,6 +59,7 @@
         headerEle.setActor("actor-URI");
     }
 
+    @Validated @Test
     public void testDetachNode() {
         try {
             headerEle.detachNode();
@@ -62,6 +70,7 @@
         }
     }
 
+    @Validated @Test
     public void testParentElement() {
         try {
             headerEle.detachNode();
@@ -72,6 +81,7 @@
         }
     }
 
+    @Validated @Test
     public void testSetParentElement1() {
         try {
             headerEle.detachNode();
@@ -86,6 +96,8 @@
         }
     }
 
+    // TODO: test fails with Sun's SAAJ implementation
+    @Test
     public void testSetParentElement2() {
         try {
             try {
@@ -99,6 +111,7 @@
         }
     }
 
+    @Validated @Test
     public void testSetValue() {
         try {
             headerEle.addTextNode("foo-bar");

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.MimeHeaders;
@@ -31,16 +31,17 @@
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.soap.Text;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.util.Iterator;
 
-public class PrefixesTest extends TestCase {
-
-    public PrefixesTest(String name) {
-        super(name);
-    }
-
+@RunWith(SAAJTestRunner.class)
+public class PrefixesTest extends Assert {
+    @Validated @Test
     public void testAddingPrefixesForChildElements() throws Exception {
         MessageFactory factory = MessageFactory.newInstance();
         SOAPMessage msg = factory.createMessage();
@@ -64,6 +65,7 @@
         assertTrue(xml.indexOf("http://www.apache.org") != -1);
     }
 
+    @Validated @Test
     public void testAttribute() throws Exception {
         String soappacket =
                 "<soapenv:Envelope xmlns:soapenv =\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
@@ -106,6 +108,7 @@
         }
     }
 
+    @Validated @Test
     public void testAttrPrifix() {
         try {
             MessageFactory fac = MessageFactory.newInstance();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.Detail;
@@ -34,10 +34,15 @@
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 /**
  * 
  */
-public class SAAJDetailTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SAAJDetailTest extends Assert {
     private SOAPMessage msg = null;
     private SOAPPart sp = null;
     private SOAPBody body = null;
@@ -45,7 +50,8 @@
     private SOAPHeader header = null;
     private SOAPHeaderElement headerEle = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         msg = MessageFactory.newInstance().createMessage();
         sp = msg.getSOAPPart();
         envelope = sp.getEnvelope();
@@ -59,6 +65,7 @@
     /*
     * for soap version 1.1
     */
+    @Validated @Test
     public void testAddDetailEntry() throws Exception {
         //Add a SOAPFault object to the SOAPBody
         SOAPFault sf = body.addFault();
@@ -75,6 +82,7 @@
     /*
      * for soap version 1.2
      */
+    @Validated @Test
     public void testAddDetailEntry2() throws Exception {
         msg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
         sp = msg.getSOAPPart();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.Node;
@@ -31,10 +31,15 @@
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 /**
  * 
  */
-public class SAAJResultTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SAAJResultTest extends Assert {
     private SOAPMessage msg = null;
     private SOAPPart sp = null;
     private SOAPBody body = null;
@@ -42,7 +47,8 @@
     private SOAPHeader header = null;
     private SOAPHeaderElement headerEle = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         msg = MessageFactory.newInstance().createMessage();
         sp = msg.getSOAPPart();
         envelope = sp.getEnvelope();
@@ -60,6 +66,7 @@
     }
     */
 
+    @Validated @Test
     public void testGetResultSOAPMessage() throws Exception{
     	SAAJResult sr = new SAAJResult(msg);
     	Node node = sr.getResult();

Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java?rev=733910&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java Mon Jan 12 13:39:04 2009
@@ -0,0 +1,146 @@
+/*
+ * 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.axis2.saaj;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.xml.soap.SAAJMetaFactory;
+
+import org.junit.internal.runners.InitializationError;
+import org.junit.internal.runners.JUnit4ClassRunner;
+import org.junit.runner.Description;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+
+/**
+ * Special JUnit test runner that allows test cases to be validated against
+ * Sun's SAAJ implementation.
+ * If a test method is annotated with {@link Validated} (in addition to {@link org.junit.Test},
+ * then this runner will execute the test twice: once with Sun's SAAJ implementation and
+ * once with Axis2's. This is a convenient way to validate test cases, i.e. to make sure that
+ * the test cases make correct assertions about SAAJ behavior. Of course this makes the implicit
+ * assumption that Sun's implementation is bug free, which is not necessarily the case...
+ */
+public class SAAJTestRunner extends JUnit4ClassRunner {
+    private static class MultiRunListener extends RunListener {
+        private final RunNotifier notifier;
+        private boolean firstRun = true;
+        private int runs;
+        private String failureMessage;
+        
+        public MultiRunListener(RunNotifier notifier, int runs) {
+            this.notifier = notifier;
+            this.runs = runs;
+        }
+
+        @Override
+        public void testStarted(Description description) throws Exception {
+            runs--;
+            if (firstRun) {
+                notifier.fireTestStarted(description);
+                firstRun = false;
+            }
+        }
+        
+        @Override
+        public void testFailure(Failure failure) throws Exception {
+            if (failureMessage != null) {
+                failure = new Failure(failure.getDescription(), new Error(failureMessage,
+                        failure.getException()));
+            }
+            notifier.fireTestFailure(failure);
+            runs = 0;
+        }
+
+        @Override
+        public void testIgnored(Description description) throws Exception {
+            notifier.fireTestIgnored(description);
+            runs = 0;
+        }
+
+        @Override
+        public void testFinished(Description description) throws Exception {
+            if (runs == 0) {
+                notifier.fireTestFinished(description);
+            }
+        }
+        
+        public void setFailureMessage(String failureMessage) {
+            this.failureMessage = failureMessage;
+        }
+
+        public boolean isShouldContinue() {
+            return runs > 0;
+        }
+    }
+    
+    public SAAJTestRunner(Class<?> klass) throws InitializationError {
+        super(klass);
+    }
+
+    @Override
+    protected void invokeTestMethod(Method method, RunNotifier notifier) {
+        boolean validate = method.getAnnotation(Validated.class) != null;
+        RunNotifier multiRunNotifier = new RunNotifier();
+        MultiRunListener multiRunListener = new MultiRunListener(notifier, validate ? 2 : 1);
+        multiRunNotifier.addListener(multiRunListener);
+        if (validate) {
+            multiRunListener.setFailureMessage(
+                    "Invalid test case; execution failed with SAAJ reference implementation");
+            System.setProperty("javax.xml.soap.MessageFactory",
+                    "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");
+            System.setProperty("javax.xml.soap.SOAPFactory",
+                    "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl");
+            System.setProperty("javax.xml.soap.SOAPConnectionFactory",
+                    "com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory");
+            System.setProperty("javax.xml.soap.MetaFactory",
+                    "com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl");
+            resetSAAJFactories();
+            super.invokeTestMethod(method, multiRunNotifier);
+        }
+        if (multiRunListener.isShouldContinue()) {
+            multiRunListener.setFailureMessage(null);
+            System.setProperty("javax.xml.soap.MessageFactory",
+                    "org.apache.axis2.saaj.MessageFactoryImpl");
+            System.setProperty("javax.xml.soap.SOAPFactory",
+                    "org.apache.axis2.saaj.SOAPFactoryImpl");
+            System.setProperty("javax.xml.soap.SOAPConnectionFactory",
+                    "org.apache.axis2.saaj.SOAPConnectionFactoryImpl");
+            System.setProperty("javax.xml.soap.MetaFactory",
+                    "org.apache.axis2.saaj.SAAJMetaFactoryImpl");
+            resetSAAJFactories();
+            super.invokeTestMethod(method, multiRunNotifier);
+        }
+    }
+    
+    private void resetSAAJFactories() {
+        // SAAJMetaFactory caches the instance; use reflection to reset it between test runs.
+        // Note that the other factories are OK.
+        try {
+            Field field = SAAJMetaFactory.class.getDeclaredField("instance");
+            field.setAccessible(true);
+            field.set(null, null);
+        } catch (Throwable ex) {
+            throw new Error(ex);
+        }
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,10 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -42,7 +45,8 @@
 import java.io.File;
 import java.util.Iterator;
 
-public class SOAPBodyTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPBodyTest extends Assert {
 
     /**
      * Method suite
@@ -55,25 +59,17 @@
     */
 
     /**
-     * Constructor TestSOAPBody
-     *
-     * @param name
-     */
-    public SOAPBodyTest(String name) {
-        super(name);
-    }
-
-    /**
      * Method testSoapBodyBUG
      *
      * @throws Exception
      */
+    @Validated @Test
     public void testSoapBody() throws Exception {
 
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();
         SOAPPart soapPart = message.getSOAPPart();
-        SOAPEnvelopeImpl env = (SOAPEnvelopeImpl)soapPart.getEnvelope();
+        SOAPEnvelope env = soapPart.getEnvelope();
         SOAPHeader header = env.getHeader();
         Name hns = env.createName("Hello",
                                   "shw",
@@ -176,6 +172,7 @@
     }
 
     //TODO : fix
+    @Validated @Test
     public void testExtractContentAsDocument() {
         try {
             MessageFactory fact = MessageFactory.newInstance();
@@ -209,6 +206,7 @@
     /*
      * For SOAP 1.1 message 
      */
+    @Validated @Test
     public void testAddAttribute() {
         try {
             MessageFactory fact = MessageFactory.newInstance();
@@ -227,6 +225,7 @@
     /*
      * For SOAP 1.2 message 
      */
+    @Validated @Test
     public void testAddAttribute2() {
         try {
             MessageFactory fact = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -244,6 +243,7 @@
     /*
     * For SOAP 1.2 message
     */
+    @Validated @Test
     public void testAddFault() {
         try {
             MessageFactory fact = MessageFactory.newInstance();
@@ -263,6 +263,7 @@
         }
     }
 
+    @Validated @Test
     public void testAppendChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java Mon Jan 12 13:39:04 2009
@@ -19,13 +19,15 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.xml.soap.SOAPConnection;
 import javax.xml.soap.SOAPConnectionFactory;
@@ -37,7 +39,9 @@
 /**
  * 
  */
-public class SOAPConnectionTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPConnectionTest extends Assert {
+    @Validated @Test
     public void testClose() {
         try {
             SOAPConnection sCon = SOAPConnectionFactory.newInstance().createConnection();
@@ -47,6 +51,7 @@
         }
     }
 
+    @Validated @Test
     public void testCloseTwice() {
         SOAPConnectionFactory soapConnectionFactory = null;
         try {
@@ -71,6 +76,7 @@
         }
     }
 
+    @Validated @Test
     public void testCallOnCloseConnection() {
         SOAPConnectionFactory soapConnectionFactory = null;
         try {
@@ -96,6 +102,7 @@
     }
 
 
+    @Validated @Test
     public void testGet() {
     	if(isNetworkedResourceAvailable("http://java.sun.com/index.html")){
             try {

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java Mon Jan 12 13:39:04 2009
@@ -19,8 +19,10 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
-import org.apache.axiom.om.impl.dom.NodeImpl;
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -40,17 +42,20 @@
 import java.util.Iterator;
 import java.util.List;
 
-public class SOAPElementTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPElementTest extends Assert {
 
     private SOAPElement soapEle;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         soapEle =
                 SOAPFactoryImpl.newInstance().createElement("Test",
                                                             "test",
                                                             "http://test.apache.org/");
     }
 
+    @Validated @Test
     public void testAddTextNode() {
         assertNotNull(soapEle);
         String value = "foo";
@@ -60,10 +65,11 @@
             fail("Unexpected Exception " + e);
         }
         assertEquals(value, soapEle.getValue());
-        TextImplEx text = assertContainsText(soapEle);
+        Text text = assertContainsText(soapEle);
         assertEquals(value, text.getValue());
     }
 
+    @Validated @Test
     public void testChildren() {
         try {
             soapEle.addTextNode("foo");
@@ -112,6 +118,7 @@
         assertEquals("ch", lastChildSOAPEle.getPrefix());
     }
 
+    @Validated @Test
     public void testChildrenAndSiblings() {
         try {
             soapEle.addTextNode("foo");
@@ -171,6 +178,7 @@
         assertNull(nextSibling2.getNextSibling());
     }
 
+    @Validated @Test
     public void testCommentSibling() {
         try {
             soapEle.addTextNode("foo");
@@ -185,6 +193,7 @@
         assertTrue(((Text)soapEle.getLastChild().getPreviousSibling()).isComment());
     }
 
+    @Validated @Test
     public void testCommentSibling2() {
         try {
             soapEle.addTextNode("foo");
@@ -203,6 +212,7 @@
                 .getPreviousSibling()).isComment());
     }
 
+    @Validated @Test
     public void testAddChildElement() {
         try {
             String s = "MyName1";
@@ -238,6 +248,7 @@
         }
     }
 
+    @Validated @Test
     public void testAddChildElement2() {
         boolean pass = true;
         try {
@@ -290,6 +301,7 @@
         }
     }
 
+    @Validated @Test
     public void testAddTextNode2() {
         try {
             SOAPMessage msg = MessageFactory.newInstance().createMessage();
@@ -328,6 +340,7 @@
         }
     }
 
+    @Validated @Test
     public void testRemoveAttribute() {
         try {
             SOAPMessage msg = MessageFactory.newInstance().createMessage();
@@ -346,6 +359,7 @@
         }
     }
 
+    @Validated @Test
     public void testRemoveAttribute2() {
         try {
             SOAPMessage msg = MessageFactory.newInstance().createMessage();
@@ -370,6 +384,7 @@
         }
     }
 
+    @Validated @Test
     public void testRemoveAttributeName() {
         try {
             SOAPMessage msg = MessageFactory.newInstance().createMessage();
@@ -415,6 +430,7 @@
 
     }
 
+    @Validated @Test
     public void testRemoveNamespaceDeclaration() {
         try {
             String prefix = "myPrefix";
@@ -459,13 +475,13 @@
         return count;
     }
 
-    private TextImplEx assertContainsText(SOAPElement soapElem) {
+    private Text assertContainsText(SOAPElement soapElem) {
         assertTrue(soapElem.hasChildNodes());
         List childElems = toList(soapElem.getChildElements());
         assertTrue(childElems.size() == 1);
-        NodeImpl node = (NodeImpl)childElems.get(0);
-        assertTrue(node instanceof TextImplEx);
-        return (TextImplEx)node;
+        Node node = (Node)childElems.get(0);
+        assertTrue(node instanceof Text);
+        return (Text)node;
     }
 
     private List toList(java.util.Iterator iter) {
@@ -480,6 +496,7 @@
     /*
     * test for addChildElement(QName qname)
     */
+    @Validated @Test
     public void testAddChildElement3() {
         try {
             QName qname = new QName("http://sample.apache.org/trader", "GetStockQuote", "w");
@@ -492,6 +509,7 @@
     }
 
 
+    @Validated @Test
     public void testGetAttributeValue() {
         assertNotNull(soapEle);
         String value = "234.50";
@@ -569,6 +587,7 @@
         }
     }
 
+    @Validated @Test
     public void testGetChildElements3() {
         try {
             MessageFactory fact = MessageFactory.newInstance();
@@ -664,6 +683,7 @@
         }
     }
 
+    @Validated @Test
     public void testRemoveContent() {
         boolean pass = true;
         try {
@@ -701,7 +721,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testSetElementQName() {
         try {
             MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -732,6 +752,7 @@
         }
     }
 
+    @Validated @Test
     public void testSetElementQName2() {
         try {
             MessageFactory factory = MessageFactory.newInstance();
@@ -770,6 +791,7 @@
         }
     }
     
+    @Validated @Test
     public void testAppendChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();
@@ -820,6 +842,7 @@
         assertFalse(iter.hasNext());               
     }
     
+    @Validated @Test
     public void testRemoveChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -48,13 +48,16 @@
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.dom.DOMSource;
 
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import java.io.ByteArrayInputStream;
 import java.util.Iterator;
 
-public class SOAPEnvelopeTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPEnvelopeTest extends Assert {
 
     private static final String XML_STRING =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
@@ -73,10 +76,7 @@
                     "</soapenv:Body>\n" +
                     "</soapenv:Envelope>";
 
-    public SOAPEnvelopeTest(String name) {
-        super(name);
-    }
-
+    @Validated @Test
     public void testEnvelope() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage smsg =
@@ -91,6 +91,7 @@
         validateBody(body.getChildElements());
     }
 
+    @Validated @Test
     public void testDetachHeader() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage smsg =
@@ -106,6 +107,7 @@
         assertNull(smsg.getSOAPHeader());
     }
 
+    @Validated @Test
     public void testDetachBody() {
         try {
             MessageFactory mf = MessageFactory.newInstance();
@@ -136,6 +138,7 @@
         }
     }
 
+    @Validated @Test
     public void testEnvelope2() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         final ByteArrayInputStream baIS = new ByteArrayInputStream(XML_STRING.getBytes());
@@ -171,6 +174,7 @@
         assertTrue(envelope.getBody() != null);
     }
 
+    @Validated @Test
     public void testEnvelopeWithCommentInEnvelope() throws Exception {
 
         String soapMessageWithLeadingComment =
@@ -197,6 +201,7 @@
         assertTrue(envelope.getBody() != null);
     }
 
+    @Validated @Test
     public void testEnvelopeWithCommentInBody() throws Exception {
 
         String soapMessageWithLeadingComment =
@@ -222,6 +227,7 @@
         assertTrue(envelope.getBody() != null);
     }
 
+    @Validated @Test
     public void testEnvelopeWithComments() throws Exception {
 
         String soapMessageWithLeadingComment =
@@ -293,6 +299,7 @@
         }
     }
 
+    @Validated @Test
     public void testHeaderElements() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPHeader header = envelope.getHeader();
@@ -317,6 +324,7 @@
         assertTrue(!iterator.hasNext());
     }
 
+    @Validated @Test
     public void testText() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -335,6 +343,7 @@
         assertTrue(count == countStart + 1);
     }
 
+    @Validated @Test
     public void testNonCommentText() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -353,6 +362,7 @@
         assertTrue(!t.isComment());
     }
 
+    @Validated @Test
     public void testCommentText() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -371,6 +381,7 @@
         assertTrue(t.isComment());
     }
 
+    @Validated @Test
     public void testAttributes() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -411,6 +422,7 @@
         assertTrue(foundName1 && foundName2 && foundName3);
     }
 
+    @Validated @Test
     public void testAttributes2() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -451,6 +463,7 @@
         assertTrue(foundName1 && foundName2 && foundName3);
     }
 
+    @Validated @Test
     public void testAttributes3() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -491,6 +504,7 @@
         assertTrue(foundName1 && foundName2 && foundName3);
     }
 
+    @Validated @Test
     public void testAddHeader() {
         try {
             SOAPEnvelope envelope = getSOAPEnvelope();
@@ -554,6 +568,7 @@
         }
     }
 
+    @Validated @Test
     public void testSetEncodingStyle() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         envelope.setEncodingStyle("http://example.com/MyEncodings");
@@ -561,6 +576,7 @@
         assertEquals("http://example.com/MyEncodings",envelope.getEncodingStyle());
     }
 
+    @Validated @Test
     public void testElementAfterBody() throws Exception {
         MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage message = factory.createMessage();
@@ -579,6 +595,7 @@
         }
     }
     
+    @Validated @Test
     public void testTransform() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java Mon Jan 12 13:39:04 2009
@@ -19,9 +19,11 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -40,9 +42,11 @@
 /**
  * 
  */
-public class SOAPFactoryTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPFactoryTest extends Assert {
     private static final Log log = LogFactory.getLog(SOAPFactoryTest.class);
 
+    @Validated @Test
     public void testCreateDetail() {
         try {
             SOAPFactory sf = SOAPFactory.newInstance();
@@ -59,6 +63,7 @@
         }
     }
 
+    @Validated @Test
     public void testCreateElement() {
         try {
             //SOAPFactory sf = SOAPFactory.newInstance();
@@ -93,7 +98,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testCreateElement2() {
         try {
             SOAPFactory sf = SOAPFactory.newInstance();
@@ -121,6 +126,7 @@
         }
     }
 
+    @Validated @Test
     public void testCreateElement3() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance();
@@ -138,6 +144,7 @@
         }
     }
 
+    @Validated @Test
     public void testCreateElement4() {
         try {
             SOAPFactory sf = SOAPFactory.newInstance();
@@ -164,6 +171,7 @@
         }
     }
 
+    @Validated @Test
     public void testCreateFault() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -190,6 +198,8 @@
         }
     }
 
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void testCreateFault1() {
         try {
             //SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -216,6 +226,7 @@
     }
 
     /** for soap 1.1 */
+    @Validated @Test
     public void testSOAPFaultException1() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -234,6 +245,7 @@
     }
 
     /** for soap 1.2 */
+    @Validated @Test
     public void testSOAPFaultException2() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.DetailEntry;
 import javax.xml.soap.MessageFactory;
@@ -27,15 +27,15 @@
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
-import java.io.ByteArrayInputStream;
-import java.util.Iterator;
 
-public class SOAPFaultDetailTest extends TestCase {
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
-    public SOAPFaultDetailTest(String name) {
-        super(name);
-    }
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
 
+@RunWith(SAAJTestRunner.class)
+public class SOAPFaultDetailTest extends Assert {
     private String xmlString =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                     "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
@@ -51,6 +51,8 @@
                     " </soapenv:Body>" +
                     "</soapenv:Envelope>";
 
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void testDetails() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage smsg =

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.Detail;
@@ -37,16 +37,16 @@
 import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayOutputStream;
 import java.util.Iterator;
 import java.util.Locale;
 
-public class SOAPFaultTest extends TestCase {
-
-    public SOAPFaultTest(String name) {
-        super(name);
-    }
-
+@RunWith(SAAJTestRunner.class)
+public class SOAPFaultTest extends Assert {
     public void _testSOAPFaultWithDetails() throws Exception {
         /* We are trying to generate the following SOAPFault
 
@@ -155,6 +155,7 @@
         assertTrue(xml.indexOf("<faultactor>http://gizmos.com/order</faultactor>") != -1);
     }
 
+    @Validated @Test
     public void testAddDetailsTwice() throws Exception {
         MessageFactory fac = MessageFactory.newInstance();
 
@@ -194,6 +195,7 @@
         assertTrue(xml.indexOf("Hello") != -1);
     }
 
+    @Validated @Test
     public void testFaults() throws Exception {
         MessageFactory messageFactory = MessageFactory.newInstance();
         SOAPFactory soapFactory = SOAPFactory.newInstance();
@@ -250,6 +252,7 @@
         }
     }
 
+    @Validated @Test
     public void testGetFaultActor() throws Exception {
         SOAPMessage msg = MessageFactory.newInstance().createMessage();
         SOAPFault sf = msg.getSOAPBody().addFault();
@@ -262,6 +265,7 @@
         }
     }
 
+    @Validated @Test
     public void testGetFaultString() throws Exception {
         SOAPMessage msg = MessageFactory.newInstance().createMessage();
         SOAPFault sf = msg.getSOAPBody().addFault();
@@ -275,6 +279,7 @@
         }
     }
 
+    @Validated @Test
     public void testAppendSubCode() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -298,6 +303,7 @@
         assertNotNull(faultSubCodes);
     }
 
+    @Validated @Test
     public void testAppendFaultSubCode() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -390,6 +396,7 @@
         soapMessage.saveChanges();
     }
 
+    @Validated @Test
     public void testAddFaultReasonText2() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -405,6 +412,7 @@
         soapMessage.saveChanges();
     }
 
+    @Validated @Test
     public void testAddFaultReasonText3() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -443,7 +451,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testAddFaultReasonText4() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -491,7 +499,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testSetFaultRole() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
 
@@ -506,6 +514,7 @@
         soapMessage.saveChanges();
     }
 
+    @Validated @Test
     public void testSetFaultNode() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
 
@@ -561,6 +570,7 @@
         assertNotNull(qname);
     }
 
+    @Validated @Test
     public void testHasDetail() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         //MessageFactory fac = MessageFactory.newInstance();
@@ -577,6 +587,7 @@
         soapMessage.saveChanges();
     }
 
+    @Validated @Test
     public void testFaultReasonLocales() throws Exception  {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -645,6 +656,7 @@
         }
     }
 
+    @Validated @Test
     public void testFaultStringLocale() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         //MessageFactory fac = MessageFactory.newInstance();
@@ -660,7 +672,7 @@
         assertNotNull(result);
     }
 
-
+    @Validated @Test
     public void testFaultStringLocale2() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         //MessageFactory fac = MessageFactory.newInstance();
@@ -676,6 +688,7 @@
         assertTrue(result.equals(Locale.getDefault()));
     }
 
+    @Validated @Test
     public void testSetFaultStringLocale() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         //MessageFactory fac = MessageFactory.newInstance();
@@ -692,7 +705,8 @@
         assertTrue(result.equals(expected));
     }
 
-
+    // TODO: fix this test: it uses a fault code with unbound prefix
+    @Test
     public void testFaultCodeWithPrefix1() throws Exception {
         MessageFactory fac = MessageFactory.newInstance();
         SOAPMessage soapMessage = fac.createMessage();
@@ -709,6 +723,8 @@
         assertEquals(prefix + ":Server", result);
     }
 
+    // TODO: fix this test: it uses a fault code with unbound prefix
+    @Test
     public void testFaultCodeWithPrefix2() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -725,6 +741,7 @@
         assertEquals(prefix + ":Server", result);
     }
 
+    @Validated @Test
     public void testSetGetFaultCodeAsName1() throws Exception {
         SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
         SOAPFault sf = fac.createFault();
@@ -745,7 +762,7 @@
         assertEquals(name.getURI(), name3.getNamespaceURI());
     }
 
-
+    @Validated @Test
     public void testSetGetFaultCodeAsName2() throws Exception {
         QName qname = SOAPConstants.SOAP_SENDER_FAULT;
         SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -767,7 +784,7 @@
         assertEquals(name.getURI(), name3.getNamespaceURI());
     }
 
-
+    @Validated @Test
     public void testSetGetFaultCodeAsQName1() throws Exception {
         SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
         SOAPFault sf = fac.createFault();
@@ -788,7 +805,7 @@
         assertEquals(name.getNamespaceURI(), name3.getURI());
     }
 
-
+    @Validated @Test
     public void testSetGetFaultCodeAsQName2() throws Exception {
         QName name = SOAPConstants.SOAP_SENDER_FAULT;
         SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -808,6 +825,7 @@
         assertEquals(name.getNamespaceURI(), name3.getURI());
     }
 
+    @Validated @Test
     public void testFault12Defaults() throws Exception {
         MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage message = messageFactory.createMessage();
@@ -817,6 +835,7 @@
         assertNotNull(fault.getFaultString());
     }
 
+    @Validated @Test
     public void testFault11Defaults() throws Exception {
         MessageFactory messageFactory = MessageFactory.newInstance();
         SOAPMessage message = messageFactory.createMessage();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.MessageFactory;
@@ -36,13 +36,17 @@
 import javax.xml.soap.SOAPPart;
 import javax.xml.soap.Text;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 
-public class SOAPHeaderTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPHeaderTest extends Assert {
     private MessageFactory mf = null;
     private SOAPMessage msg = null;
     private SOAPPart sp = null;
@@ -51,10 +55,7 @@
     private SOAPHeaderElement she1 = null;
     private SOAPHeaderElement she2 = null;
 
-    public SOAPHeaderTest(String name) {
-        super(name);
-    }
-
+    @Validated @Test
     public void testAddHeaderElements() throws Exception {
         javax.xml.soap.SOAPMessage soapMessage =
                 javax.xml.soap.MessageFactory.newInstance().createMessage();
@@ -110,6 +111,7 @@
         assertEquals(3, numOfHeaderElements);
     }
 
+    @Validated @Test
     public void testHeaders() {
         try {
             // Create message factory and SOAP factory
@@ -186,13 +188,15 @@
         }
     }
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         msg = MessageFactory.newInstance().createMessage();
         sp = msg.getSOAPPart();
         envelope = sp.getEnvelope();
         hdr = envelope.getHeader();
     }
 
+    @Validated @Test
     public void testExamineHeader() {
         SOAPHeaderElement she = null;
 
@@ -223,6 +227,7 @@
         }
     }
 
+    @Validated @Test
     public void testAddNotUnderstoodHeaderElement() throws Exception {
         javax.xml.soap.SOAPMessage soapMessage =
                 javax.xml.soap.MessageFactory.newInstance(
@@ -245,6 +250,7 @@
     }
 
 
+    @Validated @Test
     public void testAddUpgradeHeaderElement() throws Exception {
         javax.xml.soap.SOAPMessage soapMessage =
                 javax.xml.soap.MessageFactory.newInstance(
@@ -270,6 +276,7 @@
         assertTrue(localName.equals("Upgrade"));
     }
 
+    @Validated @Test
     public void testExamineHeaderElements() throws Exception {
         javax.xml.soap.SOAPMessage soapMessage =
                 javax.xml.soap.MessageFactory.newInstance(
@@ -295,7 +302,7 @@
         assertEquals(0, count);
     }
 
-
+    @Validated @Test
     public void testExamineHeaderElements2() throws Exception {
         javax.xml.soap.SOAPMessage soapMessage =
                 javax.xml.soap.MessageFactory.newInstance().createMessage();
@@ -352,6 +359,7 @@
         }
     }
 
+    @Validated @Test
     public void testQNamesOnHeader() {
         SOAPHeaderElement headerElement = null;
         try {
@@ -367,6 +375,7 @@
         }
     }
     
+    @Validated @Test
     public void testAppendChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java Mon Jan 12 13:39:04 2009
@@ -19,8 +19,11 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 import org.apache.axis2.saaj.util.SAAJDataSource;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
@@ -53,7 +56,8 @@
 /**
  * 
  */
-public class SOAPMessageTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPMessageTest extends Assert {
     private SOAPMessage msg;
 
 //    static int port;
@@ -88,7 +92,8 @@
 //        };
 //    }
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
 //        final AxisService service = Utils.createSimpleService(SERVICE_NAME,
 //                                                              EchoService.class.getName(),
 //                                                              OPERATION_NAME);
@@ -101,6 +106,7 @@
 //        UtilServer.unDeployClientService();
 //    }
 
+    @Validated @Test
     public void testSaveRequired() {
         try {
             assertTrue("Save Required is False", msg.saveRequired());
@@ -109,6 +115,7 @@
         }
     }
 
+    @Validated @Test
     public void testSaveRequired2() {
         try {
             msg.saveChanges();
@@ -118,7 +125,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testRemoveAttachements() {
         Iterator iterator = null;
         AttachmentPart ap1 = null;
@@ -183,7 +190,8 @@
         }
     }
 
-
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void testGetContent() {
         try {
             MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java Mon Jan 12 13:39:04 2009
@@ -19,21 +19,21 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPMessage;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
 /** Ref: JIRA- Axis2-517 */
-public class SOAPNamespaceTest extends TestCase {
-
-    public SOAPNamespaceTest(String arg0) {
-        super(arg0);
-    }
-
-
+@RunWith(SAAJTestRunner.class)
+public class SOAPNamespaceTest extends Assert {
+    @Validated @Test
     public void test() {
         try {
             String xml =

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java Mon Jan 12 13:39:04 2009
@@ -19,8 +19,10 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -44,8 +46,9 @@
 /**
  * 
  */
-public class SOAPPartTest extends TestCase {
-
+@RunWith(SAAJTestRunner.class)
+public class SOAPPartTest extends Assert {
+    @Validated @Test
     public void testAddSource() throws Exception {
         /*
         FileReader testFile = new FileReader(new File(System.getProperty("basedir",".")+"/test-resources" + File.separator + "soap-part.xml"));
@@ -56,7 +59,9 @@
                                 testFile));
         */
 
-        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder builder = dbf.newDocumentBuilder();
         Document document = builder.parse(new File(System.getProperty("basedir", ".") +
                 "/test-resources" + File.separator + "soap-part.xml"));
         DOMSource domSource = new DOMSource(document);
@@ -107,7 +112,7 @@
         }
     }
 
-
+    @Validated @Test
     public void testAddSource2() throws Exception {
         SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
         SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
@@ -131,6 +136,7 @@
         assertNotNull(soapMessage2);
     }
 
+    @Validated @Test
     public void testAddSource3() throws Exception {
         SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
         SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
@@ -178,6 +184,7 @@
     /**
      * Check parent processing of SOAPMessage
      */
+    @Validated @Test
     public void test_parentAccess1() throws Exception {
 
         MessageFactory mf = MessageFactory.newInstance();
@@ -193,6 +200,8 @@
     /**
      * Check parent processing of SOAPMessage
      */
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void test_parentAccess2() throws Exception {
 
         MessageFactory mf = MessageFactory.newInstance();
@@ -211,6 +220,7 @@
     /**
      * Check parent processing of SOAPMessage
      */
+    @Validated @Test
     public void test_parentAccess3() throws Exception {
 
         SOAP11Factory axiomSF = new SOAP11Factory();
@@ -231,6 +241,8 @@
         assertTrue(node == null);
     }
     
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void testNodeTypes() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();
@@ -247,6 +259,8 @@
         }             
     }
     
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void testRemoveChild1() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();
@@ -259,6 +273,8 @@
         assertTrue("soap env after", soapPart.getFirstChild() == null);
     }
     
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void testRemoveChild2() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/TextTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/TextTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/TextTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/TextTest.java Mon Jan 12 13:39:04 2009
@@ -19,7 +19,11 @@
 
 package org.apache.axis2.saaj;
 
+import junit.framework.Assert;
 import junit.framework.TestCase;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -36,13 +40,10 @@
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
-public class TextTest extends TestCase {
-
-    public TextTest(String name) {
-        super(name);
-    }
-
+@RunWith(SAAJTestRunner.class)
+public class TextTest extends Assert {
     //Test SAAJ addTextNode performance
+    @Validated @Test
     public void testAddTextNode() throws Exception {
         SOAPFactory soapFactory = SOAPFactory.newInstance();
         MessageFactory factory = MessageFactory.newInstance();
@@ -149,6 +150,7 @@
         //System.out.flush();
     }
 
+    @Validated @Test
     public void testComment() throws SOAPException, IOException {
 
         String xmlString = "<?xml version='1.0' encoding='utf-8'?> " +

Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/Validated.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/Validated.java?rev=733910&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/Validated.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/Validated.java Mon Jan 12 13:39:04 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.axis2.saaj;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import java.lang.annotation.Retention;
+
+/**
+ * Annotation used in conjunction with {@link SAAJTestRunner} to specify that a given
+ * test case should be validated against Sun's SAAJ implementation.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Validated {
+}

Propchange: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/Validated.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java?rev=733910&r1=733909&r2=733910&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java Mon Jan 12 13:39:04 2009
@@ -19,10 +19,7 @@
 
 package org.apache.axis2.saaj.integration;
 
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import junit.framework.Assert;
 import org.apache.axiom.attachments.Attachments;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
@@ -30,7 +27,15 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
+import org.apache.axis2.saaj.SAAJTestRunner;
+import org.apache.axis2.saaj.Validated;
 import org.apache.axis2.util.Utils;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.activation.DataHandler;
 import javax.activation.FileDataSource;
@@ -58,7 +63,8 @@
 import java.io.IOException;
 import java.util.Iterator;
 
-public class IntegrationTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class IntegrationTest extends Assert {
 
     static int port;
     public static final QName SERVICE_NAME = new QName("Echo");
@@ -67,33 +73,28 @@
     public static final String SAAJ_REPO =
             System.getProperty("basedir", ".") + "/" + "target/test-resources/saaj-repo";
 
-    public IntegrationTest(String name) {
-        super(name);
-    }
-
     protected static String getAddress() {
         return "http://127.0.0.1:" +
                 port +
                 "/axis2/services/Echo";
     }
     
-    public static Test suite() {
-        return new TestSetup(new TestSuite(IntegrationTest.class)) {
-            public void setUp() throws Exception {
-                port = UtilServer.start(SAAJ_REPO);
-                AxisConfiguration axisCfg =
-                        UtilServer.getConfigurationContext().getAxisConfiguration();
-                axisCfg.addParameter(new Parameter("enableMTOM", "optional"));
-                axisCfg.addParameter(new Parameter("enableSwA", "optional"));
-            }
-
-            public void tearDown() throws Exception {
-                UtilServer.stop();
-            }
-        };
+    @BeforeClass
+    public static void initUtilServer() throws Exception {
+        port = UtilServer.start(SAAJ_REPO);
+        AxisConfiguration axisCfg =
+                UtilServer.getConfigurationContext().getAxisConfiguration();
+        axisCfg.addParameter(new Parameter("enableMTOM", "optional"));
+        axisCfg.addParameter(new Parameter("enableSwA", "optional"));
+    }
+
+    @AfterClass
+    public static void shutDownUtilServer() throws Exception {
+        UtilServer.stop();
     }
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         MessageReceiver mr = new AbstractInOutMessageReceiver() {
             @Override
             public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage)
@@ -116,12 +117,13 @@
                 Utils.createSimpleService(SERVICE_NAME, mr, null, OPERATION_NAME));
     }
 
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         UtilServer.unDeployService(SERVICE_NAME);
         UtilServer.unDeployClientService();
     }
 
-
+    @Validated @Test
     public void testSendReceiveMessageWithEmptyNSPrefix() {
         try {
             MessageFactory mf = MessageFactory.newInstance();
@@ -152,7 +154,7 @@
         }
     }
     
-    
+    @Validated @Test
     public void testSendReceiveSimpleSOAPMessage() {
         try {
             MessageFactory mf = MessageFactory.newInstance();
@@ -189,6 +191,7 @@
         return responseStr;
     }
 
+    @Validated @Test
     public void testSendReceiveMessageWithAttachment() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage request = mf.createMessage();
@@ -247,6 +250,8 @@
 
     }
 
+    // TODO: check why this doesn't work with Sun's SAAJ implementation
+    @Test
     public void testSendReceiveNonRefAttachment() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage request = mf.createMessage();
@@ -370,7 +375,7 @@
         ele2.addTextNode("This is another text");
     }
     
-    
+    @Validated @Test
     public void testSendReceive_ISO88591_EncodedSOAPMessage() {
         try{
         	MimeHeaders mimeHeaders = new MimeHeaders();