You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2011/05/25 12:12:26 UTC

svn commit: r1127459 - in /cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis: AegisClientServerTest.java SportsService.java SportsServiceImpl.java

Author: ffang
Date: Wed May 25 10:12:26 2011
New Revision: 1127459

URL: http://svn.apache.org/viewvc?rev=1127459&view=rev
Log:
[CXF-3526]add testcase to demostrate how to use inherited nested map

Modified:
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
    cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java?rev=1127459&r1=1127458&r2=1127459&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java (original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java Wed May 25 10:12:26 2011
@@ -24,6 +24,7 @@ import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import org.w3c.dom.Document;
@@ -36,6 +37,8 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.test.TestUtilities;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -145,6 +148,8 @@ public class AegisClientServerTest exten
         proxyFactory.setDataBinding(aegisBinding);
         proxyFactory.setServiceClass(SportsService.class);
         proxyFactory.setWsdlLocation("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl");
+        proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
+        proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
         SportsService service = (SportsService) proxyFactory.create();
 
         Collection<Team> teams = service.getTeams();
@@ -157,6 +162,24 @@ public class AegisClientServerTest exten
     }
     
     @Test
+    public void testComplexMapResult() throws Exception {
+        AegisDatabinding aegisBinding = new AegisDatabinding();
+        JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
+        proxyFactory.setDataBinding(aegisBinding);
+        proxyFactory.setServiceClass(SportsService.class);
+        proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
+        proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
+        proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
+        SportsService service = (SportsService) proxyFactory.create();
+        Map<String, Map<Integer, Integer>> result = service.testComplexMapResult();
+        assertEquals(result.size(), 1);
+        assertTrue(result.containsKey("key1"));
+        assertNotNull(result.get("key1"));
+        assertEquals(result.toString(), "{key1={1=3}}");
+    }
+    
+          
+    @Test
     public void testDynamicClient() throws Exception {
         DynamicClientFactory dcf = DynamicClientFactory.newInstance();
         Client client = dcf.createClient("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl");

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java?rev=1127459&r1=1127458&r2=1127459&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java (original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java Wed May 25 10:12:26 2011
@@ -20,15 +20,27 @@
 package org.apache.cxf.systest.aegis;
 
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.jws.WebService;
 
 @WebService(targetNamespace = "http://cxf.apache.org/systest/aegis/sports")
 public interface SportsService {
     Collection<Team> getTeams();
-    
+
     String testForMinOccurs0(String a, Integer b, String c);
+
     AttributeBean getAttributeBean();
+
     BeanWithCharacter getCharBean();
-}
 
+    public class CustomerMap extends HashMap<String, Map<Integer, Integer>> {
+        private static final long serialVersionUID = 6235169270166551322L;
+    }
+
+    public class SimpleMapResult extends HashMap<String, Integer> {
+    }
+
+    Map<String, Map<Integer, Integer>> testComplexMapResult();
+}

Modified: cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java?rev=1127459&r1=1127458&r2=1127459&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java (original)
+++ cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java Wed May 25 10:12:26 2011
@@ -21,7 +21,10 @@ package org.apache.cxf.systest.aegis;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+
 
 /**
  * 
@@ -46,5 +49,16 @@ public class SportsServiceImpl implement
     public BeanWithCharacter getCharBean() {
         return new BeanWithCharacter();
     }
+    
+   
+    public Map<String, Map<Integer, Integer>> testComplexMapResult() {
+        CustomerMap result 
+            = new CustomerMap();
+        Map<Integer, Integer> map1 = new HashMap<Integer, Integer>();
+        map1.put(1, 3);
+        result.put("key1", map1);
+        return result;
 
+    }
+      
 }