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 2013/05/07 19:15:59 UTC

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

Author: sergeyb
Date: Tue May  7 17:15:59 2013
New Revision: 1479984

URL: http://svn.apache.org/r1479984
Log:
Merged revisions 1479982 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1479982 | sergeyb | 2013-05-07 18:03:11 +0100 (Tue, 07 May 2013) | 1 line
  
  [CXF-4953] Updating FrontendClientAdapter and ClientConfiguration to return Endpoint
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1479982

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

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java?rev=1479984&r1=1479983&r2=1479984&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java Tue May  7 17:15:59 2013
@@ -232,4 +232,8 @@ public class ClientConfiguration impleme
     public Map<String, Object> getRequestContext() {
         return requestContext;
     }
+
+    public Endpoint getEndpoint() {
+        return conduitSelector == null ? null : conduitSelector.getEndpoint();
+    }
 }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java?rev=1479984&r1=1479983&r2=1479984&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java Tue May  7 17:15:59 2013
@@ -88,11 +88,36 @@ class FrontendClientAdapter implements o
     
     @Override
     public Endpoint getEndpoint() {
-        throw new UnsupportedOperationException();
+        return config.getEndpoint();
     }
     
     @Override
     public void destroy() {
+        //complete, the actual JAX-RS Client will be closed via a different path 
+    }
+    
+    @Override
+    public Map<String, Object> getRequestContext() {
+        return config.getRequestContext();
+    }
+
+    @Override
+    public Map<String, Object> getResponseContext() {
+        return config.getResponseContext();
+    }
+    
+    @Override
+    public void setThreadLocalRequestContext(boolean b) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isThreadLocalRequestContext() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setExecutor(Executor executor) {
         throw new UnsupportedOperationException();
     }
     
@@ -184,28 +209,4 @@ class FrontendClientAdapter implements o
         throw new UnsupportedOperationException();
     }
 
-    @Override
-    public Map<String, Object> getRequestContext() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Map<String, Object> getResponseContext() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void setThreadLocalRequestContext(boolean b) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean isThreadLocalRequestContext() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void setExecutor(Executor executor) {
-        throw new UnsupportedOperationException();
-    }
 }

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java?rev=1479984&r1=1479983&r2=1479984&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java Tue May  7 17:15:59 2013
@@ -22,6 +22,11 @@ package org.apache.cxf.systest.jaxrs.sec
 import javax.ws.rs.core.MediaType;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.ClientLifeCycleListener;
+import org.apache.cxf.endpoint.ClientLifeCycleManager;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -34,7 +39,6 @@ import org.junit.Test;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-
 public class JAXRSHttpsBookTest extends AbstractBusClientServerTestBase {
     public static final String PORT = BookHttpsServer.PORT;
 
@@ -128,8 +132,14 @@ public class JAXRSHttpsBookTest extends 
         Object bean = ctx.getBean("bookService.proxyFactory");
         assertNotNull(bean);
         JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
-        
+        Bus bus = cfb.getBus();
+        ClientLifeCycleManager manager = bus.getExtension(ClientLifeCycleManager.class);
+        TestClientLifeCycleListener listener = new TestClientLifeCycleListener();
+        manager.registerListener(listener);
         BookStore bs = cfb.create(BookStore.class);
+        assertNotNull(listener.getEp());
+        assertEquals("{http://service.rs}BookService", 
+                     listener.getEp().getEndpointInfo().getName().toString());
         assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
         Book b = bs.getSecureBook("123");
         assertEquals(b.getId(), 123);
@@ -204,4 +214,25 @@ public class JAXRSHttpsBookTest extends 
             this.id = id;
         }
     }
+    
+    public static class TestClientLifeCycleListener implements ClientLifeCycleListener {
+
+        private Endpoint ep;
+        
+        @Override
+        public void clientCreated(Client client) {
+            this.ep = client.getEndpoint();
+        }
+
+        @Override
+        public void clientDestroyed(Client client) {
+            ep = null;
+            
+        }
+
+        public Endpoint getEp() {
+            return ep;
+        }
+        
+    }
 }