Author: veithen
Date: Sun Apr 15 11:21:47 2012
New Revision: 1326308

URL: http://svn.apache.org/viewvc?rev=1326308&view=rev
Log:
AXIOM-311: Refactored the MessagesTest unit tests.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/MessageTest.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java
      - copied, changed from r1325524, 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTestUtils.java
Removed:
    
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/impl/dom/MessagesTest.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/OMTestUtils.java
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.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-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1326308&r1=1326307&r2=1326308&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
 Sun Apr 15 11:21:47 2012
@@ -19,12 +19,17 @@
 package org.apache.axiom.ts.soap;
 
 import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.TestConstants;
 import org.apache.axiom.testutils.suite.TestSuiteBuilder;
 
 public class SOAPTestSuiteBuilder extends TestSuiteBuilder {
     private static final String[] badSOAPFiles = { "wrongSoapNs.xml", 
"twoheaders.xml", "twoBodymessage.xml",
             "envelopeMissing.xml", "haederBodyWrongOrder.xml" };
     
+    private static final String[] goodSOAPFiles = { 
TestConstants.WHITESPACE_MESSAGE,
+        TestConstants.MINIMAL_MESSAGE, TestConstants.REALLY_BIG_MESSAGE,
+        TestConstants.EMPTY_BODY_MESSAGE };
+    
     private final OMMetaFactory metaFactory;
     
     public SOAPTestSuiteBuilder(OMMetaFactory metaFactory) {
@@ -107,6 +112,9 @@ public class SOAPTestSuiteBuilder extend
         for (int i=0; i<badSOAPFiles.length; i++) {
             addTest(new 
org.apache.axiom.ts.soap.builder.BadInputTest(metaFactory, badSOAPFiles[i]));
         }
+        for (int i=0; i<goodSOAPFiles.length; i++) {
+            addTest(new 
org.apache.axiom.ts.soap.builder.MessageTest(metaFactory, goodSOAPFiles[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));

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=1326308&r1=1326307&r2=1326308&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 Apr 15 11:21:47 2012
@@ -22,7 +22,6 @@ 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.om.OMXMLBuilderFactory;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.ts.AxiomTestCase;

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/MessageTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/MessageTest.java?rev=1326308&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/MessageTest.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/MessageTest.java
 Sun Apr 15 11:21:47 2012
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.soap.builder;
+
+import org.apache.axiom.om.AbstractTestCase;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class MessageTest extends AxiomTestCase {
+    private final String file;
+
+    public MessageTest(OMMetaFactory metaFactory, String file) {
+        super(metaFactory);
+        this.file = file;
+        addTestProperty("file", file);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPEnvelope soapEnvelope = 
OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory,
+                AbstractTestCase.getTestResource(file), 
null).getSOAPEnvelope();
+        OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/MessageTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java
 (from r1325524, 
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-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTestUtils.java&r1=1325524&r2=1326308&rev=1326308&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-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java
 Sun Apr 15 11:21:47 2012
@@ -17,12 +17,15 @@
  * under the License.
  */
 
-package org.apache.axiom.om;
+package org.apache.axiom.ts.soap.builder;
 
 import junit.framework.TestCase;
 
 import java.util.Iterator;
 
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+
 public class OMTestUtils {
     public static void walkThrough(OMElement omEle) {
         Iterator attibIt = omEle.getAllAttributes();


Reply via email to