cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r530485 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/ api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/frontend/jaxws/src/main/java...
Date Thu, 19 Apr 2007 16:52:47 GMT
Author: andreasmyth
Date: Thu Apr 19 09:52:42 2007
New Revision: 530485

URL: http://svn.apache.org/viewvc?view=rev&rev=530485
Log:
Made the allowDuplicates property if the MAPAggregator configurable and fix its use in validateIncomingMAPs.
Allow for retrieval of addressing properties to fail without reporting a warning.
Fixed JAXWS proxy executor issue [JIRA CXF-544]
Make access to soap version public.

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java
  (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.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/MAPAggregatorTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
Thu Apr 19 09:52:42 2007
@@ -23,6 +23,7 @@
 
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.PolicyComponent;
 
 
 /**
@@ -38,7 +39,16 @@
     public JaxbAssertion(QName qn, boolean optional) {
         super(qn, optional);
     }
-    
+      
+    @Override
+    public boolean equal(PolicyComponent policyComponent) {
+        if (!super.equal(policyComponent)) {
+            return false;
+        }
+        JaxbAssertion<T> a = (JaxbAssertion<T>)policyComponent;
+        return data.equals(a.getData());
+    }
+
     public void setData(T d) {
         data = d;
     }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
Thu Apr 19 09:52:42 2007
@@ -97,6 +97,14 @@
     }
 
     public Assertion buildCompatible(Assertion a, Assertion b) {
+        if (a.equal(b)) {
+            JaxbAssertion<T> ja = (JaxbAssertion<T>)a;
+            JaxbAssertion<T> compatible = buildAssertion();
+            compatible.setName(a.getName());
+            compatible.setOptional(a.isOptional() && b.isOptional());
+            compatible.setData(ja.getData());
+            return compatible;
+        }
         return null;
     }
     

Modified: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
(original)
+++ incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
Thu Apr 19 09:52:42 2007
@@ -95,7 +95,9 @@
         JaxbAssertion<FooType> oassertion = new JaxbAssertion<FooType>();
         oassertion.setData(odata);
         oassertion.setName(qn);
-        assertTrue(assertion.equal(oassertion));          
+        assertTrue(!assertion.equal(oassertion));  
+        oassertion.setData(data);
+        assertTrue(assertion.equal(oassertion));
         assertTrue(assertion.equal(assertion));          
     }
     

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
Thu Apr 19 09:52:42 2007
@@ -46,6 +46,10 @@
     public void setSoapVersion(SoapVersion v) {
         this.version = v;
     }
+
+    public SoapVersion getSoapVersion() {
+        return version;
+    }
     
     public Message createMessage() {
         return createMessage(new MessageImpl());

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
Thu Apr 19 09:52:42 2007
@@ -43,7 +43,6 @@
 import org.apache.cxf.frontend.MethodDispatcher;
 import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.workqueue.OneShotAsyncExecutor;
 
 public class JaxWsClientProxy extends org.apache.cxf.frontend.ClientProxy implements
     InvocationHandler, BindingProvider {
@@ -133,8 +132,7 @@
         FutureTask<Object> f = new FutureTask<Object>(new JAXWSAsyncCallable(this,
method, oi, params,
                                                                              context));
 
-        endpoint.getService().setExecutor(OneShotAsyncExecutor.getInstance());
-        endpoint.getService().getExecutor().execute(f);
+        endpoint.getExecutor().execute(f);
         Response<?> r = new AsyncResponse<Object>(f, Object.class);
         if (params.length > 0 && params[params.length - 1] instanceof AsyncHandler)
{
             // callback style

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
Thu Apr 19 09:52:42 2007
@@ -25,6 +25,7 @@
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;
 
 /**
@@ -68,7 +69,8 @@
 
         @Override
         public boolean equal(PolicyComponent policyComponent) {
-            if (!super.equal(policyComponent)) {
+            if (policyComponent.getType() != Constants.TYPE_ASSERTION
+                || !getName().equals(((Assertion)policyComponent).getName())) {
                 return false;
             }
             JaxbAssertion<HTTPClientPolicy> other = JaxbAssertion.cast((Assertion)policyComponent);

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
Thu Apr 19 09:52:42 2007
@@ -25,6 +25,7 @@
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;
 
 /**
@@ -63,12 +64,13 @@
     
     class HTTPServerPolicyAssertion extends JaxbAssertion<HTTPServerPolicy> {
         HTTPServerPolicyAssertion() {
-            super(PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME, false);
+            super(PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME, false);            
         }
 
         @Override
         public boolean equal(PolicyComponent policyComponent) {
-            if (!super.equal(policyComponent)) {
+            if (policyComponent.getType() != Constants.TYPE_ASSERTION
+                || !getName().equals(((Assertion)policyComponent).getName())) {
                 return false;
             }
             JaxbAssertion<HTTPServerPolicy> other = JaxbAssertion.cast((Assertion)policyComponent);
@@ -82,4 +84,4 @@
             return a;        
         } 
     }
-}
+}
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java
Thu Apr 19 09:52:42 2007
@@ -57,9 +57,11 @@
     @Test
     public void testHTTPCLientPolicyAssertionEqual() throws Exception {
         HTTPClientAssertionBuilder ab = new HTTPClientAssertionBuilder();
-        JaxbAssertion<HTTPClientPolicy>  a = ab.buildAssertion();        
+        JaxbAssertion<HTTPClientPolicy>  a = ab.buildAssertion();
+        a.setData(new HTTPClientPolicy());
         assertTrue(a.equal(a));        
         JaxbAssertion<HTTPClientPolicy> b = ab.buildAssertion();
+        b.setData(new HTTPClientPolicy());
         assertTrue(a.equal(b));
         HTTPClientPolicy pa = new HTTPClientPolicy();
         a.setData(pa);

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java
Thu Apr 19 09:52:42 2007
@@ -57,9 +57,11 @@
     @Test
     public void testHTTPServerPolicyAssertionEqual() throws Exception {
         HTTPServerAssertionBuilder ab = new HTTPServerAssertionBuilder();
-        JaxbAssertion<HTTPServerPolicy>  a = ab.buildAssertion();        
+        JaxbAssertion<HTTPServerPolicy>  a = ab.buildAssertion(); 
+        a.setData(new HTTPServerPolicy());
         assertTrue(a.equal(a));        
         JaxbAssertion<HTTPServerPolicy> b = ab.buildAssertion();
+        b.setData(new HTTPServerPolicy());
         assertTrue(a.equal(b));
         HTTPServerPolicy pa = new HTTPServerPolicy();
         a.setData(pa);

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
Thu Apr 19 09:52:42 2007
@@ -224,8 +224,7 @@
             message.put(mapProperty, maps);
         }
     }
-
-
+    
     /**
      * @param message the current message
      * @param isProviderContext true if the binding provider request context
@@ -238,6 +237,23 @@
                                                    Message message, 
                                                    boolean isProviderContext,
                                                    boolean isOutbound) {
+        return retrieveMAPs(message, isProviderContext, isOutbound, true);
+    }
+
+    /**
+     * @param message the current message
+     * @param isProviderContext true if the binding provider request context
+     * available to the client application as opposed to the message context
+     * visible to handlers
+     * @param isOutbound true iff the message is outbound
+     * @param warnIfMissing log a warning  message if properties cannot be retrieved
+     * @return the current addressing properties
+     */
+    public static AddressingPropertiesImpl retrieveMAPs(
+                                                   Message message, 
+                                                   boolean isProviderContext,
+                                                   boolean isOutbound,
+                                                   boolean warnIfMissing) {
         boolean isRequestor = ContextUtils.isRequestor(message);
         String mapProperty =
             ContextUtils.getMAPProperty(isProviderContext, 
@@ -251,7 +267,8 @@
         if (maps != null) {
             LOG.log(Level.INFO, "current MAPs {0}", maps);
         } else if (!isProviderContext) {
-            LOG.warning("MAPS_RETRIEVAL_FAILURE_MSG");
+            LogUtils.log(LOG, warnIfMissing ? Level.WARNING : Level.INFO, 
+                "MAPS_RETRIEVAL_FAILURE_MSG");         
         }
         return maps;
     }
@@ -391,7 +408,7 @@
             } catch (Exception e) {
                 LOG.log(Level.WARNING, "SERVER_TRANSPORT_REBASE_FAILURE_MSG", e);
             }
-        } 
+        }
     }
 
     

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Thu Apr 19 09:52:42 2007
@@ -71,10 +71,7 @@
 
     private Map<Endpoint, Boolean> usingAddressing = new ConcurrentHashMap<Endpoint,
