ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1165137 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/test/java/org/apache/axiom/om/ axiom-tests/src/test/java/org/apache/axiom/om/ axiom-tests/src/test/java/org/apache/axiom/om/factory/ axiom-tests/src/test/java/org...
Date Sun, 04 Sep 2011 23:36:06 GMT
Author: veithen
Date: Sun Sep  4 23:36:05 2011
New Revision: 1165137

URL: http://svn.apache.org/viewvc?rev=1165137&view=rev
Log:
Eliminated various utility methods used by the test cases in favor of standard APIs.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTestUtils.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTestUtils.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTestUtils.java?rev=1165137&r1=1165136&r2=1165137&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTestUtils.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTestUtils.java
Sun Sep  4 23:36:05 2011
@@ -21,31 +21,15 @@ package org.apache.axiom.om;
 
 import junit.framework.TestCase;
 
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.InputStream;
 import java.util.Iterator;
 
 public class OMTestUtils {
-    public static OMXMLParserWrapper getOMBuilder(File file) throws Exception {
-        XMLStreamReader parser = StAXUtils.createXMLStreamReader(new FileReader(file));
-        return new StAXSOAPModelBuilder(parser, null);
-    }
-
-    public static OMXMLParserWrapper getOMBuilder(InputStream in) throws Exception {
-        XMLStreamReader parser = StAXUtils.createXMLStreamReader(in);
-        return new StAXSOAPModelBuilder(parser, null);
-    }
-
     public static void walkThrough(OMElement omEle) {
         Iterator attibIt = omEle.getAllAttributes();
         if (attibIt != null) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java?rev=1165137&r1=1165136&r2=1165137&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
Sun Sep  4 23:36:05 2011
@@ -21,7 +21,7 @@ package org.apache.axiom.om;
 
 import org.apache.axiom.soap.SOAPEnvelope;
 
-public class MessagesTest extends OMTestCase {
+public class MessagesTest extends AbstractTestCase {
     SOAPEnvelope soapEnvelope;
 
     public MessagesTest(String testName) {
@@ -30,37 +30,29 @@ public class MessagesTest extends OMTest
 
     public void testMessageWithLotOfWhiteSpaces() throws OMException,
             Exception {
-        soapEnvelope =
-                (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                        getTestResource(TestConstants.WHITESPACE_MESSAGE))
-                        .getDocumentElement();
+        soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(getTestResource(
+                TestConstants.WHITESPACE_MESSAGE), null).getSOAPEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
         soapEnvelope.close(false);
     }
 
     public void testMinimalMessage() throws OMException, Exception {
-        soapEnvelope =
-                (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                        getTestResource(TestConstants.MINIMAL_MESSAGE))
-                        .getDocumentElement();
+        soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(getTestResource(
+                TestConstants.MINIMAL_MESSAGE), null).getSOAPEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
         soapEnvelope.close(false);
     }
 
     public void testReallyBigMessage() throws OMException, Exception {
-        soapEnvelope =
-                (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                        getTestResource(TestConstants.REALLY_BIG_MESSAGE))
-                        .getDocumentElement();
+        soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(getTestResource(
+                TestConstants.REALLY_BIG_MESSAGE), null).getSOAPEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
         soapEnvelope.close(false);
     }
 
     public void testEmptyBodiedMessage() throws OMException, Exception {
-        soapEnvelope =
-                (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                        getTestResource(TestConstants.EMPTY_BODY_MESSAGE))
-                        .getDocumentElement();
+        soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(getTestResource(
+                TestConstants.EMPTY_BODY_MESSAGE), null).getSOAPEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
         soapEnvelope.close(false);
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java?rev=1165137&r1=1165136&r2=1165137&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
Sun Sep  4 23:36:05 2011
@@ -33,10 +33,8 @@ import java.io.IOException;
 public class OMElementCloneTest extends AbstractTestCase {
 
     public void testElementCloningWithoutUsingOMElementMethod() throws Exception {
-        SOAPEnvelope soapEnvelope =
-                (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                        getTestResource(TestConstants.SOAP_SOAPMESSAGE))
-                        .getDocumentElement();
+        SOAPEnvelope soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(getTestResource(
+                TestConstants.SOAP_SOAPMESSAGE), null).getSOAPEnvelope();
         SOAPBody body = soapEnvelope.getBody();
 
         OMElement firstClonedBodyElement =
@@ -62,10 +60,8 @@ public class OMElementCloneTest extends 
     }
 
     public void testElementCloningUsingOMElementMethod() throws Exception {
-        SOAPEnvelope soapEnvelope =
-                (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                        getTestResource(TestConstants.SOAP_SOAPMESSAGE))
-                        .getDocumentElement();
+        SOAPEnvelope soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(getTestResource(
+                TestConstants.SOAP_SOAPMESSAGE), null).getSOAPEnvelope();
         SOAPBody body = soapEnvelope.getBody();
 
         OMElement firstClonedBodyElement = body.cloneOMElement();

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java?rev=1165137&r1=1165136&r2=1165137&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java
Sun Sep  4 23:36:05 2011
@@ -24,11 +24,7 @@ import org.apache.axiom.soap.SOAPEnvelop
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 
-import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.InputStream;
-import java.io.OutputStream;
 
 public abstract class OMTestCase extends AbstractTestCase {
     protected StAXSOAPModelBuilder builder;
@@ -61,16 +57,4 @@ public abstract class OMTestCase extends
         builder = new StAXSOAPModelBuilder(parser, null);
         return builder;
     }
-
-    protected StAXSOAPModelBuilder getOMBuilder(InputStream in) throws Exception {
-        XMLStreamReader parser = StAXUtils.createXMLStreamReader(in);
-        builder = new StAXSOAPModelBuilder(parser, null);
-        return builder;
-    }
-
-    protected XMLStreamWriter getStAXStreamWriter(OutputStream out) throws XMLStreamException
{
-        return StAXUtils.createXMLStreamWriter(out);
-    }
-
-
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java?rev=1165137&r1=1165136&r2=1165137&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java
Sun Sep  4 23:36:05 2011
@@ -24,7 +24,7 @@ import org.apache.axiom.om.OMAbstractFac
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMTestUtils;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.TestConstants;
 import org.apache.axiom.soap.SOAP11Constants;
@@ -65,8 +65,8 @@ public class OMLinkedListImplFactoryTest
     }
 
     public void testCreateOMElement() throws Exception {
-        OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
-                getTestResource(TestConstants.WHITESPACE_MESSAGE));
+        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
+                getTestResource(TestConstants.WHITESPACE_MESSAGE), null);
         OMElement envelope = omBuilder.getDocumentElement();
         
         // The body is the second element
@@ -110,8 +110,8 @@ public class OMLinkedListImplFactoryTest
     }
 
     public void testCreateSOAPBody() throws Exception {
-        OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
-                getTestResource(TestConstants.MINIMAL_MESSAGE));
+        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
+                getTestResource(TestConstants.MINIMAL_MESSAGE), null);
         SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
         SOAPBody soapBodyOne = omFactory.createSOAPBody(soapEnvelope);
         assertTrue(
@@ -120,8 +120,8 @@ public class OMLinkedListImplFactoryTest
     }
 
     public void testCreateSOAPBodyWithBuilder() throws Exception {
-        OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
-                getTestResource(TestConstants.MINIMAL_MESSAGE));
+        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
+                getTestResource(TestConstants.MINIMAL_MESSAGE), null);
         SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
 
         SOAPBody soapBodyTwo = omFactory.createSOAPBody(soapEnvelope,
@@ -141,8 +141,8 @@ public class OMLinkedListImplFactoryTest
                 "Programatically created SOAPEnvelope should have done = true ",
                 soapEnvelopeTwo.isComplete());
         SOAPEnvelope soapEnvelope = omFactory.createSOAPEnvelope(
-                OMTestUtils.getOMBuilder(
-                        getTestResource(TestConstants.MINIMAL_MESSAGE)));
+                OMXMLBuilderFactory.createSOAPModelBuilder(
+                        getTestResource(TestConstants.MINIMAL_MESSAGE), null));
         assertTrue(
                 "SOAPEnvelope with a builder should start with done = false ",
                 !soapEnvelope.isComplete());
@@ -150,8 +150,8 @@ public class OMLinkedListImplFactoryTest
     }
 
     public void testCreateSOAPHeader() throws Exception {
-        OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
-                getTestResource(TestConstants.MINIMAL_MESSAGE));
+        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
+                getTestResource(TestConstants.MINIMAL_MESSAGE), null);
         SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
         SOAPHeader soapHeader = omFactory.createSOAPHeader(soapEnvelope);
         assertTrue(
@@ -167,8 +167,8 @@ public class OMLinkedListImplFactoryTest
     }
 
     public void testCreateSOAPHeaderBlock() throws Exception {
-        OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
-                getTestResource(TestConstants.SOAP_SOAPMESSAGE));
+        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
+                getTestResource(TestConstants.SOAP_SOAPMESSAGE), null);
         SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
         SOAPHeader soapHeader = soapEnvelope.getHeader();
         SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock(
@@ -185,8 +185,8 @@ public class OMLinkedListImplFactoryTest
     }
 
     public void testCreateSOAPFault() throws Exception {
-        OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
-                getTestResource(TestConstants.SOAP_SOAPMESSAGE));
+        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
+                getTestResource(TestConstants.SOAP_SOAPMESSAGE), null);
         SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
         SOAPBody soapBody = soapEnvelope.getBody();
         SOAPFault soapFault = omFactory.createSOAPFault(soapBody,

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java?rev=1165137&r1=1165136&r2=1165137&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
Sun Sep  4 23:36:05 2011
@@ -21,7 +21,7 @@ package org.apache.axiom.soap.impl.llom;
 
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMTestCase;
-import org.apache.axiom.om.OMTestUtils;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.TestConstants;
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -54,9 +54,8 @@ public class OMEnvelopeTest extends OMTe
     }
 
     private SOAPEnvelope getSecondEnvelope() throws Exception {
-        return (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                getTestResource(TestConstants.SAMPLE1))
-                .getDocumentElement();
+        return OMXMLBuilderFactory.createSOAPModelBuilder(getTestResource(
+                TestConstants.SAMPLE1), null).getSOAPEnvelope();
     }
 
     public void testGetHeader2() throws Exception {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java?rev=1165137&r1=1165136&r2=1165137&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java
Sun Sep  4 23:36:05 2011
@@ -23,6 +23,7 @@ import org.apache.axiom.om.AbstractTestC
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMTestUtils;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.ts.AxiomTestCase;
 
@@ -38,9 +39,9 @@ public class BadInputTest extends AxiomT
     protected void runTest() throws Throwable {
         try {
             SOAPEnvelope soapEnvelope =
-                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                            AbstractTestCase.getTestResource("badsoap/" + file))
-                            .getDocumentElement();
+                    OMXMLBuilderFactory.createSOAPModelBuilder(
+                            AbstractTestCase.getTestResource("badsoap/" + file), null)
+                            .getSOAPEnvelope();
             OMTestUtils.walkThrough(soapEnvelope);
             fail("this must failed gracefully with OMException");
         } catch (OMException e) {



Mime
View raw message