You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/10/17 19:55:44 UTC

svn commit: r1399363 - in /axis/axis1/java/trunk: interop-mock/src/main/java/org/apache/axis/test/interop/mock/ interop-mock/src/main/resources/terra/ interop-mock/src/main/resources/wsdl/ interop-mock/src/main/webapp/WEB-INF/ interop/ interop/src/test...

Author: veithen
Date: Wed Oct 17 17:55:43 2012
New Revision: 1399363

URL: http://svn.apache.org/viewvc?rev=1399363&view=rev
Log:
Migrated test/wsdl/terra to the Maven build and created a mock service for it so that it doesn't call out to the Internet.

Added:
    axis/axis1/java/trunk/interop-mock/src/main/resources/terra/
    axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-request.xml   (with props)
    axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-response.xml   (with props)
    axis/axis1/java/trunk/interop-mock/src/main/resources/terra/README.txt   (with props)
    axis/axis1/java/trunk/interop-mock/src/main/resources/wsdl/TerraService.wsdl
      - copied unchanged from r1398984, axis/axis1/java/trunk/test/wsdl/terra/TerraService.WSDL
    axis/axis1/java/trunk/interop/src/test/java/test/wsdl/terra/
    axis/axis1/java/trunk/interop/src/test/java/test/wsdl/terra/TerraServiceTestCase.java
      - copied, changed from r1398984, axis/axis1/java/trunk/test/wsdl/terra/TerraServiceTestCase.java
Removed:
    axis/axis1/java/trunk/test/wsdl/terra/
Modified:
    axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/DOMUtil.java
    axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/MockPostHandler.java
    axis/axis1/java/trunk/interop-mock/src/main/webapp/WEB-INF/dispatcher-servlet.xml
    axis/axis1/java/trunk/interop/pom.xml

Modified: axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/DOMUtil.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/DOMUtil.java?rev=1399363&r1=1399362&r2=1399363&view=diff
==============================================================================
--- axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/DOMUtil.java (original)
+++ axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/DOMUtil.java Wed Oct 17 17:55:43 2012
@@ -29,6 +29,7 @@ import org.springframework.core.io.Resou
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.Text;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
@@ -75,7 +76,19 @@ public final class DOMUtil {
             switch (child.getNodeType()) {
                 case Node.TEXT_NODE:
                     if (previousChild != null || nextChild != null) {
-                        element.removeChild(child);
+                        String content = ((Text)child).getData();
+                        boolean isWhitespace = true;
+                        for (int i=0; i<content.length(); i++) {
+                            // Non whitespace characters below 32 are illegal in XML 1.0 and would
+                            // have been rejected by the parser.
+                            if (content.charAt(i) > ' ') {
+                                isWhitespace = false;
+                                break;
+                            }
+                        }
+                        if (isWhitespace) {
+                            element.removeChild(child);
+                        }
                     }
                     break;
                 case Node.ELEMENT_NODE:

Modified: axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/MockPostHandler.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/MockPostHandler.java?rev=1399363&r1=1399362&r2=1399363&view=diff
==============================================================================
--- axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/MockPostHandler.java (original)
+++ axis/axis1/java/trunk/interop-mock/src/main/java/org/apache/axis/test/interop/mock/MockPostHandler.java Wed Oct 17 17:55:43 2012
@@ -104,6 +104,7 @@ public class MockPostHandler extends SOA
             }
         }
         Element request = requestDocument.getDocumentElement();