Boolean>();
     
-    /**
-     * REVISIT allow this policy to be configured.
-     */
-    private final boolean allowDuplicates = true;
+    private boolean allowDuplicates = true;
     
     /**
      * Constructor.
@@ -83,6 +80,23 @@
         super();
         setPhase(Phase.PRE_LOGICAL);
     }
+    
+    /**
+     * Indicates if duplicate messageIDs are allowed.
+     * @return true iff duplicate messageIDs are allowed
+     */
+    public boolean allowDuplicates() {
+        return allowDuplicates;
+    }
+
+    /**
+     * Allows/disallows duplicate messageIdDs.  
+     * @param ad whether duplicate messageIDs are allowed
+     */
+    public void setAllowDuplicates(boolean ad) {
+        allowDuplicates = ad;
+    }
+
 
     /**
      * Invoked for normal processing of inbound and outbound messages.
@@ -419,7 +433,7 @@
     private boolean validateIncomingMAPs(AddressingProperties maps,
                                          Message message) {
         boolean valid = true;
-        if (allowDuplicates && maps != null) {
+        if (!allowDuplicates && maps != null) {
             AttributedURIType messageID = maps.getMessageID();
             if (messageID != null
                 && messageIDs.put(messageID.getValue(), 

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=530485&r1=530484&r2=530485
==============================================================================
--- 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
Thu Apr 19 09:52:42 2007
@@ -123,7 +123,7 @@
     private void mediate(SoapMessage message) {
         if (ContextUtils.isOutbound(message)) {
             encode(message, ContextUtils.retrieveMAPs(message, false, true));
-        } else if (null == ContextUtils.retrieveMAPs(message, false, false)) {          
 
+        } else if (null == ContextUtils.retrieveMAPs(message, false, false, false)) {   
        
             AddressingProperties maps = decode(message);
             ContextUtils.storeMAPs(maps, message, false);
             markPartialResponse(message, maps);

Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java?view=diff&rev=530485&r1=530484&r2=530485
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
Thu Apr 19 09:52:42 2007
@@ -215,6 +215,7 @@
     public void testResponderInboundInvalidMAPs() throws Exception {
         aggregator.messageIDs.put("urn:uuid:12345", "urn:uuid:12345");
         Message message = setUpMessage(false, false, false);
+        aggregator.setAllowDuplicates(false);
         aggregator.mediate(message, false);
         control.verify();
         verifyMessage(message, false, false, false /*check*/);
