You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/10/30 05:17:27 UTC

svn commit: r709085 - in /servicemix/components/bindings/servicemix-cxf-bc/trunk/src: main/java/org/apache/servicemix/cxfbc/ test/java/org/apache/servicemix/cxfbc/provider/ test/resources/org/apache/servicemix/cxfbc/provider/

Author: ffang
Date: Wed Oct 29 21:17:25 2008
New Revision: 709085

URL: http://svn.apache.org/viewvc?rev=709085&view=rev
Log:
[SM-1600]test to guarantee conduit is created for each cxf bc provider endpoint but not per request

Added:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/ConduitCompareInterceptor.java   (with props)
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml   (with props)
Modified:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderAsyncSystemTest.java

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java?rev=709085&r1=709084&r2=709085&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java Wed Oct 29 21:17:25 2008
@@ -155,6 +155,7 @@
         Message message = ep.getBinding().createMessage();
         message.put(MessageExchange.class, exchange);
         Exchange cxfExchange = new ExchangeImpl();
+        cxfExchange.setConduit(conduit);
         cxfExchange.setSynchronous(isSynchronous());
         cxfExchange.put(MessageExchange.class, exchange);
         

Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/ConduitCompareInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/ConduitCompareInterceptor.java?rev=709085&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/ConduitCompareInterceptor.java (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/ConduitCompareInterceptor.java Wed Oct 29 21:17:25 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.cxfbc.provider;
+
+import org.apache.cxf.binding.jbi.JBIFault;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.transport.Conduit;
+
+public class ConduitCompareInterceptor extends AbstractPhaseInterceptor {
+    
+    private Conduit preConduit;
+    private boolean firstInvocation = true;
+    
+    public ConduitCompareInterceptor() {
+        super(Phase.PRE_STREAM);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        if (firstInvocation) {
+            firstInvocation = false;
+            preConduit = message.getExchange().getConduit(message);
+        } else {
+            if (preConduit != message.getExchange().getConduit(message)) {
+                throw new JBIFault("not use the same conduit between different invocation");
+            }
+            preConduit = message.getExchange().getConduit(message);
+        }
+
+    }
+
+}

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/ConduitCompareInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/ConduitCompareInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderAsyncSystemTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderAsyncSystemTest.java?rev=709085&r1=709084&r2=709085&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderAsyncSystemTest.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderAsyncSystemTest.java Wed Oct 29 21:17:25 2008
@@ -105,6 +105,7 @@
     }    
                
     public void setUpJBI(String beanFile) throws Exception {
+        success = true;
         if (context != null) {
             context.refresh();
         }
@@ -179,6 +180,13 @@
         assertTrue(success);
     }
 
+    public void testSameConduit() throws Exception {
+        setUpJBI("org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml");
+        greetMeProviderJmsTestBase();
+        assertTrue(success);
+    }
+
+
         
     private void greetMeProviderHttpTestBase() throws Exception {
        ClientInvocationForHttp thread1 = new ClientInvocationForHttp("wait");
@@ -240,8 +248,6 @@
 	            client.done(io);
 	            if (io.getFault() != null) {
 	            	success = false;
-	            } else {
-	            	success = true;
 	            }
 			} catch (Exception e) {
 				e.printStackTrace();
@@ -278,8 +284,6 @@
 	            client.done(io); 
 	            if (io.getFault() != null) {
 	            	success = false;
-	            } else {
-	            	success = true;
 	            }
 			} catch (Exception e) {
 				e.printStackTrace();

Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml?rev=709085&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml Wed Oct 29 21:17:25 2008
@@ -0,0 +1,58 @@
+<?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:sm="http://servicemix.apache.org/config/1.0"
+       xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
+       xmlns:test="urn:test"
+       xmlns:greeter="http://apache.org/hello_world_soap_http_provider"
+       xmlns:jmsgreeter="http://apache.org/hello_world_soap_http">
+
+
+       
+  <sm:container id="jbi" embedded="true">
+    
+    <sm:endpoints>      
+      
+       
+      <cxfbc:provider wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+                      service="jmsgreeter:HelloWorldService"
+                      endpoint="HelloWorldPortProxy"
+                      interfaceName="jmsgreeter:Greetr"
+                      useJBIWrapper="false"
+                      synchronous="false"
+                     >
+          <cxfbc:inInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+          </cxfbc:inInterceptors>
+          <cxfbc:outInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+            <bean class="org.apache.servicemix.cxfbc.provider.ConduitCompareInterceptor"/>
+          </cxfbc:outInterceptors>
+          <cxfbc:inFaultInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+          </cxfbc:inFaultInterceptors>
+          <cxfbc:outFaultInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+          </cxfbc:outFaultInterceptors>
+      </cxfbc:provider>
+    </sm:endpoints>
+    
+  </sm:container>
+  
+</beans>

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_conduit.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml