You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2009/08/29 20:01:24 UTC

svn commit: r809181 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ systests/src/test/java/org/apache/cxf/systest/jaxrs/security/

Author: sergeyb
Date: Sat Aug 29 18:01:23 2009
New Revision: 809181

URL: http://svn.apache.org/viewvc?rev=809181&view=rev
Log:
Merged revisions 808925 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r808925 | sergeyb | 2009-08-28 16:51:22 +0100 (Fri, 28 Aug 2009) | 1 line
  
  JAXRS : adding tests for http conduits with url or qname ids
........

Added:
    cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
      - copied unchanged from r808925, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
    cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
    cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug 29 18:01:23 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231-797233,797442,797505,797517,797534,797581-797583,797587,797640,797651,797699,797882-797883,798344-798346,798363,798461,798479,798533,798551,798557,798561-798562,798570,798573,79858
 4,798654,798748-798749,798816,798891,798929-798930,799245,799267,799439,799448,799637,799723-799724,799792,800453,800497-800498,801380-801381,801447,801962,802892,803056,803129,803174,803419,803460,803493,803689,804002,804175,804276,805784,805907,805909,806020-806021,806023,806405-806406,806576,806602-806604,806620,806627,806631,806633,806638,806687,806876,806922,806979-806982,807181,807205,807295,807748,807807,808035,808069,808085,808107,808464,808488,808885
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231-797233,797442,797505,797517,797534,797581-797583,797587,797640,797651,797699,797882-797883,798344-798346,798363,798461,798479,798533,798551,798557,798561-798562,798570,798573,79858
 4,798654,798748-798749,798816,798891,798929-798930,799245,799267,799439,799448,799637,799723-799724,799792,800453,800497-800498,801380-801381,801447,801962,802892,803056,803129,803174,803419,803460,803493,803689,804002,804175,804276,805784,805907,805909,806020-806021,806023,806405-806406,806576,806602-806604,806620,806627,806631,806633,806638,806687,806876,806922,806979-806982,807181,807205,807295,807748,807807,808035,808069,808085,808107,808464,808488,808885,808925

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java?rev=809181&r1=809180&r2=809181&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java Sat Aug 29 18:01:23 2009
@@ -89,9 +89,9 @@
         if (address == null) {
             Class primaryClass = classResourceInfos.get(0).getServiceClass();
             String ns = PackageUtils.getNamespace(PackageUtils.getPackageName(primaryClass));
-            return new QName(ns + "jaxrs", primaryClass.getSimpleName());
+            return new QName(ns, primaryClass.getSimpleName());
         } else {
-            return new QName(address, "WebResource");
+            return new QName(address, "WebClient");
         }
     }
 

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java?rev=809181&r1=809180&r2=809181&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java Sat Aug 29 18:01:23 2009
@@ -33,6 +33,7 @@
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.HTTPConduit;
 
 public class ClientConfiguration implements InterceptorProvider {
 
@@ -103,6 +104,16 @@
         return getConduitSelector().selectConduit(message);
     }
     
+    public HTTPConduit getHttpConduit() {
+        Message message = new MessageImpl();
+        Exchange exchange = new ExchangeImpl();
+        message.setExchange(exchange);
+        exchange.put(MessageObserver.class, new ClientMessageObserver(this));
+        exchange.put(Bus.class, bus);
+        Conduit conduit = getConduitSelector().selectConduit(message);
+        return conduit instanceof HTTPConduit ? (HTTPConduit)conduit : null;
+    }
+    
     public Map<String, Object> getResponseContext() {
         return responseContext;
     }

Modified: cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java?rev=809181&r1=809180&r2=809181&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java (original)
+++ cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java Sat Aug 29 18:01:23 2009
@@ -34,6 +34,8 @@
 
     private static final String CLIENT_CONFIG_FILE =
         "org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml";
+    private static final String CLIENT_CONFIG_FILE2 =
+        "org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml";
         
     @BeforeClass
     public static void startServers() throws Exception {
@@ -55,6 +57,20 @@
     }
     
     @Test
+    public void testGetBook123ProxyWithURLConduitId() throws Exception {
+        
+        BookStore bs = JAXRSClientFactory.create("https://localhost:9095", BookStore.class, 
+                                                 CLIENT_CONFIG_FILE2);
+        // just to verify the interface call goes through CGLIB proxy too
+        assertEquals("https://localhost:9095", WebClient.client(bs).getBaseURI().toString());
+        Book b = bs.getSecureBook("123");
+        assertEquals(b.getId(), 123);
+        b = bs.getSecureBook("123");
+        assertEquals(b.getId(), 123);
+    }
+    
+    
+    @Test
     public void testGetBook123ProxyToWebClient() throws Exception {
         
         BookStore bs = JAXRSClientFactory.create("https://localhost:9095", BookStore.class, 
@@ -97,4 +113,16 @@
         
     }
     
+    @Test
+    public void testGetBook123WebClientWithURLConduitId() throws Exception {
+        
+        WebClient client = WebClient.create("https://localhost:9095", CLIENT_CONFIG_FILE2);
+        assertEquals("https://localhost:9095", client.getBaseURI().toString());
+        
+        client.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
+        Book b = client.get(Book.class);
+        assertEquals(123, b.getId());
+        
+    }
+    
 }

Modified: cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml?rev=809181&r1=809180&r2=809181&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml (original)
+++ cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml Sat Aug 29 18:01:23 2009
@@ -45,9 +45,26 @@
     </httpj:engine-factory>
 
     <!-- -->
-    <!-- HTTP/S configuration for clients -->
+    <!-- HTTP/S configuration for proxy clients -->
     <!-- -->
-    <http:conduit name="*.http-conduit">
+    <http:conduit name="{http://jaxrs.systest.cxf.apache.org/}BookStore.http-conduit">
+        <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
+        <http:tlsClientParameters disableCNCheck="true">
+            <sec:keyManagers keyPassword="password">
+	           <sec:keyStore type="JKS" password="password" 
+	                file="src/test/java/org/apache/cxf/systest/http/resources/Morpit.jks"/>
+	           </sec:keyManagers>
+	        <sec:trustManagers>
+	           <sec:keyStore type="JKS" password="password"
+	               file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/>
+	        </sec:trustManagers>
+        </http:tlsClientParameters>
+    </http:conduit>
+    
+    <!-- -->
+    <!-- HTTP/S configuration for web clients -->
+    <!-- -->
+    <http:conduit name="{https://localhost:9095}WebClient.http-conduit">
         <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
         <http:tlsClientParameters disableCNCheck="true">
             <sec:keyManagers keyPassword="password">