cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1469374 - in /cxf/trunk: rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
Date Thu, 18 Apr 2013 15:38:41 GMT
Author: sergeyb
Date: Thu Apr 18 15:38:41 2013
New Revision: 1469374

URL: http://svn.apache.org/r1469374
Log:
[CXF-4747] Making it possible to initialize WebClient with jaxrs:client

Modified:
    cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java

Modified: cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java?rev=1469374&r1=1469373&r2=1469374&view=diff
==============================================================================
--- cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
(original)
+++ cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
Thu Apr 18 15:38:41 2013
@@ -255,7 +255,11 @@ public class JAXRSClientFactoryBean exte
      * @return the client
      */
     public Client create() { 
-        return createWithValues();
+        if (serviceClass == WebClient.class) {
+            return createWebClient();
+        } else {
+            return createWithValues();
+        }
     }
     
     /**

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java?rev=1469374&r1=1469373&r2=1469374&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
Thu Apr 18 15:38:41 2013
@@ -45,7 +45,9 @@ public class JAXRSHttpsBookTest extends 
     private static final String CLIENT_CONFIG_FILE3 =
         "org/apache/cxf/systest/jaxrs/security/jaxrs-https-client3.xml";
     private static final String CLIENT_CONFIG_FILE4 =
-        "org/apache/cxf/systest/jaxrs/security/jaxrs-https-client4.xml";    
+        "org/apache/cxf/systest/jaxrs/security/jaxrs-https-client4.xml";
+    private static final String CLIENT_CONFIG_FILE5 =
+        "org/apache/cxf/systest/jaxrs/security/jaxrs-https-client5.xml";
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly",
@@ -99,6 +101,26 @@ public class JAXRSHttpsBookTest extends 
         assertEquals(b.getId(), 123);
     }
     
+    @Test
+    public void testGetBook123WebClientFromSpringWildcard() throws Exception {
+        ClassPathXmlApplicationContext ctx =
+            new ClassPathXmlApplicationContext(new String[] {CLIENT_CONFIG_FILE5});
+        Object bean = ctx.getBean("bookService.proxyFactory");
+        assertNotNull(bean);
+        JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
+        
+        WebClient wc = (WebClient)cfb.create();
+        assertEquals("https://localhost:" + PORT, wc.getBaseURI().toString());
+        
+        wc.accept("application/xml");
+        wc.path("bookstore/securebooks/123");
+        TheBook b = wc.get(TheBook.class);
+        
+        assertEquals(b.getId(), 123);
+        b = wc.get(TheBook.class);
+        assertEquals(b.getId(), 123);
+    }
+    
     private void doTestGetBook123ProxyFromSpring(String cfgFile) throws Exception {
         
         ClassPathXmlApplicationContext ctx =



Mime
View raw message