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/26 12:53:57 UTC
svn commit: r1127863 - in /cxf/branches/2.3.x-fixes: ./
systests/databinding/src/test/java/org/apache/cxf/systest/aegis/
Author: ffang
Date: Thu May 26 10:53:56 2011
New Revision: 1127863
URL: http://svn.apache.org/viewvc?rev=1127863&view=rev
Log:
Merged revisions 1127858 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1127858 | ffang | 2011-05-26 18:30:55 +0800 (四, 26 5 2011) | 1 line
[CXF-3527]more test scenario using aegis with generic
........
Modified:
cxf/branches/2.3.x-fixes/ (props changed)
cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java?rev=1127863&r1=1127862&r2=1127863&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java (original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java Thu May 26 10:53:56 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/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java?rev=1127863&r1=1127862&r2=1127863&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java (original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java Thu May 26 10:53:56 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/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java?rev=1127863&r1=1127862&r2=1127863&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java (original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java Thu May 26 10:53:56 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();
+ }
}