You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/12/14 21:51:53 UTC

svn commit: r726530 - in /webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om: ./ impl/dom/

Author: veithen
Date: Sun Dec 14 12:51:53 2008
New Revision: 726530

URL: http://svn.apache.org/viewvc?rev=726530&view=rev
Log:
Some code cleanup in DOM tests (no functional changes):
* Removed unnecessary constructors.
* Avoid using TestCase#fail in case of an exception. Instead just let JUnit intercept the exception.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java Sun Dec 14 12:51:53 2008
@@ -42,6 +42,10 @@
     /** Basedir for all file I/O. Important when running tests from the reactor. */
     public String basedir = System.getProperty("basedir");
 
+    public AbstractTestCase() {
+        this(null);
+    }
+    
     /** @param testName  */
     public AbstractTestCase(String testName) {
         super(testName);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java Sun Dec 14 12:51:53 2008
@@ -35,137 +35,113 @@
 
 /** This test will test the conversion of a LLOM soap envelope to DOOM */
 public class ConvertLLOMToDOOMTest extends TestCase {
+    public void testConvert() throws Exception {
+        String origXML = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+                "   <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n" +
+                "      <soapenv:Header>\n" +
+                "         <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soapenv:mustUnderstand=\"1\">\n" +
+                "            <ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" Id=\"Signature-6426875\">\n" +
+                "               <ds:SignedInfo>\n" +
+                "                  <ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" />\n" +
+                "                  <ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" />\n" +
+                "                  <ds:Reference URI=\"#id-3083604\">\n" +
+                "                     <ds:Transforms>\n" +
+                "                        <ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" />\n" +
+                "                     </ds:Transforms>\n" +
+                "                     <ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\n" +
+                "                     <ds:DigestValue>lDeZJk0/r6u4tOOhOKbN0IEvwi0=</ds:DigestValue>\n" +
+                "                  </ds:Reference>\n" +
+                "               </ds:SignedInfo>\n" +
+                "               <ds:SignatureValue>KhUeWMoUxUFe5jeTlqLdIEIG2Z7Q2q2mh9HT3IAYwbCev+FzXcuLSiPSsb7/+PSDM2SD0gl9tMp+dHjfPxmq7WiduH9mbnP6gkrxxu0T5rR916WsboshJGJKiPlj71bwpMsrrZohx4evHPdQ2SZHthlNb6jZyjq+LS7qFydppHk=</ds:SignatureValue>\n" +
+                "               <ds:KeyInfo Id=\"KeyId-2529687\">\n" +
+                "                  <wsse:SecurityTokenReference xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"STRId-31966667\">\n" +
+                "                     <ds:X509Data>\n" +
+                "                        <ds:X509IssuerSerial>\n" +
+                "                           <ds:X509IssuerName>CN=OASIS Interop Test CA,O=OASIS</ds:X509IssuerName>\n" +
+                "                           <ds:X509SerialNumber>68652640310044618358965661752471103641</ds:X509SerialNumber>\n" +
+                "                        </ds:X509IssuerSerial>\n" +
+                "                     </ds:X509Data>\n" +
+                "                  </wsse:SecurityTokenReference>\n" +
+                "               </ds:KeyInfo>\n" +
+                "            </ds:Signature>\n" +
+                "            <wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"Timestamp-13986615\">\n" +
+                "               <wsu:Created>2006-03-31T15:34:38.699Z</wsu:Created>\n" +
+                "               <wsu:Expires>2006-03-31T15:39:38.699Z</wsu:Expires>\n" +
+                "            </wsu:Timestamp>\n" +
+                "         </wsse:Security>\n" +
+                "         <wsa:To xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://localhost:9080/axis2/services/Service</wsa:To>\n" +
+                "         <wsa:ReplyTo xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n" +
+                "            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>\n" +
+                "         </wsa:ReplyTo>\n" +
+                "         <wsa:MessageID xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">urn:uuid:049875A6E153FCAAF011438192785862</wsa:MessageID>\n" +
+                "         <wsa:Action xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</wsa:Action>\n" +
+                "      </soapenv:Header>\n" +
+                "      <soapenv:Body xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"id-3083604\">\n" +
+                "         <RequestSecurityToken xmlns=\"http://schemas.xmlsoap.org/ws/2005/02/trust\" Context=\"http://get.optional.attrs.working\">\n" +
+                "            <TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</TokenType>\n" +
+                "            <RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</RequestType>\n" +
+                "         </RequestSecurityToken>\n" +
+                "      </soapenv:Body>\n" +
+                "   </soapenv:Envelope>";
+
+        XMLStreamReader reader = XMLInputFactory.newInstance()
+                .createXMLStreamReader(new ByteArrayInputStream(origXML.getBytes()));
+        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, null);
+
+        SOAPEnvelope env = builder.getSOAPEnvelope();
+
+        env.build();
+
+        StAXSOAPModelBuilder doomBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(),
+                                                                    DOOMAbstractFactory.getSOAP11Factory(),
+                                                                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+        SOAPEnvelope doomEnv = doomBuilder.getSOAPEnvelope();
+
+        doomEnv.build();
+
+        OMElement payload = doomEnv.getBody().getFirstElement();
+
+        StAXOMBuilder llomBuilder =
+                new StAXOMBuilder(payload.getXMLStreamReaderWithoutCaching());
 
-    public ConvertLLOMToDOOMTest(String arg0) {
-        super(arg0);
-    }
+        OMElement llomPayload = llomBuilder.getDocumentElement();
+
+        llomPayload.build();
+
+        String xml = llomPayload.toString();
 
-    public void testConvert() {
-        try {
-            String origXML = "<?xml version='1.0' encoding='UTF-8'?>\n" +
-                    "   <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n" +
-                    "      <soapenv:Header>\n" +
-                    "         <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soapenv:mustUnderstand=\"1\">\n" +
-                    "            <ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" Id=\"Signature-6426875\">\n" +
-                    "               <ds:SignedInfo>\n" +
-                    "                  <ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" />\n" +
-                    "                  <ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" />\n" +
-                    "                  <ds:Reference URI=\"#id-3083604\">\n" +
-                    "                     <ds:Transforms>\n" +
-                    "                        <ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" />\n" +
-                    "                     </ds:Transforms>\n" +
-                    "                     <ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\n" +
-                    "                     <ds:DigestValue>lDeZJk0/r6u4tOOhOKbN0IEvwi0=</ds:DigestValue>\n" +
-                    "                  </ds:Reference>\n" +
-                    "               </ds:SignedInfo>\n" +
-                    "               <ds:SignatureValue>KhUeWMoUxUFe5jeTlqLdIEIG2Z7Q2q2mh9HT3IAYwbCev+FzXcuLSiPSsb7/+PSDM2SD0gl9tMp+dHjfPxmq7WiduH9mbnP6gkrxxu0T5rR916WsboshJGJKiPlj71bwpMsrrZohx4evHPdQ2SZHthlNb6jZyjq+LS7qFydppHk=</ds:SignatureValue>\n" +
-                    "               <ds:KeyInfo Id=\"KeyId-2529687\">\n" +
-                    "                  <wsse:SecurityTokenReference xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"STRId-31966667\">\n" +
-                    "                     <ds:X509Data>\n" +
-                    "                        <ds:X509IssuerSerial>\n" +
-                    "                           <ds:X509IssuerName>CN=OASIS Interop Test CA,O=OASIS</ds:X509IssuerName>\n" +
-                    "                           <ds:X509SerialNumber>68652640310044618358965661752471103641</ds:X509SerialNumber>\n" +
-                    "                        </ds:X509IssuerSerial>\n" +
-                    "                     </ds:X509Data>\n" +
-                    "                  </wsse:SecurityTokenReference>\n" +
-                    "               </ds:KeyInfo>\n" +
-                    "            </ds:Signature>\n" +
-                    "            <wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"Timestamp-13986615\">\n" +
-                    "               <wsu:Created>2006-03-31T15:34:38.699Z</wsu:Created>\n" +
-                    "               <wsu:Expires>2006-03-31T15:39:38.699Z</wsu:Expires>\n" +
-                    "            </wsu:Timestamp>\n" +
-                    "         </wsse:Security>\n" +
-                    "         <wsa:To xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://localhost:9080/axis2/services/Service</wsa:To>\n" +
-                    "         <wsa:ReplyTo xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n" +
-                    "            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>\n" +
-                    "         </wsa:ReplyTo>\n" +
-                    "         <wsa:MessageID xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">urn:uuid:049875A6E153FCAAF011438192785862</wsa:MessageID>\n" +
-                    "         <wsa:Action xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</wsa:Action>\n" +
-                    "      </soapenv:Header>\n" +
-                    "      <soapenv:Body xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"id-3083604\">\n" +
-                    "         <RequestSecurityToken xmlns=\"http://schemas.xmlsoap.org/ws/2005/02/trust\" Context=\"http://get.optional.attrs.working\">\n" +
-                    "            <TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</TokenType>\n" +
-                    "            <RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</RequestType>\n" +
-                    "         </RequestSecurityToken>\n" +
-                    "      </soapenv:Body>\n" +
-                    "   </soapenv:Envelope>";
-
-            XMLStreamReader reader = XMLInputFactory.newInstance()
-                    .createXMLStreamReader(new ByteArrayInputStream(origXML.getBytes()));
-            StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, null);
-
-            SOAPEnvelope env = builder.getSOAPEnvelope();
-
-            env.build();
-
-            StAXSOAPModelBuilder doomBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(),
-                                                                        DOOMAbstractFactory.getSOAP11Factory(),
-                                                                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-
-            SOAPEnvelope doomEnv = doomBuilder.getSOAPEnvelope();
-
-            doomEnv.build();
-
-            OMElement payload = doomEnv.getBody().getFirstElement();
-
-            StAXOMBuilder llomBuilder =
-                    new StAXOMBuilder(payload.getXMLStreamReaderWithoutCaching());
-
-            OMElement llomPayload = llomBuilder.getDocumentElement();
-
-            llomPayload.build();
-
-            String xml = llomPayload.toString();
-
-            assertTrue("Conversion failed", xml.indexOf("</RequestSecurityToken>") != -1);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+        assertTrue("Conversion failed", xml.indexOf("</RequestSecurityToken>") != -1);
     }
 
     public void testConvert1() {
-        try {
-            SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-            SOAPEnvelope env = fac.getDefaultEnvelope();
-            fac.createOMElement(new QName("http://test.org", "Test"), env.getBody());
-            env.build();
-
-            StAXSOAPModelBuilder doomBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(),
-                                                                        DOOMAbstractFactory.getSOAP11Factory(),
-                                                                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-
-            SOAPEnvelope doomEnv = doomBuilder.getSOAPEnvelope();
-
-            doomEnv.build();
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope env = fac.getDefaultEnvelope();
+        fac.createOMElement(new QName("http://test.org", "Test"), env.getBody());
+        env.build();
+
+        StAXSOAPModelBuilder doomBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(),
+                                                                    DOOMAbstractFactory.getSOAP11Factory(),
+                                                                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+        SOAPEnvelope doomEnv = doomBuilder.getSOAPEnvelope();
+
+        doomEnv.build();
     }
 
     public void testAddChild() {
-        try {
-            SOAPFactory fac = DOOMAbstractFactory.getSOAP11Factory();
-            SOAPEnvelope env = fac.getDefaultEnvelope();
-            fac.createOMElement(new QName("http://test.org", "Test"), env.getBody());
-            env.build();
-
-            SOAPFactory llomFac = DOOMAbstractFactory.getSOAP11Factory();
-            OMElement elem = llomFac.createOMElement("newDomElement", null);
-
-            OMElement firstElement = env.getBody().getFirstElement();
-            firstElement.addChild(elem);
-
-            assertTrue("New DOM child missing",
-                       env.toString().indexOf("newDomElement") > 0);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
-    }
+        SOAPFactory fac = DOOMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope env = fac.getDefaultEnvelope();
+        fac.createOMElement(new QName("http://test.org", "Test"), env.getBody());
+        env.build();
+
+        SOAPFactory llomFac = DOOMAbstractFactory.getSOAP11Factory();
+        OMElement elem = llomFac.createOMElement("newDomElement", null);
 
+        OMElement firstElement = env.getBody().getFirstElement();
+        firstElement.addChild(elem);
+
+        assertTrue("New DOM child missing",
+                   env.toString().indexOf("newDomElement") > 0);
+    }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java Sun Dec 14 12:51:53 2008
@@ -28,12 +28,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 
 public class DOMImplementationTest extends TestCase {
-
-    public DOMImplementationTest(String name) {
-        super(name);
-    }
-
-    public void testDOMImpl() {
+    public void testDOMImpl() throws Exception {
         try {
 //			System.setProperty("javax.xml.parsers.DocumentBuilderFactory",DocumentBuilderFactoryImpl.class.getName());
 
@@ -50,9 +45,6 @@
             assertEquals("Incorrect Document instance", DocumentImpl.class.getName(),
                          doc.getClass().getName());
 
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
         } finally {
             DocumentBuilderFactoryImpl.setDOOMRequired(false);
         }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java Sun Dec 14 12:51:53 2008
@@ -29,15 +29,6 @@
 import org.w3c.dom.Text;
 
 public class DocumentImplTest extends TestCase {
-
-    public DocumentImplTest() {
-        super();
-    }
-
-    public DocumentImplTest(String name) {
-        super(name);
-    }
-
     public void testCreateElement() {
         String tagName = "LocalName";
         String namespace = "http://ws.apache.org/axis2/ns";
@@ -87,22 +78,17 @@
         assertEquals("Text value mismatch", textValue, txt.getData());
     }
 
-    public void testDocumentSiblings() {
-        try {
-            Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
-            Element elem = doc.createElement("test");
-            doc.appendChild(elem);
-
-            Node node = doc.getNextSibling();
-            assertNull("Document's next sibling has to be null", node);
-            Node node2 = doc.getPreviousSibling();
-            assertNull("Document's previous sibling has to be null", node2);
-            Node node3 = doc.getParentNode();
-            assertNull("Document's parent has to be null", node3);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    public void testDocumentSiblings() throws Exception {
+        Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
+        Element elem = doc.createElement("test");
+        doc.appendChild(elem);
+
+        Node node = doc.getNextSibling();
+        assertNull("Document's next sibling has to be null", node);
+        Node node2 = doc.getPreviousSibling();
+        assertNull("Document's previous sibling has to be null", node2);
+        Node node3 = doc.getParentNode();
+        assertNull("Document's parent has to be null", node3);
     }
 
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java Sun Dec 14 12:51:53 2008
@@ -34,15 +34,6 @@
 import java.util.Iterator;
 
 public class ElementImplTest extends TestCase {
-
-    public ElementImplTest() {
-        super();
-    }
-
-    public ElementImplTest(String name) {
-        super(name);
-    }
-
     public void testSetText() {
         OMDOMFactory factory = new OMDOMFactory();
         String localName = "TestLocalName";
@@ -58,7 +49,7 @@
 
     }
 
-    public void testSerialize() {
+    public void testSerialize() throws Exception {
         OMDOMFactory factory = new OMDOMFactory();
         String localName = "TestLocalName";
         String namespace = "http://ws.apache.org/axis2/ns";
@@ -71,14 +62,10 @@
 
         ((Text) textNode).appendData(textToAppend);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try {
-            elem.serialize(baos);
-            String xml = new String(baos.toByteArray());
-            assertEquals("Incorrect serialized xml", 0, xml.indexOf("<axis2:TestLocalName"));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+
+        elem.serialize(baos);
+        String xml = new String(baos.toByteArray());
+        assertEquals("Incorrect serialized xml", 0, xml.indexOf("<axis2:TestLocalName"));
     }
 
     public void testAddChild() {
@@ -106,91 +93,73 @@
         assertEquals("In correct number of children", 1, count);
     }
 
-    public void testAppendChild() {
-        try {
-            String elementName = "TestElem";
-            String childElemName = "TestChildElem";
-            String childTextValue = "text value of the child text node";
-
-            //Apending am Element node
-            Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
-            Element elem = doc.createElement(elementName);
-            Element childElem = doc.createElement(childElemName);
-
-            elem.appendChild(childElem);
-
-            Element addedChild = (Element) elem.getFirstChild();
-            assertNotNull("Child Element node missing", addedChild);
-            assertEquals("Incorre node object", childElem, addedChild);
-
-            elem = doc.createElement(elementName);
-            Text text = doc.createTextNode(childTextValue);
-            elem.appendChild(text);
-
-            Text addedTextnode = (Text) elem.getFirstChild();
-            assertNotNull("Child Text node missing", addedTextnode);
-            assertEquals("Incorrect node object", text, addedTextnode);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    public void testAppendChild() throws Exception {
+        String elementName = "TestElem";
+        String childElemName = "TestChildElem";
+        String childTextValue = "text value of the child text node";
+
+        //Apending am Element node
+        Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
+        Element elem = doc.createElement(elementName);
+        Element childElem = doc.createElement(childElemName);
+
+        elem.appendChild(childElem);
+
+        Element addedChild = (Element) elem.getFirstChild();
+        assertNotNull("Child Element node missing", addedChild);
+        assertEquals("Incorre node object", childElem, addedChild);
+
+        elem = doc.createElement(elementName);
+        Text text = doc.createTextNode(childTextValue);
+        elem.appendChild(text);
+
+        Text addedTextnode = (Text) elem.getFirstChild();
+        assertNotNull("Child Text node missing", addedTextnode);
+        assertEquals("Incorrect node object", text, addedTextnode);
     }
 
     /** Testing the NodeList returned with the elements's children */
-    public void testGetElementsbyTagName() {
-        try {
-            String childElementLN = "Child";
-
-            Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
-            Element docElem = doc.getDocumentElement();
-            assertNull("The document element shoudl be null", docElem);
-
-            docElem = doc.createElement("Test");
-            docElem.appendChild(doc.createElement(childElementLN));
-            docElem.appendChild(doc.createElement(childElementLN));
-            docElem.appendChild(doc.createElement(childElementLN));
-            docElem.appendChild(doc.createElement(childElementLN));
-            docElem.appendChild(doc.createElement(childElementLN));
-            docElem.appendChild(doc.createElement(childElementLN));
-            docElem.appendChild(doc.createElement(childElementLN));
-
-            NodeList list = docElem.getElementsByTagName(childElementLN);
-
-            assertEquals("Incorrect number of child elements", 7, list.getLength());
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    public void testGetElementsbyTagName() throws Exception {
+        String childElementLN = "Child";
+
+        Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
+        Element docElem = doc.getDocumentElement();
+        assertNull("The document element shoudl be null", docElem);
+
+        docElem = doc.createElement("Test");
+        docElem.appendChild(doc.createElement(childElementLN));
+        docElem.appendChild(doc.createElement(childElementLN));
+        docElem.appendChild(doc.createElement(childElementLN));
+        docElem.appendChild(doc.createElement(childElementLN));
+        docElem.appendChild(doc.createElement(childElementLN));
+        docElem.appendChild(doc.createElement(childElementLN));
+        docElem.appendChild(doc.createElement(childElementLN));
+
+        NodeList list = docElem.getElementsByTagName(childElementLN);
+
+        assertEquals("Incorrect number of child elements", 7, list.getLength());
     }
 
-    public void testGetElementsbyTagNameNS() {
-        try {
-            String childElementLN = "test:Child";
-            String childElementNS = "http://ws.apache.org/ns/axis2/dom";
-
-            Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
-            Element docElem = doc.getDocumentElement();
-            assertNull("The document element shoudl be null", docElem);
-
-            docElem = doc.createElementNS("http://test.org", "test:Test");
-
-            docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
-            docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
-            docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
-            docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
-            docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
-            docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
-            docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
-
-            NodeList list = docElem.getElementsByTagNameNS(childElementNS, childElementLN);
-
-            assertEquals("Incorrect number of child elements", 7, list.getLength());
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    public void testGetElementsbyTagNameNS() throws Exception {
+        String childElementLN = "test:Child";
+        String childElementNS = "http://ws.apache.org/ns/axis2/dom";
+
+        Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument();
+        Element docElem = doc.getDocumentElement();
+        assertNull("The document element shoudl be null", docElem);
+
+        docElem = doc.createElementNS("http://test.org", "test:Test");
+
+        docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+        docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+        docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+        docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+        docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+        docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+        docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+
+        NodeList list = docElem.getElementsByTagNameNS(childElementNS, childElementLN);
+
+        assertEquals("Incorrect number of child elements", 7, list.getLength());
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java Sun Dec 14 12:51:53 2008
@@ -32,17 +32,12 @@
 /** @author Ruchith Fernando (ruchith.fernando@gmail.com) */
 public class ElementImportTest extends TestCase {
 
-    public void testImport() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            Document doc = dbf.newDocumentBuilder().parse(
-                    new FileInputStream("test-resources/xml/sigEncr.xml"));
-            Node n = new OMDOMFactory().getDocument().importNode(doc.getDocumentElement(), true);
-            OMTestUtils.compare(doc.getDocumentElement(), (OMElement) n);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    public void testImport() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        Document doc = dbf.newDocumentBuilder().parse(
+                new FileInputStream("test-resources/xml/sigEncr.xml"));
+        Node n = new OMDOMFactory().getDocument().importNode(doc.getDocumentElement(), true);
+        OMTestUtils.compare(doc.getDocumentElement(), (OMElement) n);
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java Sun Dec 14 12:51:53 2008
@@ -25,10 +25,6 @@
 public class MessagesTest extends OMDOMTestCase {
     SOAPEnvelope soapEnvelope;
 
-    public MessagesTest(String testName) {
-        super(testName);
-    }
-
     public void testMessageWithLotOfWhiteSpaces() throws OMException,
             Exception {
         soapEnvelope =

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java Sun Dec 14 12:51:53 2008
@@ -26,15 +26,6 @@
 import javax.xml.namespace.QName;
 
 public class OMDOMFactoryTest extends TestCase {
-
-    public OMDOMFactoryTest() {
-        super();
-    }
-
-    public OMDOMFactoryTest(String name) {
-        super(name);
-    }
-
     public void testCreateElement() {
         OMDOMFactory factory = new OMDOMFactory();
         String localName = "TestLocalName";

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java Sun Dec 14 12:51:53 2008
@@ -45,10 +45,6 @@
 
     protected SOAPEnvelope soapEnvelope;
 
-    public OMDOMTestCase(String testName) {
-        super(testName);
-    }
-
     protected void setUp() throws Exception {
         super.setUp();
         soapEnvelope = (SOAPEnvelope) getOMBuilder("").getDocumentElement();

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java?rev=726530&r1=726529&r2=726530&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java Sun Dec 14 12:51:53 2008
@@ -26,15 +26,6 @@
 import org.w3c.dom.Text;
 
 public class TextImplTest extends TestCase {
-
-    public TextImplTest() {
-        super();
-    }
-
-    public TextImplTest(String name) {
-        super(name);
-    }
-
     public void testSetText() {
         OMDOMFactory factory = new OMDOMFactory();
         String localName = "TestLocalName";