cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r743965 - in /cxf/trunk: api/src/main/java/org/apache/cxf/io/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/core/src/main/java/org/apache/cxf/service/factory/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ rt/frontend...
Date Fri, 13 Feb 2009 03:12:51 GMT
Author: dkulp
Date: Fri Feb 13 03:12:50 2009
New Revision: 743965

URL: http://svn.apache.org/viewvc?rev=743965&view=rev
Log:
Update server side oneway operations to send response back sooner (PRE_LOGICAL phase)

Added:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
  (with props)
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java Fri Feb
13 03:12:50 2009
@@ -42,7 +42,9 @@
             onFirstWrite();
             written = true;
         }
-        wrappedStream.write(b, off, len);
+        if (wrappedStream != null) {
+            wrappedStream.write(b, off, len);
+        }
     }
 
     protected void onFirstWrite() throws IOException {
@@ -59,7 +61,9 @@
             onFirstWrite();
             written = true;
         }
-        wrappedStream.write(b);
+        if (wrappedStream != null) {
+            wrappedStream.write(b);
+        }
     }
     
     @Override
@@ -71,7 +75,7 @@
 
     @Override
     public void flush() throws IOException {
-        if (written) {
+        if (written && wrappedStream != null) {
             wrappedStream.flush();
         }
     }

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=743965&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
(added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
Fri Feb 13 03:12:50 2009
@@ -0,0 +1,90 @@
+/**
+ * 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.interceptor;
+
+import java.io.IOException;
+import java.util.concurrent.Executor;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.workqueue.WorkQueueManager;
+
+
+/**
+ * 
+ */
+public class OneWayProcessorInterceptor extends AbstractPhaseInterceptor<Message> {
+    public OneWayProcessorInterceptor() {
+        super(Phase.PRE_LOGICAL);
+    }
+    public OneWayProcessorInterceptor(String phase) {
+        super(phase);
+    }
+    
+    public void handleMessage(Message message) throws Fault {
+        
+        if (message.getExchange().isOneWay() 
+            && !isRequestor(message)
+            && message.get(OneWayProcessorInterceptor.class) == null
+            && message.getExchange().get(Executor.class) == null) { 
+            //one way on server side, fork the rest of this chain onto the
+            //workqueue, call the Outgoing chain directly.
+            
+            message.put(OneWayProcessorInterceptor.class, this);
+            final InterceptorChain chain = message.getInterceptorChain();
+            
+            try {
+                Message partial = createMessage(message.getExchange());
+                partial.setExchange(message.getExchange());
+                Conduit conduit = message.getExchange().getDestination()
+                    .getBackChannel(message, null, null);
+                conduit.prepare(partial);
+                conduit.close(partial);
+            } catch (IOException e) {
+                //IGNORE
+            }
+            
+            
+            chain.pause();
+            message.getExchange().get(Bus.class).getExtension(WorkQueueManager.class)
+                .getAutomaticWorkQueue().execute(new Runnable() {
+                    public void run() {
+                        chain.resume();
+                    }
+                });
+        }
+    }
+    
+    private static Message createMessage(Exchange exchange) {
+        Endpoint ep = exchange.get(Endpoint.class);
+        Message msg = null;
+        if (ep != null) {
+            msg = ep.getBinding().createMessage();
+        }
+        return msg;
+    }
+
+
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java
Fri Feb 13 03:12:50 2009
@@ -20,7 +20,9 @@
 package org.apache.cxf.interceptor;
 
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
 
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Exchange;
@@ -37,7 +39,6 @@
  * @author Dan Diephouse
  */
 public class ServiceInvokerInterceptor extends AbstractPhaseInterceptor<Message> {
-   
     
     public ServiceInvokerInterceptor() {
         super(Phase.INVOKE);
@@ -89,7 +90,30 @@
             invocation.run();
         } else {
             exchange.put(Executor.class, executor);
-            executor.execute(invocation);
+            FutureTask<Object> o = new FutureTask<Object>(invocation, null);
+            synchronized (o) {
+                executor.execute(o);
+                if (!exchange.isOneWay()) {
+                    if (!o.isDone()) {
+                        try {
+                            o.wait();
+                        } catch (InterruptedException e) {
+                            //IGNORE
+                        }
+                    }
+                    try {
+                        o.get();
+                    } catch (InterruptedException e) {
+                        throw new Fault(e);
+                    } catch (ExecutionException e) {
+                        if (e.getCause() instanceof RuntimeException) {
+                            throw (RuntimeException)e.getCause();
+                        } else {
+                            throw new Fault(e.getCause());
+                        }
+                    }
+                }
+            }
         }
     }
     

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
Fri Feb 13 03:12:50 2009
@@ -21,6 +21,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
 import org.apache.cxf.interceptor.OutgoingChainInterceptor;
 import org.apache.cxf.interceptor.ServiceInvokerInterceptor;
 import org.apache.cxf.service.Service;
@@ -35,6 +36,7 @@
     protected void initializeDefaultInterceptors() {
         service.getInInterceptors().add(new ServiceInvokerInterceptor());
         service.getInInterceptors().add(new OutgoingChainInterceptor());
+        service.getInInterceptors().add(new OneWayProcessorInterceptor());
     }
     
     protected void initializeDataBindings() {

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
Fri Feb 13 03:12:50 2009
@@ -130,7 +130,8 @@
         }
     }
 
-    public long getSize(MultivaluedMap t, Class<?> type, Type genericType, Annotation[]
annotations, 
+    public long getSize(MultivaluedMap<String, String> t, Class<?> type, 
+                        Type genericType, Annotation[] annotations, 
                         MediaType mediaType) {
         return -1;
     }
@@ -156,4 +157,5 @@
             }
         }
     }
