Author: dkulp
Date: Fri Sep 12 13:19:46 2008
New Revision: 694795

URL: http://svn.apache.org/viewvc?rev=694795&view=rev
Log:
Don't go into multiplex mode if mulitplexing won't actually accomplish anything.

Modified:
    
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
    
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
    
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/Server.java

Modified: 
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=694795&r1=694794&r2=694795&view=diff
==============================================================================
--- 
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
 (original)
+++ 
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
 Fri Sep 12 13:19:46 2008
@@ -724,6 +724,33 @@
 
         if (mo instanceof ChainInitiationObserver) {
             ChainInitiationObserver cio = (ChainInitiationObserver) mo;
+            
+            Binding b = e.getBinding();
+            Binding b2 = cio.getEndpoint().getBinding();
+            if (b == b2) {
+                //re-registering the same endpoint?
+                return;
+            }
+            Object o = cio.getEndpoint().get("allow-multiplex-endpoint");
+            if (o instanceof String) {
+                o = Boolean.parseBoolean((String)o);
+            } else if (o == null) {
+                o = Boolean.FALSE;
+            }
+            
+            if (b instanceof org.apache.cxf.binding.soap.SoapBinding 
+                && b2 instanceof org.apache.cxf.binding.soap.SoapBinding
+                && 
((org.apache.cxf.binding.soap.SoapBinding)b).getSoapVersion()
+                    
.equals(((org.apache.cxf.binding.soap.SoapBinding)b2).getSoapVersion())
+                && Boolean.FALSE.equals(o)) {
+                
+                throw new RuntimeException("Soap " 
+                                           + 
((org.apache.cxf.binding.soap.SoapBinding)b)
+                                               .getSoapVersion().getVersion()
+                                           + " endpoint already registered on 
address "
+                                           + e.getEndpointInfo().getAddress());
+            }
+            
             MultipleEndpointObserver newMO = new 
MultipleEndpointObserver(getBus()) {
                 @Override
                 protected Message createMessage(Message message) {

Modified: 
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml?rev=694795&r1=694794&r2=694795&view=diff
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
 (original)
+++ 
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
 Fri Sep 12 13:19:46 2008
@@ -52,7 +52,7 @@
     implementor="#greeter" address="http://localhost:8080/simpeWithHttpBinding";
     bindingUri="http://cxf.apache.org/bindings/xformat"/>
     
-  <jaxws:endpoint id="inlineImplementor" 
address="http://localhost:8080/simpleWithAddress";>
+  <jaxws:endpoint id="inlineImplementor" 
address="http://localhost:8080/simpleWithAddress2";>
     <jaxws:implementor>
       <bean class="org.apache.hello_world_soap_http.GreeterImpl">
          <property name="prefix" value="hello"/>
@@ -61,13 +61,13 @@
   </jaxws:endpoint>
   
   <jaxws:endpoint id="simpleWithBinding" 
-    implementor="#greeter" address="http://localhost:8080/simpleWithAddress";>
+    implementor="#greeter" address="http://localhost:8080/simpleWithAddress3";>
        <jaxws:binding>
           <soap:soapBinding mtomEnabled="true" version="1.2"/>
        </jaxws:binding>
   </jaxws:endpoint>      
   
-  <jaxws:endpoint id="inlineInvoker" 
address="http://localhost:8080/simpleWithAddress";>
+  <jaxws:endpoint id="inlineInvoker" 
address="http://localhost:8080/simpleWithAddress4";>
     <jaxws:implementor>
       <bean class="org.apache.hello_world_soap_http.GreeterImpl"/>
     </jaxws:implementor>
@@ -88,12 +88,12 @@
     implementor="org.apache.cxf.jaxws.service.Hello"
     endpointName="e:HelloEndpointCustomized"
     serviceName="s:HelloServiceCustomized"
-    address="http://localhost:8080/test";
+    address="http://localhost:8080/test0";
     xmlns:e="http://service.jaxws.cxf.apache.org/endpoint";
     xmlns:s="http://service.jaxws.cxf.apache.org/service"/>
     
   <jaxws:endpoint id="wsdlLocation" 
-    implementor="#greeter" address="http://localhost:8080/simpleWithAddress";
+    implementor="#greeter" address="http://localhost:8080/simpleWithAddress5";
     wsdlLocation="wsdl/hello_world.wsdl"/>
     
   <bean id="saajIn" 
class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
@@ -101,7 +101,7 @@
       
   <jaxws:endpoint id="epWithInterceptors" 
     implementor="org.apache.cxf.jaxws.service.Hello"
-    address="http://localhost:8080/test";>
+    address="http://localhost:8080/test1";>
        <jaxws:inInterceptors>
          <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
          <ref bean="saajIn"/>
@@ -113,13 +113,13 @@
   </jaxws:endpoint>
 
   <jaxws:endpoint implementor="org.apache.cxf.jaxws.service.Hello"
-    address="http://localhost:8080/test"/>
+    address="http://localhost:8080/test2"/>
     
     
   <jaxws:endpoint id="implementorClass"
     implementor="java.lang.Object"
     implementorClass="org.apache.cxf.jaxws.service.Hello"
-    address="http://localhost:8080/test"/>
+    address="http://localhost:8080/test3"/>
     
   <jaxws:endpoint id="publishedEndpointUrl"
     implementor="#greeter"

Modified: 
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml?rev=694795&r1=694794&r2=694795&view=diff
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
 (original)
+++ 
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
 Fri Sep 12 13:19:46 2008
@@ -38,20 +38,21 @@
           </list>
       </property>
   </bean>
+  <bean id="greeter" class="org.apache.hello_world_soap_http.GreeterImpl"/>
 
-  <jaxws:server id="simple" serviceBean="#greeter" xmlns:test="urn:foo" 
xmlns="urn:foo"/>
+  <jaxws:server id="simple" serviceBean="#greeter" 
+        xmlns:test="urn:foo" xmlns="urn:foo"
+        address="http://localhost:8080/testrpc1"/>
 
-  <bean id="greeter" class="org.apache.hello_world_soap_http.GreeterImpl"/>
 
   <jaxws:server id="simpleWithAddress"
-    serviceBean="#greeter" address="http://localhost:8080/simpleWithAddress"/>
+    serviceBean="#greeter" address="http://localhost:8080/simpleWithAddress1"/>
 
-  <jaxws:server id="inlineImplementor" 
address="http://localhost:8080/simpleWithAddress";>
+  <jaxws:server id="inlineImplementor" 
address="http://localhost:8080/simpleWithAddress10";>
     <jaxws:serviceBean>
       <bean class="org.apache.hello_world_soap_http.GreeterImpl"/>
     </jaxws:serviceBean>
   </jaxws:server>
-
   <jaxws:server id="inlineInvoker"
     serviceClass="org.apache.hello_world_soap_http.GreeterImpl"
     address="http://localhost:8080/simpleWithAddress";
@@ -97,7 +98,7 @@
       </jaxws:dataBinding>
   </jaxws:server>
 
-   <jaxws:client id="bookClient"
+  <jaxws:client id="bookClient"
     serviceClass="org.apache.cxf.anonymous_complex_type.AnonymousComplexType"
     address="http://localhost:8080/act"/>
 
@@ -125,13 +126,11 @@
 
   <jaxws:server id="inlineDataBinding"
     serviceClass="org.apache.cxf.jaxws.service.Hello"
-    address="http://localhost:8080/test";>
+    address="http://localhost:8080/test1";>
     <jaxws:dataBinding>
       <bean class="org.apache.cxf.jaxb.JAXBDataBinding"/>
     </jaxws:dataBinding>
   </jaxws:server>
 
-  <!-- We should auto generate this id -->
-  <jaxws:server serviceBean="#greeter"/>
-
+  <jaxws:server serviceBean="#greeter" address="http://localhost:8080/test3"/>
 </beans>

Modified: 
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/Server.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/Server.java?rev=694795&r1=694794&r2=694795&view=diff
==============================================================================
--- 
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/Server.java 
(original)
+++ 
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/Server.java 
Fri Sep 12 13:19:46 2008
@@ -36,15 +36,16 @@
         EndpointImpl ep1 = (EndpointImpl) Endpoint.publish(address, 
implementor1);
 
         ep1.getServer().getEndpoint().put("version", "1");
-        
+        ep1.getServer().getEndpoint().put("allow-multiplex-endpoint", 
Boolean.TRUE);
+
+        //Register a MediatorInInterceptor on this dummy service
+
         Object implementor2 = new GreeterImplMixedStyle(" version2");
         EndpointImpl ep2 = (EndpointImpl) Endpoint.publish(address, 
implementor2);
         ep2.getServer().getEndpoint().put("version", "2");
         
-        //Register a MediatorInInterceptor on this dummy service
-        
         MultipleEndpointObserver meo = (MultipleEndpointObserver)
-            ep2.getServer().getDestination().getMessageObserver();
+            ep1.getServer().getDestination().getMessageObserver();
         meo.getRoutingInterceptors().clear();
         meo.getRoutingInterceptors().add(new MediatorInInterceptor());
     }


Reply via email to