servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r709351 - in /servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test: java/org/apache/servicemix/cxfbc/ws/addressing/ resources/org/apache/servicemix/cxfbc/ws/addressing/
Date Fri, 31 Oct 2008 05:23:11 GMT
Author: ffang
Date: Thu Oct 30 22:23:11 2008
New Revision: 709351

URL: http://svn.apache.org/viewvc?rev=709351&view=rev
Log:
[SM-1661]Provider fails to set proper ws-addressing To header on outbound messages

Added:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/AddressingToVerifier.java
  (with props)
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcProviderAddressingTest.java
  (with props)
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml
  (with props)
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/xbean_provider_with_bus_http_conduit.xml
  (with props)

Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/AddressingToVerifier.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/AddressingToVerifier.java?rev=709351&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/AddressingToVerifier.java
(added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/AddressingToVerifier.java
Thu Oct 30 22:23:11 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.ws.addressing;
+
+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.ws.addressing.AddressingPropertiesImpl;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+
+/**
+ * @author vladislav.chernyak
+ * 
+ */
+public class AddressingToVerifier extends AbstractPhaseInterceptor<Message> {
+
+    String expectedTo;
+
+    public AddressingToVerifier() {
+        super(Phase.POST_LOGICAL);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message)
+     */
+    public void handleMessage(Message message) throws Fault {
+        AddressingPropertiesImpl maps = (AddressingPropertiesImpl) message
+                .get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+
+        if (!maps.getTo().getValue().equals(expectedTo)) {
+            throw new Fault(new Exception("Addressing To header \""
+                    + maps.getTo().getValue() + "\" does not match expected \""
+                    + expectedTo + "\"."));
+        }
+    }
+
+    /**
+     * @return the expectedTo
+     */
+    public String getExpectedTo() {
+        return expectedTo;
+    }
+
+    /**
+     * @param expectedTo
+     *            the expectedTo to set
+     */
+    public void setExpectedTo(String expectedTo) {
+        this.expectedTo = expectedTo;
+    }
+}

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

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

Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcProviderAddressingTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcProviderAddressingTest.java?rev=709351&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcProviderAddressingTest.java
(added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/addressing/CxfBcProviderAddressingTest.java
Thu Oct 30 22:23:11 2008
@@ -0,0 +1,105 @@
+/*
+ * 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.ws.addressing;
+
+import java.io.IOException;
+
+import javax.jbi.messaging.InOut;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.testutil.common.ServerLauncher;
+import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.cxfbc.provider.MyServer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class CxfBcProviderAddressingTest extends SpringTestSupport {
+
+    private DefaultServiceMixClient client;
+
+    private InOut io;
+
+    private ServerLauncher sl;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        assertTrue("Server failed to launch",
+        // run the server in another process
+                // set this to false to fork
+                launchServer(MyServer.class, false));
+    }
+
+    public void testMAPs() throws Exception {
+        client = new DefaultServiceMixClient(jbi);
+        io = client.createInOutExchange();
+        io.setService(new QName(
+                "http://apache.org/hello_world_soap_http_provider",
+                "SOAPService"));
+        io.setInterfaceName(new QName(
+                "http://apache.org/hello_world_soap_http_provider", "Greeter"));
+        io.setOperation(new QName(
+                "http://apache.org/hello_world_soap_http_provider", "sayHi"));
+        // send message to proxy
+        io.getInMessage().setContent(
+                new StringSource(
+                        "<message xmlns='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'>"
+                                + "<part> " + "<sayHi/>" + "</part> "
+                                + "</message>"));
+        client.sendSync(io);
+        if (io.getFault() != null) {
+            fail("Failed to process request: "
+                    + new SourceTransformer().contentToString(io.getFault()));
+        }
+        assertTrue(new SourceTransformer().contentToString(io.getOutMessage())
+                .indexOf("Hello") >= 0);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        try {
+            sl.stopServer();
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to stop server " + sl.getClass());
+        }
+    }
+
+    @Override
+    protected AbstractXmlApplicationContext createBeanFactory() {
+        return new ClassPathXmlApplicationContext(
+                "org/apache/servicemix/cxfbc/ws/addressing/xbean_provider_with_bus_http_conduit.xml");
+    }
+
+    public boolean launchServer(Class<?> clz, boolean inProcess) {
+        boolean ok = false;
+        try {
+            sl = new ServerLauncher(clz.getName(), inProcess);
+            ok = sl.launchServer();
+            assertTrue("server failed to launch", ok);
+
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to launch server " + clz);
+        }
+
+        return ok;
+    }
+
+}

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

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

Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml?rev=709351&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml
(added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml
Thu Oct 30 22:23:11 2008
@@ -0,0 +1,67 @@
+<?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="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+  
+    <http:conduit name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit"
/>
+    
+    <bean id="mapAggregator" class="org.apache.cxf.ws.addressing.MAPAggregator"/>
+    <bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
+    <bean id="loggingIn" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+    <bean id="loggingOut" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+    <bean id="toVerifier" class="org.apache.servicemix.cxfbc.ws.addressing.AddressingToVerifier">
+      <property name="expectedTo" value="http://localhost:9000/SoapContext/SoapPort"/>
+    </bean>
+
+    <!-- We are adding the interceptors to the bus as we will have only one endpoint/service/bus.
-->
+
+    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="loggingIn"/>
+            </list>
+        </property>
+        <property name="inFaultInterceptors">
+            <list>
+               <ref bean="loggingIn"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+               <ref bean="loggingOut"/>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="toVerifier"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="loggingOut"/>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+    </bean>
+</beans>
+

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/xbean_provider_with_bus_http_conduit.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/xbean_provider_with_bus_http_conduit.xml?rev=709351&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/xbean_provider_with_bus_http_conduit.xml
(added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/xbean_provider_with_bus_http_conduit.xml
Thu Oct 30 22:23:11 2008
@@ -0,0 +1,43 @@
+<?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">
+
+       
+  <sm:container id="jbi" embedded="true">
+    
+    <sm:endpoints>      
+      
+            <cxfbc:provider wsdl="./hello_world.wsdl"
+                      locationURI="http://localhost:9000/SoapContext/SoapPort"
+                      endpoint="SoapPort"
+                      service="greeter:SOAPService"
+                      interfaceName="greeter:Greeter"                      
+                      useJBIWrapper="true"
+                      busCfg="org/apache/servicemix/cxfbc/ws/addressing/http-conduit.xml"
+                      >
+            </cxfbc:provider>
+    </sm:endpoints>
+    
+  </sm:container>
+  
+</beans>

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

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

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



Mime
View raw message