+
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Fri
Feb 13 03:12:50 2009
@@ -594,8 +594,7 @@
              
         
     }
-    
-    @SuppressWarnings("unchecked")
+
     private static Object processCookieParam(Message m, String cookieName, 
                               Class<?> pClass, Type genericType, String defaultValue)
{
         List<String> values = new HttpHeadersImpl(m).getRequestHeader(HttpHeaders.COOKIE);

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
Fri Feb 13 03:12:50 2009
@@ -50,15 +50,16 @@
         Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
         
         WebServiceContextImpl.setMessageContext(ctx);
-        
-        List<Object> res = CastUtils.cast((List)super.invoke(exchange, serviceObject,
m, params));
-        
-        addHandlerProperties(ctx, handlerScopedStuff);
-                
-        //update the webservice response context
-        updateWebServiceContext(exchange, ctx);
-        //clear the WebServiceContextImpl's ThreadLocal variable
-        WebServiceContextImpl.clear();
+        List<Object> res = null;
+        try {
+            res = CastUtils.cast((List)super.invoke(exchange, serviceObject, m, params));
+            addHandlerProperties(ctx, handlerScopedStuff);
+            //update the webservice response context
+            updateWebServiceContext(exchange, ctx);
+        } finally {
+            //clear the WebServiceContextImpl's ThreadLocal variable
+            WebServiceContextImpl.clear();
+        }
         return res;
     }
     

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Fri Feb 13 03:12:50 2009
@@ -293,7 +293,6 @@
 
         try {    
             incomingObserver.onMessage(inMessage);
-            
             resp.flushBuffer();
             baseRequest.setHandled(true);
         } catch (SuspendedInvocationException ex) {

Modified: cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
Fri Feb 13 03:12:50 2009
@@ -740,6 +740,8 @@
                     EasyMock.expectLastCall();
                     response.addHeader(EasyMock.isA(String.class), EasyMock.isA(String.class));
                     EasyMock.expectLastCall().anyTimes();
+                    response.setContentLength(0);
+                    EasyMock.expectLastCall().anyTimes();
                     response.getOutputStream();
                     EasyMock.expectLastCall().andReturn(os);
                     response.getStatus();

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Fri Feb 13 03:12:50 2009
@@ -80,6 +80,8 @@
     public static final String HTTP_CONFIG = "HTTP.CONFIG";
     public static final String PROTOCOL_HEADERS_CONTENT_TYPE = Message.CONTENT_TYPE.toLowerCase();
         
+    public static final String PARTIAL_RESPONSE = AbstractMultiplexDestination.class.getName()
+        + ".partial.response";
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractHTTPDestination.class);
     
     private static final long serialVersionUID = 1L;
@@ -360,13 +362,18 @@
      * @param the decoupled target
      * @return true iff partial responses are supported
      */
-    protected boolean markPartialResponse(Message partialResponse,
+    protected final boolean markPartialResponse(Message partialResponse,
                                        EndpointReferenceType decoupledTarget) {
         // setup the outbound message to for 202 Accepted
         partialResponse.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_ACCEPTED);
         partialResponse.getExchange().put(EndpointReferenceType.class, decoupledTarget);
+        partialResponse.put(PARTIAL_RESPONSE, Boolean.TRUE);
         return true;
     }
+    
+    protected boolean isPartialResponse(Message m) {
+        return Boolean.TRUE.equals(m.get(PARTIAL_RESPONSE));
+    }
 
     private void initConfig() {
         PolicyEngine engine = bus.getExtension(PolicyEngine.class);
@@ -441,15 +448,21 @@
                     }
                 }
                 response.setStatus(status);
+            } else if (oneWay) {
+                response.setStatus(HttpURLConnection.HTTP_ACCEPTED);
             } else {
                 response.setStatus(HttpURLConnection.HTTP_OK);
             }
 
             copyResponseHeaders(outMessage, response);
