You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by an...@apache.org on 2006/09/29 19:53:41 UTC

svn commit: r451362 - in /incubator/cxf/trunk: systests/src/test/java/org/apache/cxf/systest/common/ systests/src/test/java/org/apache/cxf/systest/ws/addressing/ testutils/src/main/java/org/apache/cxf/testutil/common/

Author: andreasmyth
Date: Fri Sep 29 10:53:40 2006
New Revision: 451362

URL: http://svn.apache.org/viewvc?view=rev&rev=451362
Log:
Replaced programmatic configuration of (addressing) interceptors and http conduit in ws/addressing system test with config file.


Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml   (with props)
Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java
    incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java?view=diff&rev=451362&r1=451361&r2=451362
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java Fri Sep 29 10:53:40 2006
@@ -56,4 +56,8 @@
     protected Bus getBus() {
         return bus;
     }
+
+    protected void setBus(Bus b) {
+        bus = b;
+    }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java?view=diff&rev=451362&r1=451361&r2=451362
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java Fri Sep 29 10:53:40 2006
@@ -33,17 +33,16 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.systest.common.ClientServerSetupBase;
 import org.apache.cxf.systest.common.ClientServerTestBase;
-import org.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.ContextUtils;
-import org.apache.cxf.ws.addressing.MAPAggregator;
 import org.apache.cxf.ws.addressing.Names;
-import org.apache.cxf.ws.addressing.soap.MAPCodec;
 import org.apache.cxf.ws.addressing.soap.VersionTransformer;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
