cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r808925 - in /cxf/trunk: 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/
Date Fri, 28 Aug 2009 15:51:23 GMT
Author: sergeyb
Date: Fri Aug 28 15:51:22 2009
New Revision: 808925

URL: http://svn.apache.org/viewvc?rev=808925&view=rev
Log:
JAXRS : adding tests for http conduits with url or qname ids

Added:
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
  (with props)
Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java?rev=808925&r1=808924&r2=808925&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java Fri
Aug 28 15:51:22 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/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java?rev=808925&r1=808924&r2=808925&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
Fri Aug 28 15:51:22 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/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java?rev=808925&r1=808924&r2=808925&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
Fri Aug 28 15:51:22 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());
+        
+    }
+    
 }

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml?rev=808925&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
(added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
Fri Aug 28 15:51:22 2009
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+       xmlns:sec="http://cxf.apache.org/configuration/security"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans                 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+        http://cxf.apache.org/transports/http/configuration         http://cxf.apache.org/schemas/configuration/http-conf.xsd
+        http://cxf.apache.org/transports/http-jetty/configuration   http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+        http://cxf.apache.org/configuration/security                http://cxf.apache.org/schemas/configuration/security.xsd
+        ">
+
+    <httpj:engine-factory id="port-9095-tls-config">
+        <httpj:engine port="9095">
+            <httpj:tlsServerParameters>
+               <sec:keyManagers keyPassword="password">
+	           <sec:keyStore type="JKS" password="password" 
+	                file="src/test/java/org/apache/cxf/systest/http/resources/Bethal.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>
+            </httpj:tlsServerParameters>
+        </httpj:engine>
+    </httpj:engine-factory>
+
+    <!-- -->
+    <!-- HTTP/S configuration for proxy & web clients -->
+    <!-- -->
+    <http:conduit name="https://localhost:9095/bookstore/securebooks.*">
+        <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>
+
+</beans>
\ No newline at end of file

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-url.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml?rev=808925&r1=808924&r2=808925&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml
Fri Aug 28 15:51:22 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">



Mime
View raw message