-            responseStream = response.getOutputStream();
 
-            if (oneWay) {
+            
+            if (oneWay && !isPartialResponse(outMessage)) {
+                response.setContentLength(0);
                 response.flushBuffer();
+                response.getOutputStream().close();
+            } else {
+                responseStream = response.getOutputStream();                
             }
         } else if (null != responseObj) {
             String m = (new org.apache.cxf.common.i18n.Message("UNEXPECTED_RESPONSE_TYPE_MSG",
@@ -529,8 +542,10 @@
                     wrappedStream = responseStream;
                 }
             }
-            wrappedStream.close();
-            response.flushBuffer();
+            if (wrappedStream != null) {
+                wrappedStream.close();
+                response.flushBuffer();
+            }
         }
         
         public void flush() throws IOException {

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Fri
Feb 13 03:12:50 2009
@@ -40,6 +40,7 @@
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.FaultMode;
 import org.apache.cxf.message.Message;
@@ -89,6 +90,7 @@
      */
     public MAPAggregator() {
         super(Phase.PRE_LOGICAL);
+        addBefore(OneWayProcessorInterceptor.class.getName());
     }
     
     /**

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
Fri Feb 13 03:12:50 2009
@@ -178,7 +178,7 @@
         while (it.hasNext()) {
             p = it.next();
             location.setPhase(p.getName());
-            if (Phase.INVOKE.equals(p.getName())) {
+            if (Phase.PRE_LOGICAL.equals(p.getName())) {
                 break;
             }             
             testFail(location);
@@ -226,6 +226,9 @@
         do {  
             location.setPhase(p.getName());
             if (Phase.INVOKE.equals(p.getName())) {
+                //faults from the PRE_LOGICAL and later phases won't make 
+                //it back to the client, the 200/202 response has already 
+                //been returned.  The server has accepted the message
                 break;
             }             
             testFail(location, true);
@@ -252,11 +255,11 @@
         try {
             greeter.greetMeOneWay("oneway");
             if (expectOnewayFault) {
-                fail("Oneway operation unexpectedly succeded.");
+                fail("Oneway operation unexpectedly succeded for phase " + location.getPhase());
             }
         } catch (WebServiceException ex) {
             if (!expectOnewayFault) {
-                fail("Oeway operation unexpectedly failed.");
+                fail("Oneway operation unexpectedly failed.");
             }
             Throwable cause = ex.getCause();
             Fault f = (Fault)cause;

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Fri Feb 13 03:12:50 2009
@@ -275,6 +275,10 @@
         assertEquals("Hello", echoMsg);
     }
     private void runDocLitTest(DocLitWrappedCodeFirstService port) throws Exception {
+        long start = System.currentTimeMillis();
+        port.doOneWay();
+        assertTrue((System.currentTimeMillis() - start) < 500);
+        
         Set<Foo> fooSet = port.getFooSet();
         assertEquals(2, fooSet.size());
         

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
Fri Feb 13 03:12:50 2009
@@ -22,6 +22,7 @@
 import java.util.Set;
 import java.util.Vector;
 
+import javax.jws.Oneway;
 import javax.jws.WebMethod;
 import javax.jws.WebParam;
 import javax.jws.WebResult;
@@ -45,6 +46,10 @@
                        "org.apache.cxf.feature.FastInfosetFeature" })
 public interface DocLitWrappedCodeFirstService {
 
+    @Oneway
+    @WebMethod
+    void doOneWay();
+    
     @WebMethod
     String[] arrayOutput();
 

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
Fri Feb 13 03:12:50 2009
@@ -196,4 +196,13 @@
     public boolean listObjectIn(Holder<List<Foo[]>> foos) {
         return false;
     }
+
+    public void doOneWay() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java?rev=743965&r1=743964&r2=743965&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java
Fri Feb 13 03:12:50 2009
@@ -141,9 +141,23 @@
         }
         
         greeter.greetMeOneWay("hello");
+        for (int count = 0; count < 10; count++) {
+            if (6 != cr.getCounters().size()) {
+                Thread.sleep(100);
+            } else {
+                break;
+            }
+        }
         assertEquals("The Counters are not create yet", 6, cr.getCounters().size());
+        for (int count = 0; count < 10; count++) {
+            if (10 > mbs.queryNames(name, null).size()) {
+                Thread.sleep(100);
+            } else {
+                break;
+            }
+        }
         counterNames = mbs.queryNames(name, null);
-        assertEquals("The Counters are not export to JMX ", 6 + 3, counterNames.size());
+        assertEquals("The Counters are not export to JMX " + counterNames, 6 + 4, counterNames.size());
         
         ObjectName greetMeOneWayCounter =  new ObjectName(
             ManagementConstants.DEFAULT_DOMAIN_NAME + ":operation=\"greetMeOneWay\",*");



Mime
View raw message