cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r547787 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/addressing/ rt/core/src/main/java/org/apache/cxf/bus/spring/ rt/core/src/main/resources/META-INF/cxf/ rt/core/src/test/java/org/apache/cxf/workqueue/ rt/frontend/jaxws/s...
Date Fri, 15 Jun 2007 21:19:19 GMT
Author: dkulp
Date: Fri Jun 15 14:19:18 2007
New Revision: 547787

URL: http://svn.apache.org/viewvc?view=rev&rev=547787
Log:
Fix issue of putting the wsa namespace into each header twice

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
    incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
    incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java
    incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingConstants.java
Fri Jun 15 14:19:18 2007
@@ -33,20 +33,10 @@
     String getNamespaceURI();
     
     /**
-     * @return prefix associated with the WS-Addressing namespace
-     */
-    String getNamespacePrefix();
-    
-    /**
      * @return namespace defined by the normative WS-Addressing WSDL bindings
      * schema
      */
     String getWSDLNamespaceURI();
-    
-    /**
-     * @return prefix associated with the WS-Addressing WSDL bindings schema
-     */
-    String getWSDLNamespacePrefix();
     
     /**
      * @return QName of the WSDL extensiblity element

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
Fri Jun 15 14:19:18 2007
@@ -33,9 +33,20 @@
     private Bus bus;
 
     public void setApplicationContext(ApplicationContext ctx) {
-        bus = (Bus)ctx.getBean("cxf");
+        //nothing to do
+        if (bus == null) {
+            bus = (Bus)ctx.getBean("cxf");
+        }
     }
 
+    public void setBus(Bus b) {
+        bus = b;
+    } 
+    
+    public Bus getBus() {
+        return bus;
+    }
+    
     public int getOrder() {
         return 1001;
     }

Modified: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Fri Jun 15 14:19:18
2007
@@ -24,9 +24,10 @@
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
     <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
-    
     <bean class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/>
-    <bean class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/>
+    <bean class="org.apache.cxf.bus.spring.BusExtensionPostProcessor">
+       <property name="bus" ref="cxf"/>
+    </bean>
     
     <bean id="org.apache.cxf.resource.ResourceManager" class="org.apache.cxf.bus.resource.ResourceManagerImpl">
        <constructor-arg>

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
(original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
Fri Jun 15 14:19:18 2007
@@ -331,7 +331,7 @@
                                                INITIAL_SIZE, INITIAL_SIZE, 500);
 
         assertEquals(0, workqueue.getSize());
-        DeadLockThread dead = new DeadLockThread(workqueue, 100, 5L);
+        DeadLockThread dead = new DeadLockThread(workqueue, 10, 5L);
         dead.start();
         checkCompleted(dead);
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
Fri Jun 15 14:19:18 2007
@@ -51,9 +51,14 @@
     protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean)
{
         NamedNodeMap atts = element.getAttributes();
         String bus = element.getAttribute("bus");
-        if (StringUtils.isEmpty(bus) 
-            && ctx.getRegistry().containsBeanDefinition("cxf")) {
-            bean.addConstructorArgReference("cxf");
+        if (StringUtils.isEmpty(bus)) {
+            if (ctx.getRegistry().containsBeanDefinition("cxf")) {
+                bean.addConstructorArgReference("cxf");
+            }
+        } else {
+            if (ctx.getRegistry().containsBeanDefinition(bus)) {
+                bean.addConstructorArgReference(bus);
+            }
         }
         for (int i = 0; i < atts.getLength(); i++) {
             Attr node = (Attr) atts.item(i);

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingConstantsImpl.java
Fri Jun 15 14:19:18 2007
@@ -45,12 +45,6 @@
         return Names.WSA_NAMESPACE_NAME;
     }
 
-    /**
-     * @return prefix associated with the WS-Addressing namespace
-     */
-    public String getNamespacePrefix() {
-        return Names.WSA_NAMESPACE_PREFIX;
-    }
 
     /**
      * @return namespace defined by the normative WS-Addressing WSDL bindings
@@ -60,13 +54,6 @@
         return Names.WSA_NAMESPACE_WSDL_NAME;
     }
 
-    /**
-     * @return prefix associated with the WS-Addressing WSDL bindings schema
-     */
-    public String getWSDLNamespacePrefix() {
-        return Names.WSA_NAMESPACE_WSDL_PREFIX;
-    }
-    
     /**
      * @return QName of the WSDL extensiblity element
      */

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java Fri
Jun 15 14:19:18 2007
@@ -35,8 +35,6 @@
         "http://www.w3.org/2005/08/addressing";
     public static final String WSA_NAMESPACE_WSDL_NAME = 
         "http://www.w3.org/2005/02/addressing/wsdl";
-    public static final String WSA_NAMESPACE_PREFIX = "wsa";
-    public static final String WSA_NAMESPACE_WSDL_PREFIX = "wsaw";
     public static final String WSA_NAMESPACE_PATTERN = "/addressing";
 
     public static final String WSA_REFERENCE_PARAMETERS_NAME = 

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
Fri Jun 15 14:19:18 2007
@@ -47,6 +47,7 @@
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.headers.Header;
 import org.apache.cxf.helpers.CastUtils;
