cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1127858 - in /cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis: AegisClientServerTest.java SportsService.java SportsServiceImpl.java
Date Thu, 26 May 2011 10:30:55 GMT
Author: ffang
Date: Thu May 26 10:30:55 2011
New Revision: 1127858

URL: http://svn.apache.org/viewvc?rev=1127858&view=rev
Log:
[CXF-3527]more test scenario using aegis with generic

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=1127858&r1=1127857&r2=1127858&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
Thu May 26 10:30:55 2011
@@ -41,6 +41,7 @@ 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.systest.aegis.SportsService.Pair;
 import org.apache.cxf.test.TestUtilities;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.junit.BeforeClass;
@@ -194,6 +195,66 @@ public class AegisClientServerTest exten
         String ret = service.getGeneric(list);
         assertEquals(ret, "ffang");
     }
+    
+    @Test
+    public void testGenericPair() 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();
+        Pair<String, Integer> ret = service.getReturnGenericPair("ffang", 111);
+        assertEquals("ffang", ret.getFirst());
+        assertEquals(new Integer(111), ret.getSecond());
+    }
+    
+    @Test
+    public void testReturnQualifiedPair() 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();
+        Pair<Integer, String> ret = service.getReturnQualifiedPair(111, "ffang");
+        assertEquals(new Integer(111), ret.getFirst());
+        assertEquals("ffang", ret.getSecond());
+    }
+
+    
+    @Test
+    public void testReturnGenericPair() 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();
+        int ret = service.getGenericPair(new Pair<Integer, String>(111, "String"));
+        assertEquals(111, ret);
+    }
+    
+    @Test
+    public void testQualifiedPair() 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();
+        int ret = service.getQualifiedPair(new Pair<Integer, String>(111, "ffang"));
+        assertEquals(111, ret);
+    }
+
           
     @Test
     public void testDynamicClient() throws Exception {

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=1127858&r1=1127857&r2=1127858&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
Thu May 26 10:30:55 2011
@@ -38,6 +38,41 @@ public interface SportsService {
     public class CustomerMap extends HashMap<String, Map<Integer, Integer>> {
         private static final long serialVersionUID = 6235169270166551322L;
     }
+    
+    public static class Pair<T1, T2> {
+        private T1 first;
+        private T2 second;
+
+        public Pair() {
+
+        }
+
+        public Pair(T1 first, T2 second) {
+            this.first = first;
+            this.second = second;
+        }
+
+        public T1 getFirst() {
+            return first;
+        }
+
+        public T2 getSecond() {
+            return second;
+        }
+
+        public void setFirst(T1 first) {
+            this.first = first;
+        }
+
+        public void setSecond(T2 second) {
+            this.second = second;
+        }
+
+        public String toString() {
+            return "first: " + getFirst() + " second: " + getSecond();
+        }
+    }
+
 
     public class SimpleMapResult extends HashMap<String, Integer> {
     }
@@ -45,4 +80,12 @@ public interface SportsService {
     Map<String, Map<Integer, Integer>> testComplexMapResult();
     
     <T> T getGeneric(Collection<T> collection);
+    
+    <T1, T2> Pair<T1, T2> getReturnGenericPair(T1 first, T2 second);
+    
+    Pair<Integer, String> getReturnQualifiedPair(Integer first, String second);
+    
+    <T1, T2> int getGenericPair(Pair<T1, T2> pair);
+    
+    int getQualifiedPair(Pair<Integer, String> pair);
 }

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=1127858&r1=1127857&r2=1127858&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
Thu May 26 10:30:55 2011
@@ -72,5 +72,25 @@ public class SportsServiceImpl implement
         }
         return ret;
     }
+
+    
+    public <T1, T2> Pair<T1, T2> getReturnGenericPair(T1 first, T2 second) {
+        return new Pair<T1, T2>(first, second);
+    }
+
+   
+    public Pair<Integer, String> getReturnQualifiedPair(Integer first, String second)
{
+        return new Pair<Integer, String>(first, second);
+    }
+
+    
+    public <T1, T2> int getGenericPair(Pair<T1, T2> pair) {
+        return (Integer) pair.getFirst();
+    }
+
+   
+    public int getQualifiedPair(Pair<Integer, String> pair) {
+        return pair.getFirst();
+    }
       
 }



Mime
View raw message