@@ -94,19 +93,19 @@
             }
             
             public void setUp() throws Exception {
-                // temporary mechanism to override configuration for 
-                // decoupled response endpoint
-                System.setProperty(HTTPConduit.HTTP_DECOUPLED_ENDPOINT,
-                                   "http://localhost:9999/decoupled_endpoint");
-                super.setUp();
-                MAPAggregator aggregator = new MAPAggregator();
+                startServers();
+
+                SpringBusFactory bf = new SpringBusFactory();
+                Bus bus = bf.createBus("org/apache/cxf/systest/ws/addressing/cxf.xml");
+                bf.setDefaultBus(bus);
+                setBus(bus);
+
                 mapVerifier = new MAPVerifier();
-                MAPCodec codec = new MAPCodec();
                 headerVerifier = new HeaderVerifier();
-                Interceptor[] interceptors =
-                {aggregator, mapVerifier, codec, headerVerifier};
+                Interceptor[] interceptors = {mapVerifier, headerVerifier};
                 addInterceptors(getBus().getInInterceptors(), interceptors);
                 addInterceptors(getBus().getOutInterceptors(), interceptors);
+                addInterceptors(getBus().getOutFaultInterceptors(), interceptors);
                 addInterceptors(getBus().getInFaultInterceptors(), interceptors);
             }
             

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java?view=diff&rev=451362&r1=451361&r2=451362
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java Fri Sep 29 10:53:40 2006
@@ -26,48 +26,49 @@
 
 import javax.xml.ws.Endpoint;
 
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.systest.common.TestServerBase;
-import org.apache.cxf.ws.addressing.MAPAggregator;
-import org.apache.cxf.ws.addressing.soap.MAPCodec;
 
 public class Server extends TestServerBase implements VerificationCache {
     
     private String verified;
  
     protected void run()  {
-        addInterceptors();
+
+        SpringBusFactory factory = new SpringBusFactory();
+        Bus bus = factory.createBus("org/apache/cxf/systest/ws/addressing/cxf.xml");
+        factory.setDefaultBus(bus);
+        setBus(bus);
+
+        addVerifiers();
+
         GreeterImpl implementor = new GreeterImpl();
         implementor.verificationCache = this;         
         String address = "http://localhost:9008/SoapContext/SoapPort";
         Endpoint.publish(address, implementor);
     }
-    
-    protected void addInterceptors() {
-        BusFactory bf = BusFactoryHelper.newInstance();
-        setBus(bf.createBus());
-        bf.setDefaultBus(getBus());
-        MAPAggregator aggregator = new MAPAggregator();
+
+    protected void addVerifiers() {
         MAPVerifier mapVerifier = new MAPVerifier();
         mapVerifier.verificationCache = this;
-        MAPCodec codec = new MAPCodec();
         HeaderVerifier headerVerifier = new HeaderVerifier();
         headerVerifier.verificationCache = this;
-        Interceptor[] interceptors =
-        {aggregator, mapVerifier, codec, headerVerifier};
+        Interceptor[] interceptors = {mapVerifier, headerVerifier};
         addInterceptors(getBus().getInInterceptors(), interceptors);
+        addInterceptors(getBus().getInFaultInterceptors(), interceptors);
         addInterceptors(getBus().getOutInterceptors(), interceptors);
         addInterceptors(getBus().getOutFaultInterceptors(), interceptors);
     }
-    
+
     private void addInterceptors(List<Interceptor> chain,
                                  Interceptor[] interceptors) {
         for (int i = 0; i < interceptors.length; i++) {
             chain.add(interceptors[i]);
         }
     }
+
         
     public static void main(String[] args) {
         try { 

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml?view=auto&rev=451362
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml Fri Sep 29 10:53:40 2006
@@ -0,0 +1,152 @@
+<?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-conf="http://cxf.apache.org/transports/http/configuration"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+  
+    <bean name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit" abstract="true">
+        <property name="client">
+            <value>
+                <http-conf:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint"/>
+            </value>
+        </property>
+    </bean>
+
+
+    <bean id="mapAggregator" class="org.apache.cxf.ws.addressing.MAPAggregator"/>
+    <bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
+
+    <!-- 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.spring.SpringBusImpl">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+        <property name="inFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+    </bean>
+    
+    <!-- Configuring the service level interceptors would work also but is not as convenient
+         as we have to remember to include the default interceptors. -->
+  
+    <!-- 
+    <bean id="messageSender" class="org.apache.cxf.interceptor.MessageSenderInterceptor"/> 
+    <bean id="outgoingChain" class="org.apache.cxf.interceptor.OutgoingChainInterceptor"/> 
+    <bean id="outgoingChainSetup" class="org.apache.cxf.interceptor.OutgoingChainSetupInterceptor"/> 
+    <bean id="serviceInvoker" class="org.apache.cxf.interceptor.ServiceInvokerInterceptor"/> 
+    <bean id="webFaultOut" class="org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor"/> 
+
+    <bean name="{http://apache.org/hello_world_soap_http}SOAPServiceAddressing" abstract="true">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="serviceInvoker"/>
+                <ref bean="outgoingChainSetup"/>
+                <ref bean="outgoingChain"/>
+            </list>
+        </property>
+        <property name="inFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="messageSender"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="messageSender"/>
+                <ref bean="webFaultOut"/>
+            </list>
+        </property>
+    </bean>
+    -->
+   
+    <!-- Configuring the endpoint level interceptors would work also but again is not as convenient
+         as we have to remember to include the default interceptors.
+         Note that these include the JAX-WS handler interceptors; we have have to omit them here
+         because their constructor requires a reference to the binding.
+         As this test does not use JAX-WS handlers, the omission does not have any effect. --> 
+    
+    <!-- 
+    <bean id="wrapperClassIn" class="org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor"/> 
+    <bean id="wrapperClassOut" class="org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor"/> 
+   
+    <bean name="{http://apache.org/hello_world_soap_http}SoapPort" abstract="true">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="wrapperClassIn"/>
+            </list>
+        </property>
+        <property name="inFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="wrapperClassOut"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+    </bean>
+    -->
+   
+    
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/cxf.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?view=diff&rev=451362&r1=451361&r2=451362
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java (original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java Fri Sep 29 10:53:40 2006
@@ -329,7 +329,6 @@
         cmd.add("-Djavax.xml.ws.spi.Provider=org.apache.cxf.bus.jaxws.spi.ProviderImpl");
         
         String loggingPropertiesFile = System.getProperty("java.util.logging.config.file");
-        loggingPropertiesFile = "c:/logging.properties";
         if (null != loggingPropertiesFile) {
             cmd.add("-Djava.util.logging.config.file=" + loggingPropertiesFile);
         }