@@ -196,12 +197,6 @@
                 int len = children.getLength();
                 for (int i = 0; i < len; i++) {
                     Node node = children.item(i);
-                    
-                    if (node instanceof Element) {
-                        ((Element) node).setAttributeNS("http://www.w3.org/2000/xmlns/",
-                                "xmlns:" + Names.WSA_NAMESPACE_PREFIX,
-                                maps.getNamespaceURI());
-                    }
               
                     Header holder = new Header(
                             new QName(node.getNamespaceURI(), node.getLocalName()), 
@@ -239,7 +234,7 @@
                         marshaller.marshal(jaxbEl, header);
                         
                         Element lastAdded = (Element)header.getLastChild();
-                        addIsReferenceParameterMarkerAttribute(lastAdded);
+                        addIsReferenceParameterMarkerAttribute(lastAdded, maps.getNamespaceURI());
                     } else {
                         LOG.log(Level.WARNING, "IGNORE_NON_ELEMENT_REF_PARAM_MSG", o);
                     }
@@ -247,13 +242,33 @@
             }
         }
     }
-
-    private void addIsReferenceParameterMarkerAttribute(Element lastAdded) {
+ 
+    private void addIsReferenceParameterMarkerAttribute(Element lastAdded, String namespaceURI)
{
+        String pfx = lastAdded.lookupPrefix(namespaceURI);
+        if (StringUtils.isEmpty(pfx)) {
+            //attributes cannot be in empty namespace...
+            if (lastAdded.lookupNamespaceURI("wsa") == null) {
+                pfx = "wsa";
+                lastAdded.setAttributeNS("http://www.w3.org/2000/xmlns/",
+                                         "xmlns:wsa",
+                                         namespaceURI);
+            } else if (lastAdded.lookupNamespaceURI("wsa").equals(namespaceURI)) {
+                pfx = "wsa";
+            } else {
+                int cnt = 1;
+                while (lastAdded.lookupNamespaceURI("wsa" + cnt) != null) {
+                    cnt++;
+                }
+                pfx = "wsa" + cnt;
+                lastAdded.setAttributeNS("http://www.w3.org/2000/xmlns/",
+                                         "xmlns:wsa" + cnt,
+                                         namespaceURI);
+            }
+        }
         Attr isRefParamAttr = 
-            lastAdded.getOwnerDocument().createAttributeNS(Names.WSA_NAMESPACE_PREFIX, 
-                                                           IS_REFERENCE_PARAM_ATTR_NAME);
+            lastAdded.getOwnerDocument().createAttributeNS(namespaceURI, 
+                                                           pfx + ":" + IS_REFERENCE_PARAM_ATTR_NAME);
         isRefParamAttr.setTextContent("1");
-        isRefParamAttr.setPrefix(Names.WSA_NAMESPACE_PREFIX);
         lastAdded.setAttributeNodeNS(isRefParamAttr);
     }
     
@@ -560,7 +575,6 @@
         if (faultName != null) {
             String reason = ContextUtils.retrieveMAPFaultReason(message);
             throw createSOAPFaut(faultName, 
-                                           Names.WSA_NAMESPACE_PREFIX,
                                            Names.WSA_NAMESPACE_NAME,
                                            reason);
         }
@@ -575,8 +589,8 @@
      * @param reason the fault reason
      * @return a new SoapFault
      */ 
-    private SoapFault createSOAPFaut(String localName, String prefix, String namespace, String
reason) {
-        return new SoapFault(reason, new QName(namespace, localName, prefix));
+    private SoapFault createSOAPFaut(String localName, String namespace, String reason) {
+        return new SoapFault(reason, new QName(namespace, localName));
     }
     
     /**

Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/AddressingConstantsImplTest.java
Fri Jun 15 14:19:18 2007
@@ -43,24 +43,10 @@
     }
 
     @Test
-    public void testGetNamespacePrefix() throws Exception {
-        assertEquals("unexpected constant",
-                     "wsa",
-                     constants.getNamespacePrefix());
-    }
-
-    @Test
     public void testGetWSDLNamespaceURI() throws Exception {
         assertEquals("unexpected constant",
                      "http://www.w3.org/2005/02/addressing/wsdl",
                      constants.getWSDLNamespaceURI());
-    }
-
-    @Test
-    public void testGetWSDLNamespacePrefix() throws Exception {
-        assertEquals("unexpected constant",
-                     "wsaw",
-                     constants.getWSDLNamespacePrefix());
     }
 
     @Test

Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java?view=diff&rev=547787&r1=547786&r2=547787
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
Fri Jun 15 14:19:18 2007
@@ -319,10 +319,12 @@
             Element child = control.createMock(Element.class);
             children.item(i);
             EasyMock.expectLastCall().andReturn(child);
+            /*
             child.setAttributeNS(EasyMock.eq("http://www.w3.org/2000/xmlns/"),
-                                 EasyMock.eq("xmlns:" + Names.WSA_NAMESPACE_PREFIX),
+                                 EasyMock.eq("xmlns:wsa"),
                                  EasyMock.eq(maps.getNamespaceURI()));
             EasyMock.expectLastCall();
+            */
             child.getNamespaceURI();
             EasyMock.expectLastCall().andReturn(expectedNames[i].getNamespaceURI());
             child.getLocalName();



Mime
View raw message