@@ -223,6 +224,7 @@
     public void testResponderInboundInvalidMAPsFault() throws Exception {
         aggregator.messageIDs.put("urn:uuid:12345", "urn:uuid:12345");
         Message message = setUpMessage(false, false, false);
+        aggregator.setAllowDuplicates(false);
         aggregator.mediate(message, true);
         control.verify();
         verifyMessage(message, false, false, false /*check*/);

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java?view=auto&rev=530485
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/JaxwsExecutorTest.java
Thu Apr 19 09:52:42 2007
@@ -0,0 +1,114 @@
+/**
+ * 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.cxf.systest.jaxws;
+
+import java.util.concurrent.Executor;
+
+import javax.jws.WebService;
+import javax.xml.ws.Response;
+
+import org.apache.cxf.greeter_control.AbstractGreeterImpl;
+import org.apache.cxf.greeter_control.BasicGreeterService;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class JaxwsExecutorTest  extends AbstractBusClientServerTestBase {
+    
+    public static class Server extends AbstractBusTestServerBase {
+        
+        protected void run()  {            
+            GreeterImpl implementor = new GreeterImpl();
+            String address = "http://localhost:9020/SoapContext/GreeterPort";
+            javax.xml.ws.Endpoint.publish(address, implementor);
+        }
+        
+
+        public static void main(String[] args) {
+            try { 
+                Server s = new Server(); 
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally { 
+                System.out.println("done!");
+            }
+        }
+        
+        @WebService(serviceName = "BasicGreeterService",
+                    portName = "GreeterPort",
+                    endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+                    targetNamespace = "http://cxf.apache.org/greeter_control",
+                    wsdlLocation = "testutils/greeter_control.wsdl")
+        public class GreeterImpl extends AbstractGreeterImpl {
+        }
+    }  
+ 
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class));
+    }
+         
+    @Test
+    public void testUseCustomExecutorOnClient() throws Exception {
+        BasicGreeterService service = new BasicGreeterService();
+        
+        class CustomExecutor implements Executor {
+            
+            private int count;
+            
+            public void execute(Runnable command) {
+                count++;
+                command.run();
+            }
+            
+            public int getCount() {
+                return count;
+            }
+        }
+        
+        CustomExecutor executor = new CustomExecutor();        
+        service.setExecutor(executor);
+        assertSame(executor, service.getExecutor());
+        
+        Greeter proxy = service.getGreeterPort();
+        
+        assertEquals(0, executor.getCount());
+        
+        Response<GreetMeResponse>  response = proxy.greetMeAsync("cxf");
+        int waitCount = 0;
+        while (!response.isDone() && waitCount < 10) {
+            Thread.sleep(100);
+            waitCount++;
+        }
+        assertTrue("Response still not received.", response.isDone());
+        
+        assertEquals(1, executor.getCount());
+    }
+   
+}

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

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



Mime
View raw message