axis-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1029210 [2/3] - in /axis/axis2/java/core/branches/1_5: ./ modules/distribution/ modules/kernel/src/org/apache/axis2/transport/http/util/ modules/kernel/test/org/apache/axis2/transport/http/util/ modules/parent/ modules/saaj/ modules/saaj/s...
Date Sat, 30 Oct 2010 21:56:50 GMT
Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java Sat Oct 30 21:56:49 2010
@@ -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,46 +42,42 @@ import javax.xml.soap.Text;
 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/");
     }
 
-    public void testAddTextNode() {
+    @Validated @Test
+    public void testAddTextNode() throws Exception {
         assertNotNull(soapEle);
         String value = "foo";
-        try {
-            soapEle.addTextNode(value);
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
+        soapEle.addTextNode(value);
         assertEquals(value, soapEle.getValue());
-        TextImplEx text = assertContainsText(soapEle);
+        Text text = assertContainsText(soapEle);
         assertEquals(value, text.getValue());
     }
 
-    public void testChildren() {
-        try {
-            soapEle.addTextNode("foo");
-            SOAPElement childEle1 =
-                    SOAPFactoryImpl.newInstance().createElement("Child1",
-                                                                "ch",
-                                                                "http://test.apache.org/");
-            SOAPElement childEle2 =
-                    SOAPFactoryImpl.newInstance().createElement("Child2",
-                                                                "ch",
-                                                                "http://test.apache.org/");
-            soapEle.addChildElement(childEle1);
-            soapEle.addChildElement(childEle2);
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
+    @Validated @Test
+    public void testChildren() throws Exception {
+        soapEle.addTextNode("foo");
+        SOAPElement childEle1 =
+                SOAPFactoryImpl.newInstance().createElement("Child1",
+                                                            "ch",
+                                                            "http://test.apache.org/");
+        SOAPElement childEle2 =
+                SOAPFactoryImpl.newInstance().createElement("Child2",
+                                                            "ch",
+                                                            "http://test.apache.org/");
+        soapEle.addChildElement(childEle1);
+        soapEle.addChildElement(childEle2);
 
         Object o = soapEle.getChildElements().next();
         Object o2 = soapEle.getChildElements().next();
@@ -112,14 +110,11 @@ public class SOAPElementTest extends Tes
         assertEquals("ch", lastChildSOAPEle.getPrefix());
     }
 
-    public void testChildrenAndSiblings() {
-        try {
-            soapEle.addTextNode("foo");
-            soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
-            soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
+    @Validated @Test
+    public void testChildrenAndSiblings() throws Exception {
+        soapEle.addTextNode("foo");
+        soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
+        soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");
 
         Object o = soapEle.getChildElements().next();
         Object o2 = soapEle.getChildElements().next();
@@ -171,30 +166,24 @@ public class SOAPElementTest extends Tes
         assertNull(nextSibling2.getNextSibling());
     }
 
-    public void testCommentSibling() {
-        try {
-            soapEle.addTextNode("foo");
-            soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
-            soapEle.addTextNode("<!-- This is a Comment-->");
-            soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
+    @Validated @Test
+    public void testCommentSibling() throws Exception {
+        soapEle.addTextNode("foo");
+        soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
+        soapEle.addTextNode("<!-- This is a Comment-->");
+        soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");
 
         assertTrue(((Text)soapEle.getFirstChild().getNextSibling().getNextSibling()).isComment());
         assertTrue(((Text)soapEle.getLastChild().getPreviousSibling()).isComment());
     }
 
-    public void testCommentSibling2() {
-        try {
-            soapEle.addTextNode("foo");
-            soapEle.addTextNode("<!-- This is a Comment-->");
-            soapEle.addTextNode("bar");
-            soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
-            soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
+    @Validated @Test
+    public void testCommentSibling2() throws Exception {
+        soapEle.addTextNode("foo");
+        soapEle.addTextNode("<!-- This is a Comment-->");
+        soapEle.addTextNode("bar");
+        soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
+        soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");
 
         assertTrue(((Text)soapEle.getFirstChild().getNextSibling()).isComment());
         assertFalse(((Text)soapEle.getLastChild().getPreviousSibling()
@@ -203,250 +192,219 @@ public class SOAPElementTest extends Tes
                 .getPreviousSibling()).isComment());
     }
 
-    public void testAddChildElement() {
-        try {
-            String s = "MyName1";
-            String p = "MyPrefix1";
-            String u = "myURI";
-            SOAPBody body = MessageFactory.newInstance().createMessage().getSOAPBody();
-            SOAPElement myse = body.addNamespaceDeclaration(p, u);
-            SOAPElement se = body.addChildElement(s, p);
-            if (se == null) {
-                fail("SOAPElement was null");
+    @Validated @Test
+    public void testAddChildElement() throws Exception {
+        String s = "MyName1";
+        String p = "MyPrefix1";
+        String u = "myURI";
+        SOAPBody body = MessageFactory.newInstance().createMessage().getSOAPBody();
+        SOAPElement myse = body.addNamespaceDeclaration(p, u);
+        SOAPElement se = body.addChildElement(s, p);
+        if (se == null) {
+            fail("SOAPElement was null");
+        } else {
+            Iterator i = body.getChildElements();
+            int count = getIteratorCount(i);
+            i = body.getChildElements();
+            if (count != 1) {
+                fail("Wrong iterator count returned of " + count + ", expected 1");
             } else {
-                Iterator i = body.getChildElements();
-                int count = getIteratorCount(i);
-                i = body.getChildElements();
-                if (count != 1) {
-                    fail("Wrong iterator count returned of " + count + ", expected 1");
-                } else {
-                    SOAPElement se2 = (SOAPElement)i.next();
-                    if (!se.equals(se2)) {
-                        fail("Elements not equal");
-                    }
-                }
-                String name = se.getElementName().getLocalName();
-                Name n = se.getElementName();
-                String prefix = se.getElementName().getPrefix();
-                if (!name.equals(s) || !prefix.equals(p)) {
-                    fail("addChildElement() did not return correct local name and prefix");
+                SOAPElement se2 = (SOAPElement)i.next();
+                if (!se.equals(se2)) {
+                    fail("Elements not equal");
                 }
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Exception: " + e);
+            String name = se.getElementName().getLocalName();
+            Name n = se.getElementName();
+            String prefix = se.getElementName().getPrefix();
+            if (!name.equals(s) || !prefix.equals(p)) {
+                fail("addChildElement() did not return correct local name and prefix");
+            }
         }
     }
 
-    public void testAddChildElement2() {
+    @Validated @Test
+    public void testAddChildElement2() throws Exception {
         boolean pass = true;
-        try {
-            SOAPMessage msg =
-                    MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
-            SOAPEnvelope soapEnvelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = msg.getSOAPBody();
-
-            Name name = soapEnvelope.createName("MyChild1");
-            //Add child element Name object with localName=MyChild1
-            SOAPElement se = body.addChildElement(name);
-            if (se == null) {
-                fail("addChildElement() did not return SOAPElement");
-                //pass = false;
-            } else {
-                //Find the child element just added
-                Iterator childs = body.getChildElements(name);
-                int count = 0;
-                while (childs.hasNext()) {
-                    Object obj = (Object)childs.next();
-                    count++;
-                }
-
-                childs = body.getChildElements(name);
-                assertTrue(count == 1);
+        SOAPMessage msg =
+                MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
+        SOAPEnvelope soapEnvelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = msg.getSOAPBody();
+
+        Name name = soapEnvelope.createName("MyChild1");
+        //Add child element Name object with localName=MyChild1
+        SOAPElement se = body.addChildElement(name);
+        if (se == null) {
+            fail("addChildElement() did not return SOAPElement");
+            //pass = false;
+        } else {
+            //Find the child element just added
+            Iterator childs = body.getChildElements(name);
+            int count = 0;
+            while (childs.hasNext()) {
+                Object obj = (Object)childs.next();
+                count++;
+            }
 
-                SOAPElement se2 = (SOAPElement)childs.next();
-                assertEquals(se, se2);
-                //se = se2 (expected)
-
-                //Retrieve the SOAPElement Name
-                Name n = se.getElementName();
-                //System.out.println("localName="+n.getLocalName()+" prefix="
-                //			+n.getPrefix()+" URI="+n.getURI()+" qualifiedName="
-                //			+n.getQualifiedName());
-                assertEquals(n, name);
-                //if (!n.equals(name)) {
-                //System.out.println("Name objects are not equal (unexpected)");
-                //System.out.println("addChildElement() did not return " +
-                //"correct Name object expected localName=" +
-                //name.getLocalName() + ", got localName="
-                //+ n.getLocalName());
-                //}
+            childs = body.getChildElements(name);
+            assertTrue(count == 1);
 
-                //Name objects are equal (expected)
-            }
+            SOAPElement se2 = (SOAPElement)childs.next();
+            assertEquals(se, se2);
+            //se = se2 (expected)
 
-        } catch (Exception e) {
-            fail("Exception: " + e);
+            //Retrieve the SOAPElement Name
+            Name n = se.getElementName();
+            //System.out.println("localName="+n.getLocalName()+" prefix="
+            //			+n.getPrefix()+" URI="+n.getURI()+" qualifiedName="
+            //			+n.getQualifiedName());
+            assertEquals(n, name);
+            //if (!n.equals(name)) {
+            //System.out.println("Name objects are not equal (unexpected)");
+            //System.out.println("addChildElement() did not return " +
+            //"correct Name object expected localName=" +
+            //name.getLocalName() + ", got localName="
+            //+ n.getLocalName());
+            //}
+
+            //Name objects are equal (expected)
         }
     }
 
-    public void testAddTextNode2() {
-        try {
-            SOAPMessage msg = MessageFactory.newInstance().createMessage();
-            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = envelope.getBody();
-            Iterator iStart = envelope.getChildElements();
-            int countStart = getIteratorCount(iStart);
-            SOAPElement se = envelope.addTextNode("<txt>This is text</txt>");
-            if (se == null) {
-                fail("addTextNode() did not return SOAPElement");
-            } else if (!envelope.getValue().equals("<txt>This is text</txt>")) {
-                String s = body.getValue();
-                fail("addTextNode() did not return expected text, Returned " + s +
-                        ", Expected <txt>This is text</txt>");
-            }
-            Iterator i = envelope.getChildElements();
-            int count = getIteratorCount(i);
-            i = envelope.getChildElements();
-            if (count != ++countStart) {
-                fail("Wrong iterator count returned of " +
-                        count + ", expected " + countStart);
-            } else {
-                Object obj = null;
-                while (i.hasNext()) {
-                    obj = i.next();
-                    if (obj instanceof Text) {
-                        break;
-                    }
-                }
-                if (!(obj instanceof Text)) {
-                    fail("obj is not instanceof Text");
+    @Validated @Test
+    public void testAddTextNode2() throws Exception {
+        SOAPMessage msg = MessageFactory.newInstance().createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+        Iterator iStart = envelope.getChildElements();
+        int countStart = getIteratorCount(iStart);
+        SOAPElement se = envelope.addTextNode("<txt>This is text</txt>");
+        if (se == null) {
+            fail("addTextNode() did not return SOAPElement");
+        } else if (!envelope.getValue().equals("<txt>This is text</txt>")) {
+            String s = body.getValue();
+            fail("addTextNode() did not return expected text, Returned " + s +
+                    ", Expected <txt>This is text</txt>");
+        }
+        Iterator i = envelope.getChildElements();
+        int count = getIteratorCount(i);
+        i = envelope.getChildElements();
+        if (count != ++countStart) {
+            fail("Wrong iterator count returned of " +
+                    count + ", expected " + countStart);
+        } else {
+            Object obj = null;
+            while (i.hasNext()) {
+                obj = i.next();
+                if (obj instanceof Text) {
+                    break;
                 }
             }
-        } catch (Exception e) {
-            fail("Exception: " + e);
-        }
-    }
-
-    public void testRemoveAttribute() {
-        try {
-            SOAPMessage msg = MessageFactory.newInstance().createMessage();
-            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = envelope.getBody();
-            Name name = envelope.createName("MyAttr1");
-            String value = "MyValue1";
-            body.addAttribute(name, value);
-            boolean b = body.removeAttribute(name);
-            assertTrue("removeAttribute() did not return true", b);
-            b = body.removeAttribute(name);
-            assertFalse("removeAttribute() did not return false", b);
-            assertNull(body.getAttributeValue(name));
-        } catch (Exception e) {
-            fail("Exception: " + e);
-        }
-    }
-
-    public void testRemoveAttribute2() {
-        try {
-            SOAPMessage msg = MessageFactory.newInstance().createMessage();
-            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = envelope.getBody();
-
-            QName name = new QName("MyAttr1");
-            String value = "MyValue1";
-            body.addAttribute(name, value);
-            boolean b = body.removeAttribute(name);
-            assertTrue(b);
-
-            b = body.removeAttribute(name);
-            if (b) {
-                //removeAttribute() did not return false
-                fail();
+            if (!(obj instanceof Text)) {
+                fail("obj is not instanceof Text");
             }
-            //getAttributeValue should return null
-            assertNull(body.getAttributeValue(name));
-        } catch (Exception e) {
-            fail("Error : " + e);
-        }
-    }
-
-    public void testRemoveAttributeName() {
-        try {
-            SOAPMessage msg = MessageFactory.newInstance().createMessage();
-            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = envelope.getBody();
-
-            Name name = envelope.createName("MyAttr1");
-            String value = "MyValue1";
-            body.addAttribute(name, value);
-            boolean b = body.removeAttribute(name);
-            assertTrue(b);
-
-            b = body.removeAttribute(name);
-            assertTrue(!b);
-
-            String s = body.getAttributeValue(name);
-            assertNull(s);
-        } catch (Exception e) {
-            fail("Failed : " + e);
         }
     }
 
-
-    public void _testRemoveAttributeQName() {
-        try {
-            SOAPMessage msg =
-                    MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
-            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = envelope.getBody();
-
-            QName name = new QName("MyAttr1");
-            String value = "MyValue1";
-            body.addAttribute(name, value);
-            boolean b = body.removeAttribute(name);
-            assertTrue(b);
-            b = body.removeAttribute(name);
-            assertTrue(!b);
-
-            assertNull(body.getAttributeValue(name));
-        } catch (Exception e) {
+    @Validated @Test
+    public void testRemoveAttribute() throws Exception {
+        SOAPMessage msg = MessageFactory.newInstance().createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+        Name name = envelope.createName("MyAttr1");
+        String value = "MyValue1";
+        body.addAttribute(name, value);
+        boolean b = body.removeAttribute(name);
+        assertTrue("removeAttribute() did not return true", b);
+        b = body.removeAttribute(name);
+        assertFalse("removeAttribute() did not return false", b);
+        assertNull(body.getAttributeValue(name));
+    }
+
+    @Validated @Test
+    public void testRemoveAttribute2() throws Exception {
+        SOAPMessage msg = MessageFactory.newInstance().createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+
+        QName name = new QName("MyAttr1");
+        String value = "MyValue1";
+        body.addAttribute(name, value);
+        boolean b = body.removeAttribute(name);
+        assertTrue(b);
+
+        b = body.removeAttribute(name);
+        if (b) {
+            //removeAttribute() did not return false
             fail();
         }
-
-    }
-
-    public void testRemoveNamespaceDeclaration() {
-        try {
-            String prefix = "myPrefix";
-            String uri = "myURI";
-            SOAPMessage msg = MessageFactory.newInstance().createMessage();
-            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = envelope.getBody();
-            body.addNamespaceDeclaration(prefix, uri);
-            boolean b = body.removeNamespaceDeclaration(prefix);
-            assertTrue("removeNamespaceDeclaration() did not return true", b);
-            b = body.removeNamespaceDeclaration(prefix);
-            assertFalse("removeNamespaceDeclaration() did not return false", b);
-            assertNull(body.getNamespaceURI(prefix));
-        } catch (Exception e) {
-            fail("Exception: " + e);
-        }
+        //getAttributeValue should return null
+        assertNull(body.getAttributeValue(name));
     }
 
-    public void _testSetEncodingStyle() {
-        try {
-            SOAPMessage msg = MessageFactory.newInstance().createMessage();
-            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
-            SOAPBody body = envelope.getBody();
-            body.setEncodingStyle(SOAPConstants.URI_NS_SOAP_ENCODING);
-            try {
-                body.setEncodingStyle("BOGUS");
-                fail("Expected Exception did not occur");
-            } catch (IllegalArgumentException e) {
-                assertTrue("Expected Exception occurred", true);
-            }
-        } catch (Exception e) {
-            fail("Exception: " + e);
+    @Validated @Test
+    public void testRemoveAttributeName() throws Exception {
+        SOAPMessage msg = MessageFactory.newInstance().createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+
+        Name name = envelope.createName("MyAttr1");
+        String value = "MyValue1";
+        body.addAttribute(name, value);
+        boolean b = body.removeAttribute(name);
+        assertTrue(b);
+
+        b = body.removeAttribute(name);
+        assertTrue(!b);
+
+        String s = body.getAttributeValue(name);
+        assertNull(s);
+    }
+
+
+    public void _testRemoveAttributeQName() throws Exception {
+        SOAPMessage msg =
+                MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+
+        QName name = new QName("MyAttr1");
+        String value = "MyValue1";
+        body.addAttribute(name, value);
+        boolean b = body.removeAttribute(name);
+        assertTrue(b);
+        b = body.removeAttribute(name);
+        assertTrue(!b);
+
+        assertNull(body.getAttributeValue(name));
+    }
+
+    @Validated @Test
+    public void testRemoveNamespaceDeclaration() throws Exception {
+        String prefix = "myPrefix";
+        String uri = "myURI";
+        SOAPMessage msg = MessageFactory.newInstance().createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+        body.addNamespaceDeclaration(prefix, uri);
+        boolean b = body.removeNamespaceDeclaration(prefix);
+        assertTrue("removeNamespaceDeclaration() did not return true", b);
+        b = body.removeNamespaceDeclaration(prefix);
+        assertFalse("removeNamespaceDeclaration() did not return false", b);
+        assertNull(body.getNamespaceURI(prefix));
+    }
+
+    @Validated @Test
+    public void testSetEncodingStyle() throws Exception {
+        SOAPMessage msg = MessageFactory.newInstance().createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+        body.setEncodingStyle(SOAPConstants.URI_NS_SOAP_ENCODING);
+        try {
+            body.setEncodingStyle("BOGUS");
+            fail("Expected Exception did not occur");
+        } catch (IllegalArgumentException e) {
+            assertTrue("Expected Exception occurred", true);
         }
     }
 
@@ -459,13 +417,13 @@ public class SOAPElementTest extends Tes
         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,296 +438,269 @@ public class SOAPElementTest extends Tes
     /*
     * test for addChildElement(QName qname)
     */
-    public void testAddChildElement3() {
-        try {
-            QName qname = new QName("http://sample.apache.org/trader", "GetStockQuote", "w");
-            soapEle.addChildElement(qname);
-            assertNotNull(soapEle);
-
-        } catch (Exception e) {
-            fail("Exception: " + e);
-        }
+    @Validated @Test
+    public void testAddChildElement3() throws Exception {
+        QName qname = new QName("http://sample.apache.org/trader", "GetStockQuote", "w");
+        soapEle.addChildElement(qname);
+        assertNotNull(soapEle);
     }
 
 
-    public void testGetAttributeValue() {
+    @Validated @Test
+    public void testGetAttributeValue() throws Exception {
         assertNotNull(soapEle);
         String value = "234.50";
-        try {
-            QName qname = new QName("http://sample.apache.org/trader", "GetStockQuote", "w");
-            soapEle.addAttribute(qname, value);
-            String valueReturned = soapEle.getAttributeValue(qname);
-            assertEquals(value, valueReturned);
-
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
+        QName qname = new QName("http://sample.apache.org/trader", "GetStockQuote", "w");
+        soapEle.addAttribute(qname, value);
+        String valueReturned = soapEle.getAttributeValue(qname);
+        assertEquals(value, valueReturned);
     }
 
 
-    public void _testGetChildElements() {
-        try {
-            SOAPElement childEle1 =
-                    SOAPFactoryImpl.newInstance().createElement("Child1",
-                                                                "ch",
-                                                                "http://test.apache.org/");
-            SOAPElement childEle2 =
-                    SOAPFactoryImpl.newInstance().createElement("Child2",
-                                                                "ch",
-                                                                "http://test.apache.org/");
-            childEle1.addChildElement(childEle2);
-            soapEle.addChildElement(childEle1);
-
-            QName qname = new QName("http://test.apache.org/", "Child1", "ch");
-            Iterator childElements = soapEle.getChildElements(qname);
-
-
-            int childCount = 0;
-            while (childElements.hasNext()) {
-                Node node = (Node)childElements.next();
-                childCount++;
-            }
-            assertEquals(childCount, 2);
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
-    }
-
-    //TODO : check why this is failing
-    public void _testGetChildElements2() {
-        try {
-            MessageFactory fact = MessageFactory.newInstance();
-            SOAPMessage message = fact.createMessage();
-            SOAPPart soapPart = message.getSOAPPart();
-            SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
-            SOAPBody soapBody = soapEnvelope.getBody();
-
-            Name name = soapEnvelope.createName("MyChild1");
-            SOAPElement se = soapBody.addChildElement(name);
-            Iterator childElementsCount = soapBody.getChildElements();
-            Iterator childElements = soapBody.getChildElements();
-
-            int childCount = 0;
-            while (childElementsCount.hasNext()) {
-                Node node = (Node)childElementsCount.next();
-                childCount++;
-            }
-            assertEquals(childCount, 1);
-            SOAPElement se2 = (SOAPElement)childElements.next();
-            if (!se.equals(se2)) {
-                fail();
-            } else {
-                System.out.println("SOAPElement se = se2 (expected)");
-            }
+    public void _testGetChildElements() throws Exception {
+        SOAPElement childEle1 =
+                SOAPFactoryImpl.newInstance().createElement("Child1",
+                                                            "ch",
+                                                            "http://test.apache.org/");
+        SOAPElement childEle2 =
+                SOAPFactoryImpl.newInstance().createElement("Child2",
+                                                            "ch",
+                                                            "http://test.apache.org/");
+        childEle1.addChildElement(childEle2);
+        soapEle.addChildElement(childEle1);
 
-            Name n = se.getElementName();
-            assertEquals(n, name);
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
-        }
-    }
+        QName qname = new QName("http://test.apache.org/", "Child1", "ch");
+        Iterator childElements = soapEle.getChildElements(qname);
 
-    public void testGetChildElements3() {
-        try {
-            MessageFactory fact = MessageFactory.newInstance();
-            SOAPMessage message = fact.createMessage();
-            SOAPPart soapPart = message.getSOAPPart();
-            SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
-            SOAPBody soapBody = soapEnvelope.getBody();
-
-            //Name name = soapEnvelope.createName("MyChild1");
-            QName name = new QName("MyChild1");
-            SOAPElement se = soapBody.addChildElement(name);
-            Iterator childElementsCount = soapBody.getChildElements();
-            Iterator childElements = soapBody.getChildElements();
-
-            int childCount = 0;
-            while (childElementsCount.hasNext()) {
-                Node node = (Node)childElementsCount.next();
-                childCount++;
-            }
-            assertEquals(childCount, 1);
-            SOAPElement se2 = (SOAPElement)childElements.next();
-            assertEquals(se, se2);
 
-            QName n = se.getElementQName();
-            assertEquals(n, name);
-        } catch (SOAPException e) {
-            fail("Unexpected Exception " + e);
+        int childCount = 0;
+        while (childElements.hasNext()) {
+            Node node = (Node)childElements.next();
+            childCount++;
         }
+        assertEquals(childCount, 2);
     }
 
-    public void _testRemoveAttribute2() {
-        try {
-            QName qname = new QName("http://child1.apache.org/", "Child1", "ch");
-            String value = "MyValue1";
-            soapEle.addAttribute(qname, value);
-            boolean b = soapEle.removeAttribute(qname);
-            assertTrue("removeAttribute() did not return true", b);
-            b = soapEle.removeAttribute(qname);
-            assertFalse("removeAttribute() did not return false", b);
-            assertNull(soapEle.getAttributeValue(qname));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Exception: " + e);
+    @Validated @Test
+    public void testGetChildElements2() throws Exception {
+        MessageFactory fact = MessageFactory.newInstance();
+        SOAPMessage message = fact.createMessage();
+        SOAPPart soapPart = message.getSOAPPart();
+        SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
+        SOAPBody soapBody = soapEnvelope.getBody();
+
+        Name name = soapEnvelope.createName("MyChild1");
+        SOAPElement se = soapBody.addChildElement(name);
+        Iterator childElementsCount = soapBody.getChildElements();
+        Iterator childElements = soapBody.getChildElements();
+
+        int childCount = 0;
+        while (childElementsCount.hasNext()) {
+            Node node = (Node)childElementsCount.next();
+            childCount++;
+        }
+        assertEquals(childCount, 1);
+        SOAPElement se2 = (SOAPElement)childElements.next();
+        if (!se.equals(se2)) {
+            fail();
+        } else {
+            System.out.println("SOAPElement se = se2 (expected)");
         }
+
+        Name n = se.getElementName();
+        assertEquals(n, name);
     }
 
-    public void _testSetElementQName() {
-        try {
-            QName qname = new QName("http://child1.apache.org/", "newName", "ch");
-            soapEle.setElementQName(qname);
-            assertNull(soapEle.getElementName().getLocalName(), "newName");
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Exception: " + e);
-        }
+    @Validated @Test
+    public void testGetChildElements3() throws Exception {
+        MessageFactory fact = MessageFactory.newInstance();
+        SOAPMessage message = fact.createMessage();
+        SOAPPart soapPart = message.getSOAPPart();
+        SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
+        SOAPBody soapBody = soapEnvelope.getBody();
+
+        //Name name = soapEnvelope.createName("MyChild1");
+        QName name = new QName("MyChild1");
+        SOAPElement se = soapBody.addChildElement(name);
+        Iterator childElementsCount = soapBody.getChildElements();
+        Iterator childElements = soapBody.getChildElements();
+
+        int childCount = 0;
+        while (childElementsCount.hasNext()) {
+            Node node = (Node)childElementsCount.next();
+            childCount++;
+        }
+        assertEquals(childCount, 1);
+        SOAPElement se2 = (SOAPElement)childElements.next();
+        assertEquals(se, se2);
+
+        QName n = se.getElementQName();
+        assertEquals(n, name);
+    }
+
+    @Validated @Test
+    public void testRemoveAttribute3() throws Exception {
+        QName qname = new QName("http://child1.apache.org/", "Child1", "ch");
+        String value = "MyValue1";
+        soapEle.addAttribute(qname, value);
+        boolean b = soapEle.removeAttribute(qname);
+        assertTrue("removeAttribute() did not return true", b);
+        b = soapEle.removeAttribute(qname);
+        assertFalse("removeAttribute() did not return false", b);
+        assertNull(soapEle.getAttributeValue(qname));
+    }
+
+    public void _testSetElementQName() throws Exception {
+        QName qname = new QName("http://child1.apache.org/", "newName", "ch");
+        soapEle.setElementQName(qname);
+        assertNull(soapEle.getElementName().getLocalName(), "newName");
     }
 
-    public void _testCreateQName() {
+    public void _testCreateQName() throws Exception {
         String prefix = "";
-        try {
-            //SOAPMessage message = MessageFactory.newInstance().createMessage();
-            SOAPMessage message =
-                    MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
-            SOAPPart soapPart = message.getSOAPPart();
-            SOAPEnvelope envelope = soapPart.getEnvelope();
-            SOAPBody body = envelope.getBody();
-
-            QName qname = envelope.createQName("qname", prefix);
-            String tprefix = qname.getPrefix();
-            String turi = qname.getNamespaceURI();
-            String tname = qname.getLocalPart();
-            if (!tprefix.equals(prefix) || !turi.equals(envelope.getElementName().getURI())) {
-                fail("createQName() did not create correct qname\n" +
-                        "expected: <uri=" + envelope.getElementName().getURI() +
-                        ", prefix=" + prefix + ", localpart=qname>\n" +
-                        "got:      <uri=" + turi +
-                        ", prefix=" + tprefix + ", localpart=" + tname + ">");
-            }
-            qname = body.createQName("qname", body.getElementName().getPrefix());
-            tprefix = qname.getPrefix();
-            turi = qname.getNamespaceURI();
-            tname = qname.getLocalPart();
-            if (!tprefix.equals(body.getElementName().getPrefix()) ||
-                    !turi.equals(body.getElementName().getURI())) {
-                fail("createQName() did not create correct qname\n" +
-                        "expected: <uri=" + body.getElementName().getURI() +
-                        ", prefix=" + body.getElementName().getPrefix() + ", localpart=qname>\n" +
-                        "got:      <uri=" + turi +
-                        ", prefix=" + tprefix + ", localpart=" + tname + ">");
-            }
-        } catch (Exception e) {
-            fail("Failed " + e);
+        //SOAPMessage message = MessageFactory.newInstance().createMessage();
+        SOAPMessage message =
+                MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
+        SOAPPart soapPart = message.getSOAPPart();
+        SOAPEnvelope envelope = soapPart.getEnvelope();
+        SOAPBody body = envelope.getBody();
+
+        QName qname = envelope.createQName("qname", prefix);
+        String tprefix = qname.getPrefix();
+        String turi = qname.getNamespaceURI();
+        String tname = qname.getLocalPart();
+        if (!tprefix.equals(prefix) || !turi.equals(envelope.getElementName().getURI())) {
+            fail("createQName() did not create correct qname\n" +
+                    "expected: <uri=" + envelope.getElementName().getURI() +
+                    ", prefix=" + prefix + ", localpart=qname>\n" +
+                    "got:      <uri=" + turi +
+                    ", prefix=" + tprefix + ", localpart=" + tname + ">");
+        }
+        qname = body.createQName("qname", body.getElementName().getPrefix());
+        tprefix = qname.getPrefix();
+        turi = qname.getNamespaceURI();
+        tname = qname.getLocalPart();
+        if (!tprefix.equals(body.getElementName().getPrefix()) ||
+                !turi.equals(body.getElementName().getURI())) {
+            fail("createQName() did not create correct qname\n" +
+                    "expected: <uri=" + body.getElementName().getURI() +
+                    ", prefix=" + body.getElementName().getPrefix() + ", localpart=qname>\n" +
+                    "got:      <uri=" + turi +
+                    ", prefix=" + tprefix + ", localpart=" + tname + ">");
         }
     }
 
-    public void testRemoveContent() {
-        boolean pass = true;
-        try {
-            MessageFactory factory = MessageFactory.newInstance();
-            SOAPMessage message = factory.createMessage();
-            SOAPPart soapPart = message.getSOAPPart();
-            SOAPEnvelope envelope = soapPart.getEnvelope();
-            SOAPBody body = envelope.getBody();
-
-            Name name = envelope.createName("MyChild");
-            SOAPElement se = body.addChildElement(name);
-            assertNotNull(se);
-            Iterator childs = body.getChildElements(name);
-            int childElementCount = 0;
-            for (int a = 0; childs.hasNext(); a++) {
-                childs.next();
-                childElementCount++;
-            }
-            childs = body.getChildElements(name);
-            assertEquals(childElementCount, 1);
-
-            Name n = se.getElementName();
-            assertEquals(n, name);
-            //Child addition verified, now call removeContents to delete it
-            se.removeContents();
-            childs = se.getChildElements();
-            childElementCount = 0;
-            for (int a = 0; childs.hasNext(); a++) {
-                childs.next();
-                childElementCount++;
-            }
-            assertEquals(childElementCount, 0);
-        } catch (Exception e) {
-            fail();
-        }
+    @Validated @Test(expected=SOAPException.class)
+    public void testCreateQNameWithUnknownPrefix() throws Exception {
+        soapEle.createQName("local", "nonexistingprefix");
+    }
+
+    @Validated @Test
+    public void testCreateQNameWithAddNamespaceDeclaration() throws Exception {
+        soapEle.addNamespaceDeclaration("p", "urn:test");
+        QName qname = soapEle.createQName("local", "p");
+        assertEquals("p", qname.getPrefix());
+        assertEquals("local", qname.getLocalPart());
+        assertEquals("urn:test", qname.getNamespaceURI());
     }
 
+    @Validated @Test
+    public void testRemoveContent() throws Exception {
+        boolean pass = true;
+        MessageFactory factory = MessageFactory.newInstance();
+        SOAPMessage message = factory.createMessage();
+        SOAPPart soapPart = message.getSOAPPart();
+        SOAPEnvelope envelope = soapPart.getEnvelope();
+        SOAPBody body = envelope.getBody();
+
+        Name name = envelope.createName("MyChild");
+        SOAPElement se = body.addChildElement(name);
+        assertNotNull(se);
+        Iterator childs = body.getChildElements(name);
+        int childElementCount = 0;
+        for (int a = 0; childs.hasNext(); a++) {
+            childs.next();
+            childElementCount++;
+        }
+        childs = body.getChildElements(name);
+        assertEquals(childElementCount, 1);
+
+        Name n = se.getElementName();
+        assertEquals(n, name);
+        //Child addition verified, now call removeContents to delete it
+        se.removeContents();
+        childs = se.getChildElements();
+        childElementCount = 0;
+        for (int a = 0; childs.hasNext(); a++) {
+            childs.next();
+            childElementCount++;
+        }
+        assertEquals(childElementCount, 0);
+    }
+
+    @Validated @Test
+    public void testSetElementQName() throws Exception {
+        MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+        SOAPMessage message = factory.createMessage();
+        SOAPPart soapPart = message.getSOAPPart();
+        SOAPEnvelope envelope = soapPart.getEnvelope();
+        SOAPBody body = envelope.getBody();
+
+        QName qname1 = new QName("http://fooURI.com", "fooElement", "foo");
+        QName qname2 = new QName("http://foo2URI.com", "fooElement2", "foo2");
+        SOAPElement se = body.addChildElement(qname1);
+        QName qname = se.getElementQName();
+        se = se.setElementQName(qname2);
+        qname = se.getElementQName();
+
+        if (!qname.getNamespaceURI().equals(qname2.getNamespaceURI()) ||
+                !qname.getLocalPart().equals(qname2.getLocalPart()) ||
+                !qname.getPrefix().equals(qname2.getPrefix())) {
+            System.out.println("setElementQName() did not reset " +
+                    "element qname\nexpected: <URI=" + qname2.getNamespaceURI() +
+                    ", prefix=" + qname2.getPrefix() + ", localpart=" + qname2.getLocalPart() +
+                    ">\ngot:      <URI=" + qname.getNamespaceURI() + ", prefix=" +
+                    qname.getPrefix() +
+                    ", localpart=" + qname.getLocalPart() + ">");
+        }
+    }
+
+    @Validated @Test
+    public void testSetElementQName2() throws Exception {
+        MessageFactory factory = MessageFactory.newInstance();
+        SOAPMessage message = factory.createMessage();
+        SOAPPart soapPart = message.getSOAPPart();
+        SOAPEnvelope envelope = soapPart.getEnvelope();
+        SOAPBody body = envelope.getBody();
+        SOAPHeader header = envelope.getHeader();
 
-    public void testSetElementQName() {
+        QName qname = new QName("qname");
+        //Try and change element name of SOAPEnvelope (expect SOAPException)
         try {
-            MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
-            SOAPMessage message = factory.createMessage();
-            SOAPPart soapPart = message.getSOAPPart();
-            SOAPEnvelope envelope = soapPart.getEnvelope();
-            SOAPBody body = envelope.getBody();
-
-            QName qname1 = new QName("http://fooURI.com", "fooElement", "foo");
-            QName qname2 = new QName("http://foo2URI.com", "fooElement2", "foo2");
-            SOAPElement se = body.addChildElement(qname1);
-            QName qname = se.getElementQName();
-            se = se.setElementQName(qname2);
-            qname = se.getElementQName();
-
-            if (!qname.getNamespaceURI().equals(qname2.getNamespaceURI()) ||
-                    !qname.getLocalPart().equals(qname2.getLocalPart()) ||
-                    !qname.getPrefix().equals(qname2.getPrefix())) {
-                System.out.println("setElementQName() did not reset " +
-                        "element qname\nexpected: <URI=" + qname2.getNamespaceURI() +
-                        ", prefix=" + qname2.getPrefix() + ", localpart=" + qname2.getLocalPart() +
-                        ">\ngot:      <URI=" + qname.getNamespaceURI() + ", prefix=" +
-                        qname.getPrefix() +
-                        ", localpart=" + qname.getLocalPart() + ">");
-            }
-        } catch (Exception e) {
-            fail("Error :" + e);
+            envelope.setElementQName(qname);
+            fail("Did not throw expected SOAPException");
+        } catch (SOAPException e) {
+            //Caught expected SOAPException
         }
-    }
 
-    public void testSetElementQName2() {
+        //Try and change element name of SOAPHeader (expect SOAPException)
         try {
-            MessageFactory factory = MessageFactory.newInstance();
-            SOAPMessage message = factory.createMessage();
-            SOAPPart soapPart = message.getSOAPPart();
-            SOAPEnvelope envelope = soapPart.getEnvelope();
-            SOAPBody body = envelope.getBody();
-            SOAPHeader header = envelope.getHeader();
-
-            QName qname = new QName("qname");
-            //Try and change element name of SOAPEnvelope (expect SOAPException)
-            try {
-                envelope.setElementQName(qname);
-                fail("Did not throw expected SOAPException");
-            } catch (SOAPException e) {
-                //Caught expected SOAPException
-            }
-
-            //Try and change element name of SOAPHeader (expect SOAPException)
-            try {
-                header.setElementQName(qname);
-                fail("Did not throw expected SOAPException");
-            } catch (SOAPException e) {
-                //Caught expected SOAPException
-            }
+            header.setElementQName(qname);
+            fail("Did not throw expected SOAPException");
+        } catch (SOAPException e) {
+            //Caught expected SOAPException
+        }
 
-            //Try and change element name of SOAPBody (expect SOAPException)
-            try {
-                body.setElementQName(qname);
-                fail("Did not throw expected SOAPException");
-            } catch (SOAPException e) {
-                //Caught expected SOAPException
-            }
-        } catch (Exception e) {
-            fail("Error : " + e);
+        //Try and change element name of SOAPBody (expect SOAPException)
+        try {
+            body.setElementQName(qname);
+            fail("Did not throw expected SOAPException");
+        } catch (SOAPException e) {
+            //Caught expected SOAPException
         }
     }
     
+    @Validated @Test
     public void testAppendChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();
@@ -820,6 +751,7 @@ public class SOAPElementTest extends Tes
         assertFalse(iter.hasNext());               
     }
     
+    @Validated @Test
     public void testRemoveChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java Sat Oct 30 21:56:49 2010
@@ -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;
@@ -49,7 +49,9 @@ import javax.xml.transform.dom.DOMResult
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
 
-import org.w3c.dom.Comment;  
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.w3c.dom.Comment;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.InputSource; 
@@ -58,7 +60,8 @@ import java.io.ByteArrayInputStream;
 import java.io.StringReader;
 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" +
@@ -79,10 +82,7 @@ public class SOAPEnvelopeTest extends Te
     
     private static final String XML_INPUT_1 = "<root><a><!-- this is a test with a comment node --></a></root>";
 
-    public SOAPEnvelopeTest(String name) {
-        super(name);
-    }
-
+    @Validated @Test
     public void testEnvelope() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage smsg =
@@ -97,6 +97,7 @@ public class SOAPEnvelopeTest extends Te
         validateBody(body.getChildElements());
     }
 
+    @Validated @Test
     public void testDetachHeader() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage smsg =
@@ -112,6 +113,7 @@ public class SOAPEnvelopeTest extends Te
         assertNull(smsg.getSOAPHeader());
     }
 
+    @Validated @Test
     public void testDetachBody() {
         try {
             MessageFactory mf = MessageFactory.newInstance();
@@ -142,6 +144,7 @@ public class SOAPEnvelopeTest extends Te
         }
     }
 
+    @Validated @Test
     public void testEnvelope2() throws Exception {
         MessageFactory mf = MessageFactory.newInstance();
         final ByteArrayInputStream baIS = new ByteArrayInputStream(XML_STRING.getBytes());
@@ -177,6 +180,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(envelope.getBody() != null);
     }
 
+    @Validated @Test
     public void testEnvelopeWithCommentInEnvelope() throws Exception {
 
         String soapMessageWithLeadingComment =
@@ -203,6 +207,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(envelope.getBody() != null);
     }
 
+    @Validated @Test
     public void testEnvelopeWithCommentInBody() throws Exception {
 
         String soapMessageWithLeadingComment =
@@ -228,6 +233,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(envelope.getBody() != null);
     }
 
+    @Validated @Test
     public void testEnvelopeWithComments() throws Exception {
 
         String soapMessageWithLeadingComment =
@@ -299,6 +305,7 @@ public class SOAPEnvelopeTest extends Te
         }
     }
 
+    @Validated @Test
     public void testHeaderElements() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPHeader header = envelope.getHeader();
@@ -323,6 +330,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(!iterator.hasNext());
     }
 
+    @Validated @Test
     public void testText() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -341,6 +349,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(count == countStart + 1);
     }
 
+    @Validated @Test
     public void testNonCommentText() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -359,6 +368,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(!t.isComment());
     }
 
+    @Validated @Test
     public void testCommentText() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -377,6 +387,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(t.isComment());
     }
 
+    @Validated @Test
     public void testAttributes() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -417,6 +428,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(foundName1 && foundName2 && foundName3);
     }
 
+    @Validated @Test
     public void testAttributes2() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -457,6 +469,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(foundName1 && foundName2 && foundName3);
     }
 
+    @Validated @Test
     public void testAttributes3() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         SOAPBody body = envelope.getBody();
@@ -497,6 +510,7 @@ public class SOAPEnvelopeTest extends Te
         assertTrue(foundName1 && foundName2 && foundName3);
     }
 
+    @Validated @Test
     public void testAddHeader() {
         try {
             SOAPEnvelope envelope = getSOAPEnvelope();
@@ -560,6 +574,7 @@ public class SOAPEnvelopeTest extends Te
         }
     }
 
+    @Validated @Test
     public void testSetEncodingStyle() throws Exception {
         SOAPEnvelope envelope = getSOAPEnvelope();
         envelope.setEncodingStyle("http://example.com/MyEncodings");
@@ -567,6 +582,7 @@ public class SOAPEnvelopeTest extends Te
         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();
@@ -585,6 +601,7 @@ public class SOAPEnvelopeTest extends Te
         }
     }
     
+    @Validated @Test
     public void testTransform() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java Sat Oct 30 21:56:49 2010
@@ -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 @@ import java.util.Iterator;
 /**
  * 
  */
-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 @@ public class SOAPFactoryTest extends Tes
         }
     }
 
+    @Validated @Test
     public void testCreateElement() {
         try {
             //SOAPFactory sf = SOAPFactory.newInstance();
@@ -93,7 +98,7 @@ public class SOAPFactoryTest extends Tes
         }
     }
 
-
+    @Validated @Test
     public void testCreateElement2() {
         try {
             SOAPFactory sf = SOAPFactory.newInstance();
@@ -121,6 +126,7 @@ public class SOAPFactoryTest extends Tes
         }
     }
 
+    @Validated @Test
     public void testCreateElement3() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance();
@@ -138,6 +144,7 @@ public class SOAPFactoryTest extends Tes
         }
     }
 
+    @Validated @Test
     public void testCreateElement4() {
         try {
             SOAPFactory sf = SOAPFactory.newInstance();
@@ -164,6 +171,7 @@ public class SOAPFactoryTest extends Tes
         }
     }
 
+    @Validated @Test
     public void testCreateFault() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -190,6 +198,8 @@ public class SOAPFactoryTest extends Tes
         }
     }
 
+    // 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 @@ public class SOAPFactoryTest extends Tes
     }
 
     /** for soap 1.1 */
+    @Validated @Test
     public void testSOAPFaultException1() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -234,6 +245,7 @@ public class SOAPFactoryTest extends Tes
     }
 
     /** for soap 1.2 */
+    @Validated @Test
     public void testSOAPFaultException2() {
         try {
             SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java Sat Oct 30 21:56:49 2010
@@ -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.MimeHeaders;
 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 @@ public class SOAPFaultDetailTest extends
                     " </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: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java Sat Oct 30 21:56:49 2010
@@ -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.SOAPHeader;
 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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         assertTrue(xml.indexOf("Hello") != -1);
     }
 
+    @Validated @Test
     public void testFaults() throws Exception {
         MessageFactory messageFactory = MessageFactory.newInstance();
         SOAPFactory soapFactory = SOAPFactory.newInstance();
@@ -250,6 +252,7 @@ public class SOAPFaultTest extends TestC
         }
     }
 
+    @Validated @Test
     public void testGetFaultActor() throws Exception {
         SOAPMessage msg = MessageFactory.newInstance().createMessage();
         SOAPFault sf = msg.getSOAPBody().addFault();
@@ -262,6 +265,7 @@ public class SOAPFaultTest extends TestC
         }
     }
 
+    @Validated @Test
     public void testGetFaultString() throws Exception {
         SOAPMessage msg = MessageFactory.newInstance().createMessage();
         SOAPFault sf = msg.getSOAPBody().addFault();
@@ -275,6 +279,7 @@ public class SOAPFaultTest extends TestC
         }
     }
 
+    @Validated @Test
     public void testAppendSubCode() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -298,6 +303,7 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         }
     }
 
-
+    @Validated @Test
     public void testAddFaultReasonText4() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         SOAPMessage soapMessage = fac.createMessage();
@@ -491,7 +499,7 @@ public class SOAPFaultTest extends TestC
         }
     }
 
-
+    @Validated @Test
     public void testSetFaultRole() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
 
@@ -506,6 +514,7 @@ public class SOAPFaultTest extends TestC
         soapMessage.saveChanges();
     }
 
+    @Validated @Test
     public void testSetFaultNode() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
 
@@ -561,6 +570,7 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         }
     }
 
+    @Validated @Test
     public void testFaultStringLocale() throws Exception {
         MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         //MessageFactory fac = MessageFactory.newInstance();
@@ -660,7 +672,7 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         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 @@ public class SOAPFaultTest extends TestC
         assertNotNull(fault.getFaultString());
     }
 
+    @Validated @Test
     public void testFault11Defaults() throws Exception {
         MessageFactory messageFactory = MessageFactory.newInstance();
         SOAPMessage message = messageFactory.createMessage();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java Sat Oct 30 21:56:49 2010
@@ -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.SOAPMessage;
 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 @@ public class SOAPHeaderTest extends Test
     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 @@ public class SOAPHeaderTest extends Test
         assertEquals(3, numOfHeaderElements);
     }
 
+    @Validated @Test
     public void testHeaders() {
         try {
             // Create message factory and SOAP factory
@@ -186,13 +188,15 @@ public class SOAPHeaderTest extends Test
         }
     }
 
-    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 @@ public class SOAPHeaderTest extends Test
         }
     }
 
+    @Validated @Test
     public void testAddNotUnderstoodHeaderElement() throws Exception {
         javax.xml.soap.SOAPMessage soapMessage =
                 javax.xml.soap.MessageFactory.newInstance(
@@ -245,6 +250,7 @@ public class SOAPHeaderTest extends Test
     }
 
 
+    @Validated @Test
     public void testAddUpgradeHeaderElement() throws Exception {
         javax.xml.soap.SOAPMessage soapMessage =
                 javax.xml.soap.MessageFactory.newInstance(
@@ -270,6 +276,7 @@ public class SOAPHeaderTest extends Test
         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 @@ public class SOAPHeaderTest extends Test
         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 @@ public class SOAPHeaderTest extends Test
         }
     }
 
+    @Validated @Test
     public void testQNamesOnHeader() {
         SOAPHeaderElement headerElement = null;
         try {
@@ -367,6 +375,7 @@ public class SOAPHeaderTest extends Test
         }
     }
     
+    @Validated @Test
     public void testAppendChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java Sat Oct 30 21:56:49 2010
@@ -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 @@ import java.util.Iterator;
 /**
  * 
  */
-public class SOAPMessageTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPMessageTest extends Assert {
     private SOAPMessage msg;
 
 //    static int port;
@@ -88,7 +92,8 @@ public class SOAPMessageTest extends Tes
 //        };
 //    }
 
-    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 @@ public class SOAPMessageTest extends Tes
 //        UtilServer.unDeployClientService();
 //    }
 
+    @Validated @Test
     public void testSaveRequired() {
         try {
             assertTrue("Save Required is False", msg.saveRequired());
@@ -109,6 +115,7 @@ public class SOAPMessageTest extends Tes
         }
     }
 
+    @Validated @Test
     public void testSaveRequired2() {
         try {
             msg.saveChanges();
@@ -118,7 +125,7 @@ public class SOAPMessageTest extends Tes
         }
     }
 
-
+    @Validated @Test
     public void testRemoveAttachements() {
         Iterator iterator = null;
         AttachmentPart ap1 = null;
@@ -183,7 +190,8 @@ public class SOAPMessageTest extends Tes
         }
     }
 
-
+    // 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: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java Sat Oct 30 21:56:49 2010
@@ -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: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java Sat Oct 30 21:56:49 2010
@@ -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,45 +46,42 @@ import java.util.Iterator;
 /**
  * 
  */
-public class SOAPPartTest extends TestCase {
-
-    public void testAddSource() {
-        DOMSource domSource;
-        try {
-            /*
-            FileReader testFile = new FileReader(new File(System.getProperty("basedir",".")+"/test-resources" + File.separator + "soap-part.xml"));
-            StAXOMBuilder stAXOMBuilder =
-                    OMXMLBuilderFactory.createStAXOMBuilder(
-                            OMAbstractFactory.getSOAP11Factory(),
-                            XMLInputFactory.newInstance().createXMLStreamReader(
-                                    testFile));
-            */
-
-            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-            Document document = builder.parse(new File(System.getProperty("basedir", ".") +
-                    "/test-resources" + File.separator + "soap-part.xml"));
-            domSource = new DOMSource(document);
-
-            SOAPMessage message = MessageFactory.newInstance().createMessage();
-
-            // Get the SOAP part and set its content to domSource
-            SOAPPart soapPart = message.getSOAPPart();
-            soapPart.setContent(domSource);
-            message.saveChanges();
-
-            SOAPHeader header = message.getSOAPHeader();
-            if (header != null) {
-                Iterator iter1 = header.getChildElements();
-                getContents(iter1, "");
-            }
-
-            SOAPBody body = message.getSOAPBody();
-            Iterator iter2 = body.getChildElements();
-            getContents(iter2, "");
-
-        } catch (Exception e) {
-            fail("Unexpected Exception : " + e);
+@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"));
+        StAXOMBuilder stAXOMBuilder =
+                OMXMLBuilderFactory.createStAXOMBuilder(
+                        OMAbstractFactory.getSOAP11Factory(),
+                        XMLInputFactory.newInstance().createXMLStreamReader(
+                                testFile));
+        */
+
+        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);
+
+        SOAPMessage message = MessageFactory.newInstance().createMessage();
+
+        // Get the SOAP part and set its content to domSource
+        SOAPPart soapPart = message.getSOAPPart();
+        soapPart.setContent(domSource);
+        message.saveChanges();
+
+        SOAPHeader header = message.getSOAPHeader();
+        if (header != null) {
+            Iterator iter1 = header.getChildElements();
+            getContents(iter1, "");
         }
+
+        SOAPBody body = message.getSOAPBody();
+        Iterator iter2 = body.getChildElements();
+        getContents(iter2, "");
     }
 
     public void getContents(Iterator iterator, String indent) {
@@ -113,7 +112,7 @@ public class SOAPPartTest extends TestCa
         }
     }
 
-
+    @Validated @Test
     public void testAddSource2() throws Exception {
         SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
         SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
@@ -137,6 +136,7 @@ public class SOAPPartTest extends TestCa
         assertNotNull(soapMessage2);
     }
 
+    @Validated @Test
     public void testAddSource3() throws Exception {
         SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
         SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
@@ -161,33 +161,30 @@ public class SOAPPartTest extends TestCa
     }
 
 
-    public void _testInputEncoding() {
-        try {
-            DOMSource domSource;
-            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-            Document document = builder.parse(new File(System.getProperty("basedir", ".") +
-                    "/test-resources" + File.separator + "soap-part.xml"));
-            domSource = new DOMSource(document);
-
-            SOAPMessage message = MessageFactory.newInstance().createMessage();
-
-            // Get the SOAP part and set its content to domSource
-            SOAPPart soapPart = message.getSOAPPart();
-            soapPart.setContent(domSource);
-            message.saveChanges();
+    public void _testInputEncoding() throws Exception {
+        DOMSource domSource;
+        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        Document document = builder.parse(new File(System.getProperty("basedir", ".") +
+                "/test-resources" + File.separator + "soap-part.xml"));
+        domSource = new DOMSource(document);
+
+        SOAPMessage message = MessageFactory.newInstance().createMessage();
+
+        // Get the SOAP part and set its content to domSource
+        SOAPPart soapPart = message.getSOAPPart();
+        soapPart.setContent(domSource);
+        message.saveChanges();
 
-            SOAPPart sp = message.getSOAPPart();
+        SOAPPart sp = message.getSOAPPart();
 
 //            String inputEncoding = sp.getInputEncoding();
 //            assertNotNull(inputEncoding);
-        } catch (Exception e) {
-            fail("Unexpected Exception " + e);
-        }
     }
     
     /**
      * Check parent processing of SOAPMessage
      */
+    @Validated @Test
     public void test_parentAccess1() throws Exception {
 
         MessageFactory mf = MessageFactory.newInstance();
@@ -203,6 +200,8 @@ public class SOAPPartTest extends TestCa
     /**
      * 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();
@@ -221,6 +220,7 @@ public class SOAPPartTest extends TestCa
     /**
      * Check parent processing of SOAPMessage
      */
+    @Validated @Test
     public void test_parentAccess3() throws Exception {
 
         SOAP11Factory axiomSF = new SOAP11Factory();
@@ -241,6 +241,8 @@ public class SOAPPartTest extends TestCa
         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();
@@ -257,6 +259,8 @@ public class SOAPPartTest extends TestCa
         }             
     }
     
+    // TODO: check why this fails with Sun's SAAJ implementation
+    @Test
     public void testRemoveChild1() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();
@@ -269,6 +273,8 @@ public class SOAPPartTest extends TestCa
         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: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TextTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TextTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TextTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TextTest.java Sat Oct 30 21:56:49 2010
@@ -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.Comment;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -37,13 +41,10 @@ import javax.xml.soap.Text;
 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();
@@ -150,6 +151,7 @@ public class TextTest extends TestCase {
         //System.out.flush();
     }
 
+    @Validated @Test
     public void testComment() throws SOAPException, IOException {
 
         String xmlString = "<?xml version='1.0' encoding='utf-8'?> " +



Mime
View raw message