+        DOMUtil.removeWhitespace(request);
         if (requestProcessors != null) {
             for (MessageProcessor processor : requestProcessors) {
                 if (log.isDebugEnabled()) {

Added: axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-request.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-request.xml?rev=1399363&view=auto
==============================================================================
--- axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-request.xml (added)
+++ axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-request.xml Wed Oct 17 17:55:43 2012
@@ -0,0 +1,9 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:msr="http://msrmaps.com/">
+   <soapenv:Body>
+      <msr:GetPlaceList>
+         <msr:placeName>Boston</msr:placeName>
+         <msr:MaxItems>5</msr:MaxItems>
+         <msr:imagePresence>true</msr:imagePresence>
+      </msr:GetPlaceList>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Propchange: axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-request.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-response.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-response.xml?rev=1399363&view=auto
==============================================================================
--- axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-response.xml (added)
+++ axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-response.xml Wed Oct 17 17:55:43 2012
@@ -0,0 +1,78 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+   <soap:Body>
+      <GetPlaceListResponse xmlns="http://msrmaps.com/">
+         <GetPlaceListResult>
+            <PlaceFacts>
+               <Place>
+                  <City>Boston</City>
+                  <State>Georgia</State>
+                  <Country>United States</Country>
+               </Place>
+               <Center>
+                  <Lon>-83.790000915527344</Lon>
+                  <Lat>30.790000915527344</Lat>
+               </Center>
+               <AvailableThemeMask>3</AvailableThemeMask>
+               <PlaceTypeId>CityTown</PlaceTypeId>
+               <Population>0</Population>
+            </PlaceFacts>
+            <PlaceFacts>
+               <Place>
+                  <City>Boston</City>
+                  <State>Pennsylvania</State>
+                  <Country>United States</Country>
+               </Place>
+               <Center>
+                  <Lon>-79.80999755859375</Lon>
+                  <Lat>40.299999237060547</Lat>
+               </Center>
+               <AvailableThemeMask>3</AvailableThemeMask>
+               <PlaceTypeId>CityTown</PlaceTypeId>
+               <Population>0</Population>
+            </PlaceFacts>
+            <PlaceFacts>
+               <Place>
+                  <City>Boston</City>
+                  <State>Massachusetts</State>
+                  <Country>United States</Country>
+               </Place>
+               <Center>
+                  <Lon>-71.050003051757812</Lon>
+                  <Lat>42.360000610351563</Lat>
+               </Center>
+               <AvailableThemeMask>3</AvailableThemeMask>
+               <PlaceTypeId>CityTown</PlaceTypeId>
+               <Population>0</Population>
+            </PlaceFacts>
+            <PlaceFacts>
+               <Place>
+                  <City>Boston</City>
+                  <State>Alabama</State>
+                  <Country>United States</Country>
+               </Place>
+               <Center>
+                  <Lon>-86.481941223144531</Lon>
+                  <Lat>31.467777252197266</Lat>
+               </Center>
+               <AvailableThemeMask>3</AvailableThemeMask>
+               <PlaceTypeId>OtherLandFeature</PlaceTypeId>
+               <Population>0</Population>
+            </PlaceFacts>
+            <PlaceFacts>
+               <Place>
+                  <City>Boston</City>
+                  <State>Arkansas</State>
+                  <Country>United States</Country>
+               </Place>
+               <Center>
+                  <Lon>-93.601112365722656</Lon>
+                  <Lat>35.840557098388672</Lat>
+               </Center>
+               <AvailableThemeMask>3</AvailableThemeMask>
+               <PlaceTypeId>OtherLandFeature</PlaceTypeId>
+               <Population>0</Population>
+            </PlaceFacts>
+         </GetPlaceListResult>
+      </GetPlaceListResponse>
+   </soap:Body>
+</soap:Envelope>
\ No newline at end of file

Propchange: axis/axis1/java/trunk/interop-mock/src/main/resources/terra/GetPlaceList-response.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis1/java/trunk/interop-mock/src/main/resources/terra/README.txt
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop-mock/src/main/resources/terra/README.txt?rev=1399363&view=auto
==============================================================================
--- axis/axis1/java/trunk/interop-mock/src/main/resources/terra/README.txt (added)
+++ axis/axis1/java/trunk/interop-mock/src/main/resources/terra/README.txt Wed Oct 17 17:55:43 2012
@@ -0,0 +1,2 @@
+The messages in this folder have been created from requests sent to
+http://msrmaps.com/terraservice2.asmx.
\ No newline at end of file

Propchange: axis/axis1/java/trunk/interop-mock/src/main/resources/terra/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis1/java/trunk/interop-mock/src/main/webapp/WEB-INF/dispatcher-servlet.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop-mock/src/main/webapp/WEB-INF/dispatcher-servlet.xml?rev=1399363&r1=1399362&r2=1399363&view=diff
==============================================================================
--- axis/axis1/java/trunk/interop-mock/src/main/webapp/WEB-INF/dispatcher-servlet.xml (original)
+++ axis/axis1/java/trunk/interop-mock/src/main/webapp/WEB-INF/dispatcher-servlet.xml Wed Oct 17 17:55:43 2012
@@ -279,4 +279,18 @@
             </list>
         </property>
     </bean>
+    
+    <!-- Mock for http://msrmaps.com/terraservice2.asmx -->
+    
+    <bean name="/terraservice" class="org.apache.axis.test.interop.mock.MockPostHandler">
+        <property name="wsdl" value="classpath:wsdl/TerraService.wsdl"/>
+        <property name="exchanges">
+            <list>
+                <bean class="org.apache.axis.test.interop.mock.Exchange">
+                    <property name="request" value="classpath:terra/GetPlaceList-request.xml"/>
+                    <property name="response" value="classpath:terra/GetPlaceList-response.xml"/>
+                </bean>
+            </list>
+        </property>
+    </bean>
 </beans>

Modified: axis/axis1/java/trunk/interop/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop/pom.xml?rev=1399363&r1=1399362&r2=1399363&view=diff
==============================================================================
--- axis/axis1/java/trunk/interop/pom.xml (original)
+++ axis/axis1/java/trunk/interop/pom.xml Wed Oct 17 17:55:43 2012
@@ -101,6 +101,23 @@
                             </mappings>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>terra</id>
+                        <goals>
+                            <goal>generate-test-sources</goal>
+                        </goals>
+                        <configuration>
+                            <file>../interop-mock/src/main/resources/wsdl/TerraService.wsdl</file>
+                            <generate>client</generate>
+                            <wrapArrays>true</wrapArrays>
+                            <mappings>
+                                <mapping>
+                                    <namespace>http://msrmaps.com/</namespace>
+                                    <package>test.wsdl.terra</package>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>

Copied: axis/axis1/java/trunk/interop/src/test/java/test/wsdl/terra/TerraServiceTestCase.java (from r1398984, axis/axis1/java/trunk/test/wsdl/terra/TerraServiceTestCase.java)
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/interop/src/test/java/test/wsdl/terra/TerraServiceTestCase.java?p2=axis/axis1/java/trunk/interop/src/test/java/test/wsdl/terra/TerraServiceTestCase.java&p1=axis/axis1/java/trunk/test/wsdl/terra/TerraServiceTestCase.java&r1=1398984&r2=1399363&rev=1399363&view=diff
==============================================================================
--- axis/axis1/java/trunk/test/wsdl/terra/TerraServiceTestCase.java (original)
+++ axis/axis1/java/trunk/interop/src/test/java/test/wsdl/terra/TerraServiceTestCase.java Wed Oct 17 17:55:43 2012
@@ -7,19 +7,17 @@
 
 package test.wsdl.terra;
 
-import org.apache.axis.AxisFault;
-
-import java.net.ConnectException;
+import java.net.URL;
 
 public class TerraServiceTestCase extends junit.framework.TestCase {
     public TerraServiceTestCase(java.lang.String name) {
         super(name);
     }
 
-    public void test11TerraServiceSoapGetPlaceList() {
+    public void test11TerraServiceSoapGetPlaceList() throws Exception {
         TerraServiceSoap binding;
         try {
-            binding = new TerraServiceLocator().getTerraServiceSoap();
+            binding = new TerraServiceLocator().getTerraServiceSoap(new URL("http://localhost:" + System.getProperty("mock.httpPort", "9080") + "/terraservice"));
         }
         catch (javax.xml.rpc.ServiceException jre) {
             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
@@ -43,14 +41,6 @@ public class TerraServiceTestCase extend
             }
         }
         catch (java.rmi.RemoteException re) {
-            if (re instanceof AxisFault) {
-                AxisFault fault = (AxisFault) re;
-                if (fault.detail instanceof ConnectException ||
-                    fault.getFaultCode().getLocalPart().equals("HTTP")) {
-                    System.err.println("TerraService HTTP error: " + fault);
-                    return;
-                }
-            }
             throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
         }
     }