Author: dkulp
Date: Thu Oct 16 19:44:15 2008
New Revision: 705449
URL: http://svn.apache.org/viewvc?rev=705449&view=rev
Log:
Merged revisions 705446 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r705446 | dkulp | 2008-10-16 22:30:51 -0400 (Thu, 16 Oct 2008) | 4 lines
Start making jaxws async calls use async stuff on client.
Fix some ws-rm/ws-a issues created from my last commit.
Add "toString" methods to some BAIS to aid debugging.
........
Removed:
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSAsyncCallable.java
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 16 19:44:15 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705446
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
(original)
+++
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
Thu Oct 16 19:44:15 2008
@@ -265,6 +265,7 @@
}
if (state == State.EXECUTING) {
state = State.COMPLETE;
+ pausedMessage = null;
}
return state == State.COMPLETE;
}
Modified:
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
(original)
+++
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
Thu Oct 16 19:44:15 2008
@@ -44,7 +44,11 @@
}
public ByteArrayInputStream createInputStream() {
- return new ByteArrayInputStream(buf, 0, count);
+ return new ByteArrayInputStream(buf, 0, count) {
+ public String toString() {
+ return IOUtils.newStringFromBytes(buf, 0, count);
+ }
+ };
}
public byte[] toByteArray() {
Modified:
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Thu Oct 16 19:44:15 2008
@@ -525,6 +525,7 @@
if (resList != null) {
return resList.toArray();
}
+
return null;
}
protected Exception getException(Exchange exchange) {
@@ -569,9 +570,8 @@
}
public void onMessage(Message message) {
- ClientCallback callback =
message.getExchange().get(ClientCallback.class);
+
Endpoint endpoint = message.getExchange().get(Endpoint.class);
- message.getExchange().setInMessage(message);
if (endpoint == null) {
// in this case correlation will occur outside the transport,
// however there's a possibility that the endpoint may have been
@@ -611,6 +611,7 @@
Bus origBus = BusFactory.getThreadDefaultBus(false);
BusFactory.setThreadDefaultBus(bus);
// execute chain
+ ClientCallback callback =
message.getExchange().get(ClientCallback.class);
try {
if (callback != null) {
if (callback.isCancelled()) {
@@ -632,7 +633,10 @@
chain.doIntercept(message);
}
- if (callback != null) {
+ callback = message.getExchange().get(ClientCallback.class);
+
+ if (callback != null && !isPartialResponse(message)) {
+ message.getExchange().setInMessage(message);
Map<String, Object> resCtx = CastUtils.cast((Map<?, ?>)message
.getExchange()
.getOutMessage()
@@ -642,17 +646,18 @@
try {
Object obj[] = processResult(message,
message.getExchange(),
null, resCtx);
+
callback.handleResponse(resCtx, obj);
- } catch (Exception ex) {
+ } catch (Throwable ex) {
callback.handleException(resCtx, ex);
}
}
} finally {
synchronized (message.getExchange()) {
- if (!isPartialResponse(message)) {
+ if (!isPartialResponse(message) && callback == null) {
message.getExchange().put(FINISHED, Boolean.TRUE);
message.getExchange().setInMessage(message);
- message.getExchange().notifyAll();
+ message.getExchange().notifyAll();
}
}
BusFactory.setThreadDefaultBus(origBus);
Modified:
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Thu Oct 16 19:44:15 2008
@@ -88,7 +88,6 @@
private Bus bus;
private InterceptorProvider iProvider;
-
private Class<T> cl;
private Executor executor;
private JAXBContext context;
@@ -360,6 +359,7 @@
}
public Future<?> invokeAsync(T obj, AsyncHandler<T> asyncHandler) {
+
Response<?> r = invokeAsync(obj);
AsyncCallbackFuture callback = new AsyncCallbackFuture(r,
asyncHandler);
Modified:
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
Thu Oct 16 19:44:15 2008
@@ -23,10 +23,11 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
-import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.concurrent.FutureTask;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
@@ -50,6 +51,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.ClientCallback;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.frontend.MethodDispatcher;
import org.apache.cxf.helpers.CastUtils;
@@ -216,26 +218,63 @@
||
address.equals(getClient().getEndpoint().getEndpointInfo().getAddress()));
}
- private Object invokeAsync(Method method, BindingOperationInfo oi,
Object[] params) {
+ @SuppressWarnings("unchecked")
+ private Object invokeAsync(Method method, BindingOperationInfo oi,
Object[] params) throws Exception {
- Map<String, Object> context = new HashMap<String,
Object>(client.getRequestContext());
- FutureTask<Object> f = new FutureTask<Object>(new
JAXWSAsyncCallable(this, method, oi, params,
-
context));
-
- Endpoint endpoint = getClient().getEndpoint();
- endpoint.getExecutor().execute(f);
- Response<?> r = new AsyncResponse<Object>(f, Object.class);
+ client.setExecutor(getClient().getEndpoint().getExecutor());
+
+ final AsyncHandler<Object> handler;
if (params.length > 0 && params[params.length - 1] instanceof
AsyncHandler) {
- // callback style
- AsyncCallbackFuture callback =
- new AsyncCallbackFuture(r, (AsyncHandler)params[params.length
- 1]);
- endpoint.getExecutor().execute(callback);
- return callback;
+ handler = (AsyncHandler)params[params.length - 1];
} else {
- return r;
+ handler = null;
}
+
+ final ClientCallback callback = new ClientCallback() {
+ public void handleResponse(Map<String, Object> ctx, Object[] res) {
+ super.handleResponse(ctx, res);
+ if (handler != null) {
+ handler.handleResponse(new ResponseCallback(this));
+ }
+ }
+ };
+
+ Response<Object> ret = new ResponseCallback(callback);
+ client.invoke(callback, oi, params);
+ return ret;
}
+ static class ResponseCallback implements Response<Object> {
+ ClientCallback callback;
+ public ResponseCallback(ClientCallback cb) {
+ callback = cb;
+ }
+
+ public Map<String, Object> getContext() {
+ try {
+ return callback.getResponseContext();
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+ public boolean cancel(boolean mayInterruptIfRunning) {
+ return callback.cancel(mayInterruptIfRunning);
+ }
+ public Object get() throws InterruptedException, ExecutionException {
+ return callback.get()[0];
+ }
+ public Object get(long timeout, TimeUnit unit) throws
InterruptedException,
+ ExecutionException, TimeoutException {
+ return callback.get(timeout, unit)[0];
+ }
+ public boolean isCancelled() {
+ return callback.isCancelled();
+ }
+ public boolean isDone() {
+ return callback.isDone();
+ }
+ };
+
public Map<String, Object> getRequestContext() {
return new WrappedMessageContext(this.getClient().getRequestContext(),
Modified:
cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Thu Oct 16 19:44:15 2008
@@ -53,7 +53,7 @@
*/
public class JMSConduit extends AbstractConduit implements JMSExchangeSender,
MessageListener {
static final Logger LOG = LogUtils.getL7dLogger(JMSConduit.class);
-
+ private static final String CORRELATED = JMSConduit.class.getName() +
".correlated";
private EndpointInfo endpointInfo;
private JMSConfiguration jmsConfig;
private Map<String, Exchange> correlationMap;
@@ -140,8 +140,7 @@
throw new RuntimeException(e);
}
correlationMap.remove(correlationId);
- if (exchange.getInMessage() == null
- && exchange.getInFaultMessage() == null) {
+ if (exchange.get(CORRELATED) == null) {
throw new RuntimeException("Timeout receiving message
with correlationId "
+ correlationId);
}
@@ -182,6 +181,7 @@
if (exchange.isSynchronous()) {
synchronized (exchange) {
+ exchange.put(CORRELATED, Boolean.TRUE);
exchange.notifyAll();
}
}
Modified:
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
Thu Oct 16 19:44:15 2008
@@ -19,8 +19,6 @@
package org.apache.cxf.ws.rm.persistence;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javax.xml.bind.JAXBContext;
@@ -30,6 +28,7 @@
import javax.xml.bind.Unmarshaller;
import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
import org.apache.cxf.ws.rm.SequenceAcknowledgement;
/**
@@ -71,13 +70,13 @@
}
public InputStream serialiseAcknowledgment(SequenceAcknowledgement ack) {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream();
try {
getMarshaller().marshal(ack, bos);
} catch (JAXBException ex) {
throw new RMStoreException(ex);
}
- return new ByteArrayInputStream(bos.toByteArray());
+ return bos.createInputStream();
}
private JAXBContext getContext() throws JAXBException {
Modified:
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Thu Oct 16 19:44:15 2008
@@ -19,6 +19,7 @@
package org.apache.cxf.ws.rm.persistence.jdbc;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
@@ -45,6 +46,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
import org.apache.cxf.ws.rm.DestinationSequence;
import org.apache.cxf.ws.rm.Identifier;
@@ -494,7 +496,11 @@
stmt.setBigDecimal(i++, new BigDecimal(nr));
stmt.setString(i++, to);
byte[] bytes = msg.getContent();
- stmt.setBinaryStream(i++, new ByteArrayInputStream(bytes),
bytes.length);
+ stmt.setBinaryStream(i++, new ByteArrayInputStream(bytes) {
+ public String toString() {
+ return IOUtils.newStringFromBytes(buf, 0, count);
+ }
+ }, bytes.length);
stmt.execute();
LOG.log(Level.FINE, "Successfully stored {0} message number {1} for
sequence {2}",
new Object[] {outbound ? "outbound" : "inbound", nr, id});
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Thu Oct 16 19:44:15 2008
@@ -28,7 +28,9 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
@@ -74,6 +76,7 @@
import org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest;
import org.apache.hello_world_soap_http.types.BareDocumentResponse;
import org.apache.hello_world_soap_http.types.GreetMeLaterResponse;
+import org.apache.hello_world_soap_http.types.GreetMeResponse;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -499,16 +502,17 @@
assertEquals(((TestExecutor)executor).getCount(), 0);
- try {
- Greeter greeter = (Greeter)service.getPort(portName,
Greeter.class);
- for (int i = 0; i < 5; i++) {
- greeter.greetMeAsync("asyn call" + i);
- }
- } catch (UndeclaredThrowableException ex) {
- throw (Exception)ex.getCause();
+ Greeter greeter = (Greeter)service.getPort(portName, Greeter.class);
+ List<Response<GreetMeResponse>> responses = new
ArrayList<Response<GreetMeResponse>>();
+ for (int i = 0; i < 5; i++) {
+ responses.add(greeter.greetMeAsync("asyn call" + i));
+ }
+ //wait for all the responses
+ for (Response<GreetMeResponse> resp : responses) {
+ resp.get();
}
-
- assertEquals(((TestExecutor)executor).getCount(), 5);
+
+ assertEquals(5, ((TestExecutor)executor).getCount());
}
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?rev=705449&r1=705448&r2=705449&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Thu Oct 16 19:44:15 2008
@@ -91,30 +91,6 @@
private OutMessageRecorder outRecorder;
private InMessageRecorder inRecorder;
- private boolean testAll = true;
- private boolean doTestOnewayAnonymousAcks = testAll;
- private boolean doTestOnewayDeferredAnonymousAcks = testAll;
- private boolean doTestOnewayDeferredNonAnonymousAcks = testAll;
- private boolean doTestOnewayAnonymousAcksSequenceLength1 = testAll;
- private boolean doTestOnewayAnonymousAcksSuppressed = testAll;
- private boolean doTestOnewayAnonymousAcksSuppressedAsyncExecutor = testAll;
- private boolean doTestTwowayNonAnonymous = testAll;
- private boolean doTestTwowayNonAnonymousEndpointSpecific = testAll;
- private boolean doTestTwowayNonAnonymousDeferred = testAll;
- private boolean doTestTwowayNonAnonymousMaximumSequenceLength2 = testAll;
- private boolean doTestTwowayAtMostOnce = testAll;
- private boolean doTestUnknownSequence = testAll;
- private boolean doTestInactivityTimeout = testAll;
- private boolean doTestOnewayMessageLoss = testAll;
- private boolean doTestOnewayMessageLossAsyncExecutor = testAll;
- private boolean doTestTwowayMessageLoss = testAll;
- private boolean doTestTwowayMessageLossAsyncExecutor = testAll;
- private boolean doTestTwowayNonAnonymousNoOffer = testAll;
- private boolean doTestConcurrency = testAll;
- private boolean doTestMultiClientOneway = testAll;
- private boolean doTestMultiClientTwoway = testAll;
- private boolean doTestServerSideMessageLoss = testAll;
- private boolean doTestTerminateOnShutdown = testAll;
@BeforeClass
public static void startServers() throws Exception {
@@ -129,13 +105,14 @@
@After
- public void tearDown() {
+ public void tearDown() throws Exception {
try {
stopGreeter();
stopControl();
} catch (Throwable t) {
//ignore
}
+ Thread.sleep(100);
}
/**
@@ -186,9 +163,6 @@
@Test
public void testOnewayAnonymousAcks() throws Exception {
- if (!doTestOnewayAnonymousAcks) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/rminterceptors.xml");
greeter.greetMeOneWay("once");
@@ -221,9 +195,6 @@
@Test
public void testOnewayDeferredAnonymousAcks() throws Exception {
- if (!doTestOnewayDeferredAnonymousAcks) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/deferred.xml");
greeter.greetMeOneWay("once");
@@ -261,9 +232,6 @@
@Test
public void testOnewayDeferredNonAnonymousAcks() throws Exception {
- if (!doTestOnewayDeferredNonAnonymousAcks) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/deferred.xml", true);
greeter.greetMeOneWay("once");
@@ -315,9 +283,6 @@
@Test
public void testOnewayAnonymousAcksSequenceLength1() throws Exception {
- if (!doTestOnewayAnonymousAcksSequenceLength1) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/seqlength1.xml");
greeter.greetMeOneWay("once");
@@ -358,17 +323,11 @@
@Test
public void testOnewayAnonymousAcksSuppressed() throws Exception {
- if (!doTestOnewayAnonymousAcksSuppressed) {
- return;
- }
testOnewayAnonymousAcksSuppressed(null);
}
@Test
public void testOnewayAnonymousAcksSuppressedAsyncExecutor() throws
Exception {
- if (!doTestOnewayAnonymousAcksSuppressedAsyncExecutor) {
- return;
- }
testOnewayAnonymousAcksSuppressed(Executors.newSingleThreadExecutor());
}
@@ -418,14 +377,11 @@
@Test
public void testTwowayNonAnonymous() throws Exception {
- if (!doTestTwowayNonAnonymous) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
- greeter.greetMe("one");
- greeter.greetMe("two");
- greeter.greetMe("three");
+ assertEquals("ONE", greeter.greetMe("one"));
+ assertEquals("TWO", greeter.greetMe("two"));
+ assertEquals("THREE", greeter.greetMe("three"));
// CreateSequence and three greetMe messages
// TODO there should be partial responses to the decoupled responses!
@@ -468,9 +424,6 @@
@Test
public void testTwowayNonAnonymousEndpointSpecific() throws Exception {
- if (!doTestTwowayNonAnonymousEndpointSpecific) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/twoway-endpoint-specific.xml",
true);
@@ -517,9 +470,6 @@
@Test
public void testTwowayNonAnonymousDeferred() throws Exception {
- if (!doTestTwowayNonAnonymousDeferred) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/deferred.xml", true);
greeter.greetMe("one");
@@ -582,10 +532,6 @@
*/
@Test
public void testTwowayNonAnonymousMaximumSequenceLength2() throws
Exception {
-
- if (!doTestTwowayNonAnonymousMaximumSequenceLength2) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/seqlength10.xml", true);
RMManager manager = greeterBus.getExtension(RMManager.class);
@@ -642,10 +588,6 @@
@Test
public void testTwowayAtMostOnce() throws Exception {
- if (!doTestTwowayAtMostOnce) {
- return;
- }
-
init("org/apache/cxf/systest/ws/rm/atmostonce.xml");
class MessageNumberInterceptor extends AbstractPhaseInterceptor {
@@ -712,10 +654,6 @@
@Test
public void testUnknownSequence() throws Exception {
- if (!doTestUnknownSequence) {
- return;
- }
-
init("org/apache/cxf/systest/ws/rm/rminterceptors.xml");
class SequenceIdInterceptor extends AbstractPhaseInterceptor {
@@ -751,10 +689,6 @@
@Test
public void testInactivityTimeout() throws Exception {
- if (!doTestInactivityTimeout) {
- return;
- }
-
init("org/apache/cxf/systest/ws/rm/inactivity-timeout.xml");
greeter.greetMe("one");
@@ -815,9 +749,6 @@
@Test
public void testOnewayMessageLoss() throws Exception {
- if (!doTestOnewayMessageLoss) {
- return;
- }
// waite a while for the last bus shutdown
Thread.sleep(5000);
testOnewayMessageLoss(null);
@@ -825,9 +756,6 @@
@Test
public void testOnewayMessageLossAsyncExecutor() throws Exception {
- if (!doTestOnewayMessageLossAsyncExecutor) {
- return;
- }
testOnewayMessageLoss(Executors.newSingleThreadExecutor());
}
@@ -883,17 +811,11 @@
@Test
public void testTwowayMessageLoss() throws Exception {
- if (!doTestTwowayMessageLoss) {
- return;
- }
testTwowayMessageLoss(null);
}
@Test
public void testTwowayMessageLossAsyncExecutor() throws Exception {
- if (!doTestTwowayMessageLossAsyncExecutor) {
- return;
- }
testTwowayMessageLoss(Executors.newSingleThreadExecutor());
}
@@ -953,9 +875,6 @@
@Test
public void testTwowayNonAnonymousNoOffer() throws Exception {
- if (!doTestTwowayNonAnonymousNoOffer) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/no-offer.xml", true);
greeter.greetMe("one");
@@ -989,23 +908,21 @@
@Test
public void testConcurrency() throws Exception {
- if (!doTestConcurrency) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
- for (int i = 0; i < 5; i++) {
+ int max = 5;
+ for (int i = 0; i < max; i++) {
greeter.greetMeAsync(Integer.toString(i));
}
// CreateSequence and five greetMe messages
// full and partial responses to each
- awaitMessages(6, 12, 7500);
+ awaitMessages(max + 1, (max * 2) + 1, 7500);
MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(),
inRecorder.getInboundMessages());
- mf.verifyMessages(6, true);
- String[] expectedActions = new String[6];
+ mf.verifyMessages(max + 1, true);
+ String[] expectedActions = new String[max + 1];
expectedActions[0] = RMConstants.getCreateSequenceAction();
for (int i = 1; i < expectedActions.length; i++) {
expectedActions[i] = GREETME_ACTION;
@@ -1015,9 +932,6 @@
@Test
public void testMultiClientOneway() throws Exception {
- if (!doTestMultiClientOneway) {
- return;
- }
SpringBusFactory bf = new SpringBusFactory();
String cfgResource =
"org/apache/cxf/systest/ws/rm/rminterceptors.xml";
@@ -1098,10 +1012,6 @@
@Test
public void testMultiClientTwoway() throws Exception {
- if (!doTestMultiClientTwoway) {
- return;
- }
-
SpringBusFactory bf = new SpringBusFactory();
String cfgResource =
"org/apache/cxf/systest/ws/rm/rminterceptors.xml";
initControl(bf, cfgResource);
@@ -1191,9 +1101,6 @@
@Test
public void testServerSideMessageLoss() throws Exception {
- if (!doTestServerSideMessageLoss) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/message-loss-server.xml", true);
// avoid client side message loss
@@ -1247,9 +1154,6 @@
@Test
public void testTerminateOnShutdown() throws Exception {
- if (!doTestTerminateOnShutdown) {
- return;
- }
init("org/apache/cxf/systest/ws/rm/terminate-on-shutdown.xml", true);
greeter.greetMeOneWay("neutrophil");