Author: veithen
Date: Thu Mar 31 19:34:29 2011
New Revision: 1087421

URL: http://svn.apache.org/viewvc?rev=1087421&view=rev
Log:
AXIOM-311: Migrated BadInputTest to the new test suite.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java
      - copied, changed from r1087408, 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/BadInputTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/
      - copied from r1087408, 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/resources/badsoap/
Removed:
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/BadInputTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/resources/badsoap/
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/TestConstants.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/TestConstants.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/TestConstants.java?rev=1087421&r1=1087420&r2=1087421&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/TestConstants.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/TestConstants.java
 Thu Mar 31 19:34:29 2011
@@ -30,11 +30,6 @@ public class TestConstants {
     public static final String MINIMAL_MESSAGE = "soap/minimalMessage.xml";
     public static final String REALLY_BIG_MESSAGE = 
"soap/reallyReallyBigMessage.xml";
     public static final String EMPTY_BODY_MESSAGE = "soap/emtyBodymessage.xml";
-    public static final String BAD_WRONG_SOAP_NS = "badsoap/wrongSoapNs.xml";
-    public static final String BAD_TWO_HEADERS = "badsoap/twoheaders.xml";
-    public static final String BAD_TWO_BODY = "badsoap/twoBodymessage.xml";
-    public static final String BAD_ENVELOPE_MISSING = 
"badsoap/envelopeMissing.xml";
-    public static final String BAD_HEADER_BODY_WRONG_ORDER = 
"badsoap/haederBodyWrongOrder.xml";
 
     public static final String MTOM_MESSAGE = "mtom/MTOMAttachmentStream.bin";
     public static final String MTOM_MESSAGE_BOUNDARY = 
"MIMEBoundaryurn:uuid:A3ADBAEE51A1A87B2A11443668160701";

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java?rev=1087421&r1=1087420&r2=1087421&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
 Thu Mar 31 19:34:29 2011
@@ -22,6 +22,9 @@ import org.apache.axiom.om.OMMetaFactory
 import org.apache.axiom.ts.soap.SOAPSpec;
 
 public class SOAPTestSuiteBuilder extends AxiomTestSuiteBuilder {
+    private static final String[] badSOAPFiles = { "wrongSoapNs.xml", 
"twoheaders.xml", "twoBodymessage.xml",
+            "envelopeMissing.xml", "haederBodyWrongOrder.xml" };
+    
     public SOAPTestSuiteBuilder(OMMetaFactory metaFactory) {
         super(metaFactory);
     }
@@ -81,6 +84,9 @@ public class SOAPTestSuiteBuilder extend
     protected void addTests() {
         addTests(SOAPSpec.SOAP11);
         addTests(SOAPSpec.SOAP12);
+        for (int i=0; i<badSOAPFiles.length; i++) {
+            addTest(new 
org.apache.axiom.ts.soap.builder.BadInputTest(metaFactory, badSOAPFiles[i]));
+        }
         addTest(new 
org.apache.axiom.ts.soap11.envelope.TestAddElementAfterBody(metaFactory));
         addTest(new org.apache.axiom.ts.soap11.fault.TestGetNode(metaFactory));
         addTest(new org.apache.axiom.ts.soap11.fault.TestSetNode(metaFactory));

Copied: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java
 (from r1087408, 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/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?p2=webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/BadInputTest.java&r1=1087408&r2=1087421&rev=1087421&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/BadInputTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/BadInputTest.java
 Thu Mar 31 19:34:29 2011
@@ -17,41 +17,32 @@
  * under the License.
  */
 
-package org.apache.axiom.om;
+package org.apache.axiom.ts.soap.builder;
 
+import org.apache.axiom.om.AbstractTestCase;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMTestUtils;
 import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.ts.AxiomTestCase;
 
-public class BadInputTest extends OMTestCase {
+public class BadInputTest extends AxiomTestCase {
+    private final String file;
 
-    public BadInputTest(String testName) {
-        super(testName);
+    public BadInputTest(OMMetaFactory metaFactory, String file) {
+        super(metaFactory);
+        this.file = file;
+        addTestProperty("file", file);
     }
 
-
-    //done
-    public void testEnvelopeMissing() throws Exception {
+    protected void runTest() throws Throwable {
         try {
             SOAPEnvelope soapEnvelope =
                     (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                            
getTestResource(TestConstants.BAD_ENVELOPE_MISSING))
+                            AbstractTestCase.getTestResource("badsoap/" + 
file))
                             .getDocumentElement();
             OMTestUtils.walkThrough(soapEnvelope);
-            fail("this must failed gracefully with OMException or AxisFault");
-        } catch (OMException e) {
-            return;
-        }
-
-    }
-
-    //done
-    public void testHeaderBodyWrongOrder() throws Exception {
-        try {
-            SOAPEnvelope soapEnvelope =
-                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                            
getTestResource(TestConstants.BAD_HEADER_BODY_WRONG_ORDER))
-                            .getDocumentElement();
-            soapEnvelope.build();
-            fail("this must failed gracefully with OMException or AxisFault");
+            fail("this must failed gracefully with OMException");
         } catch (OMException e) {
             return;
         }
@@ -87,51 +78,4 @@ public class BadInputTest extends OMTest
     //        }
     //
     //    }
-
-    //done
-    public void testTwoBodymessage() throws Exception {
-        try {
-            SOAPEnvelope soapEnvelope =
-                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                            getTestResource(TestConstants.BAD_TWO_BODY))
-                            .getDocumentElement();
-            soapEnvelope.build();
-            fail("this must failed gracefully with OMException or AxisFault");
-        } catch (OMException e) {
-            return;
-        }
-
-    }
-
-    //done
-    public void testTwoheaders() throws Exception {
-        try {
-            SOAPEnvelope soapEnvelope =
-                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                            getTestResource(TestConstants.BAD_TWO_HEADERS))
-                            .getDocumentElement();
-            soapEnvelope.build();
-            fail("this must failed gracefully with OMException or AxisFault");
-        } catch (OMException e) {
-            return;
-        }
-
-    }
-
-    //done
-    public void testWrongSoapNs() throws Exception {
-        try {
-            SOAPEnvelope soapEnvelope =
-                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
-                            getTestResource(TestConstants.BAD_WRONG_SOAP_NS))
-                            .getDocumentElement();
-            OMTestUtils.walkThrough(soapEnvelope);
-            fail("this must failed gracefully with OMException or AxisFault");
-        } catch (OMException e) {
-            return;
-        }
-
-    }
-
-
 }


Reply via email to