Author: sergeyb
Date: Wed Feb  5 12:46:17 2014
New Revision: 1564749

URL: http://svn.apache.org/r1564749
Log:
[CXF-5542] Doing the best effort to prevent the loss of TL contexts when 
providers are shared between the components with different buses

Modified:
    
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
    
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
    
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
    
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/web.xml

Modified: 
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java?rev=1564749&r1=1564748&r2=1564749&view=diff
==============================================================================
--- 
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
 (original)
+++ 
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomInFaultyInterceptor.java
 Wed Feb  5 12:46:17 2014
@@ -28,7 +28,7 @@ import org.apache.cxf.phase.Phase;
 public class CustomInFaultyInterceptor extends 
AbstractPhaseInterceptor<Message> {
 
     public CustomInFaultyInterceptor() {
-        super(Phase.PRE_INVOKE);
+        super(Phase.PRE_LOGICAL);
     }
 
     public void handleMessage(Message message) throws Fault {

Modified: 
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java?rev=1564749&r1=1564748&r2=1564749&view=diff
==============================================================================
--- 
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
 (original)
+++ 
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
 Wed Feb  5 12:46:17 2014
@@ -97,6 +97,7 @@ public class JAXRSClientServerResourceJa
             "http://localhost:"; + PORT + "/webapp/store2";
         BookStoreSpring proxy = JAXRSClientFactory.create(endpointAddress, 
BookStoreSpring.class, 
             Collections.singletonList(new JacksonJsonProvider()));
+        
WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(10000000L);
         List<SuperBook> books = 
             proxy.echoSuperBookCollectionJson(Collections.singletonList(new 
SuperBook("Super", 124L, true)));
         assertEquals(124L, books.get(0).getId());
@@ -119,7 +120,7 @@ public class JAXRSClientServerResourceJa
     public void testEchoGenericSuperBookCollectionProxy() throws Exception {
         
         String endpointAddress =
-            "http://localhost:"; + PORT + "/webapp/genericstore";
+            "http://localhost:"; + PORT + "/webapp/custombus/genericstore";
         GenericBookStoreSpring proxy = 
JAXRSClientFactory.create(endpointAddress, 
             GenericBookStoreSpring.class, Collections.singletonList(new 
JacksonJsonProvider()));
         List<SuperBook> books = 
@@ -132,7 +133,7 @@ public class JAXRSClientServerResourceJa
     public void testEchoGenericSuperBookProxy() throws Exception {
         
         String endpointAddress =
-            "http://localhost:"; + PORT + "/webapp/genericstore";
+            "http://localhost:"; + PORT + "/webapp/custombus/genericstore";
         GenericBookStoreSpring proxy = 
JAXRSClientFactory.create(endpointAddress, 
             GenericBookStoreSpring.class, Collections.singletonList(new 
JacksonJsonProvider()));
         
WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(1000000000L);
@@ -271,7 +272,7 @@ public class JAXRSClientServerResourceJa
     public void testEchoGenericSuperBookWebClient() throws Exception {
         
         String endpointAddress = 
-            "http://localhost:"; + PORT + 
"/webapp/genericstore/books/superbook";
+            "http://localhost:"; + PORT + 
"/webapp/custombus/genericstore/books/superbook";
         WebClient wc = WebClient.create(endpointAddress, 
                                         Collections.singletonList(new 
JacksonJsonProvider()));
         wc.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON);
@@ -284,7 +285,7 @@ public class JAXRSClientServerResourceJa
     public void testEchoGenericSuperBookWebClientXml() throws Exception {
         
         String endpointAddress = 
-            "http://localhost:"; + PORT + 
"/webapp/genericstore/books/superbook";
+            "http://localhost:"; + PORT + 
"/webapp/custombus/genericstore/books/superbook";
         WebClient wc = WebClient.create(endpointAddress);
         wc.accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML);
         SuperBook book = wc.post(new SuperBook("Super", 124L, true), 
SuperBook.class);
@@ -296,7 +297,7 @@ public class JAXRSClientServerResourceJa
     public void testEchoGenericSuperBookCollectionWebClient() throws Exception 
{
         
         String endpointAddress = 
-            "http://localhost:"; + PORT + 
"/webapp/genericstore/books/superbooks";
+            "http://localhost:"; + PORT + 
"/webapp/custombus/genericstore/books/superbooks";
         WebClient wc = WebClient.create(endpointAddress, 
                                         Collections.singletonList(new 
JacksonJsonProvider()));
         
WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(100000000L);
@@ -314,7 +315,7 @@ public class JAXRSClientServerResourceJa
     public void testGetGenericSuperBookCollectionWebClient() throws Exception {
         
         String endpointAddress = 
-            "http://localhost:"; + PORT + 
"/webapp/genericstore/books/superbooks2";
+            "http://localhost:"; + PORT + 
"/webapp/custombus/genericstore/books/superbooks2";
         WebClient wc = WebClient.create(endpointAddress, 
                                         Collections.singletonList(new 
JacksonJsonProvider()));
         
WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(100000000L);
@@ -331,7 +332,7 @@ public class JAXRSClientServerResourceJa
     public void testEchoGenericSuperBookCollectionWebClientXml() throws 
Exception {
         
         String endpointAddress = 
-            "http://localhost:"; + PORT + 
"/webapp/genericstore/books/superbooks";
+            "http://localhost:"; + PORT + 
"/webapp/custombus/genericstore/books/superbooks";
         WebClient wc = WebClient.create(endpointAddress);
         wc.accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML);
         Collection<? extends SuperBook> books = 

Modified: 
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml?rev=1564749&r1=1564748&r2=1564749&view=diff
==============================================================================
--- 
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
 (original)
+++ 
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
 Wed Feb  5 12:46:17 2014
@@ -20,13 +20,16 @@
 <beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:jaxrs="http://cxf.apache.org/jaxrs";
+  xmlns:core="http://cxf.apache.org/core";
   xsi:schemaLocation="
 http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/core
+http://cxf.apache.org/schemas/core.xsd
 http://cxf.apache.org/jaxrs
 http://cxf.apache.org/schemas/jaxrs.xsd";>
        <import resource="classpath:/META-INF/cxf/cxf.xml"/>
-
+    
     <jaxrs:server id="bookservice"
                   address="/store1">
         <jaxrs:serviceBeans>
@@ -47,7 +50,10 @@ http://cxf.apache.org/schemas/jaxrs.xsd";
         </jaxrs:providers>
     </jaxrs:server>
     
+    <core:bus name="cxf1" id="cxf1"/>
+    
     <jaxrs:server id="genericBookStore"
+                  bus="cxf1"
                   address="/genericstore">
         <jaxrs:serviceBeans>
             <ref bean="gBookStore"/>

Modified: 
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/web.xml?rev=1564749&r1=1564748&r2=1564749&view=diff
==============================================================================
--- 
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/web.xml
 (original)
+++ 
cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/web.xml
 Wed Feb  5 12:46:17 2014
@@ -20,21 +20,45 @@
 -->
 <!-- START SNIPPET: webxml -->
 <web-app>
+  <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>WEB-INF/beans.xml</param-value>
+    </context-param>
+    <listener>
+        <listener-class>
+            org.springframework.web.context.ContextLoaderListener
+        </listener-class>
+    </listener>
     <servlet>
         <servlet-name>CXFServlet</servlet-name>
         <display-name>CXF Servlet</display-name>
         <servlet-class>
-                        org.apache.cxf.transport.servlet.CXFServlet
-                </servlet-class>
+            org.apache.cxf.transport.servlet.CXFServlet
+        </servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet>
+        <servlet-name>CXFServletBus</servlet-name>
+        <display-name>CXF Servlet Bus</display-name>
+        <servlet-class>
+            org.apache.cxf.transport.servlet.CXFServlet
+        </servlet-class>
         <init-param>
-            <param-name>config-location</param-name>
-            <param-value>/WEB-INF/beans.xml</param-value>
+            <param-name>bus</param-name>
+            <param-value>
+                  cxf1
+            </param-value>
         </init-param>
+        
         <load-on-startup>1</load-on-startup>
     </servlet>
     <servlet-mapping>
         <servlet-name>CXFServlet</servlet-name>
         <url-pattern>/*</url-pattern>
     </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>CXFServletBus</servlet-name>
+        <url-pattern>/custombus/*</url-pattern>
+    </servlet-mapping>
 </web-app>
 <!-- END SNIPPET: webxml -->


Reply via email to