You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/28 01:38:27 UTC
svn commit: r1819385 - in
/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws:
dispatch/ framework/ provider/ proxy/ sample/
Author: veithen
Date: Thu Dec 28 01:38:27 2017
New Revision: 1819385
URL: http://svn.apache.org/viewvc?rev=1819385&view=rev
Log:
Reduce wait time in jaxws-integration tests.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/TestUtils.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java Thu Dec 28 01:38:27 2017
@@ -36,6 +36,7 @@ import javax.xml.ws.Response;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -141,10 +142,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
Future<?> monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
Source response = callbackHandler.getValue();
assertNotNull(response);
@@ -166,10 +164,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callbackHandler.getValue();
assertNotNull(response);
@@ -204,10 +199,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
Future<?> monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
Source response = callbackHandler.getValue();
assertNotNull(response);
@@ -231,10 +223,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callbackHandler.getValue();
assertNotNull(response);
@@ -266,10 +255,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
Response<Source> asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
Source response = asyncResponse.get();
assertNotNull(response);
@@ -288,10 +274,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull(response);
@@ -323,10 +306,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
Response<Source> asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
Source response = asyncResponse.get();
assertNotNull(response);
@@ -346,10 +326,7 @@ public class DOMSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull(response);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java Thu Dec 28 01:38:27 2017
@@ -35,6 +35,7 @@ import javax.xml.bind.JAXBElement;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -114,10 +115,7 @@ public class JAXBDispatchTests {
TestLogger.logger.debug(">> Invoking async(callback) Dispatch with JAX-B Parameter");
Future<?> monitor = dispatchPayload.invokeAsync(request, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
EchoStringResponse response = (EchoStringResponse) callback.getData();
assertNotNull(response);
@@ -138,10 +136,7 @@ public class JAXBDispatchTests {
TestLogger.logger.debug(">> Invoking async(callback) Dispatch with JAX-B Parameter");
monitor = dispatchPayload.invokeAsync(request, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = (EchoStringResponse) callback.getData();
assertNotNull(response);
@@ -236,10 +231,7 @@ public class JAXBDispatchTests {
TestLogger.logger.debug(">> Invoking async(callback) Dispatch with JAX-B Parameter");
Future<?> monitor = dispatchMessage.invokeAsync(request, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
JAXBElement<Envelope> jaxbResponse = (JAXBElement<Envelope>) callback.getData();
@@ -262,10 +254,7 @@ public class JAXBDispatchTests {
TestLogger.logger.debug(">> Invoking async(callback) Dispatch with JAX-B Parameter");
monitor = dispatchMessage.invokeAsync(request, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
jaxbResponse = (JAXBElement<Envelope>) callback.getData();
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java Thu Dec 28 01:38:27 2017
@@ -33,6 +33,7 @@ import javax.xml.ws.Response;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -185,10 +186,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
Future<?> monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
Source response = callbackHandler.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -216,10 +214,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callbackHandler.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -259,10 +254,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
Future<?> monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
Source response = callbackHandler.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -290,10 +282,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
monitor = dispatch.invokeAsync(request, callbackHandler);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callbackHandler.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -330,10 +319,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
Response<Source> asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
Source response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -359,10 +345,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -399,10 +382,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
Response<Source> asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
Source response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -428,10 +408,7 @@ public class SAXSourceDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
asyncResponse = dispatch.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java Thu Dec 28 01:38:27 2017
@@ -31,6 +31,7 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import java.io.File;
@@ -110,10 +111,7 @@ public class SOAPMessageDispatchTests {
Future<?> monitor = dispatch.invokeAsync(msgObject, ac);
assertNotNull("dispatch invokeAsync returned null Future<?>", monitor);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
SOAPMessage response = ac.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -126,10 +124,7 @@ public class SOAPMessageDispatchTests {
monitor = dispatch.invokeAsync(msgObject, ac);
assertNotNull("dispatch invokeAsync returned null Future<?>", monitor);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = ac.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -159,10 +154,7 @@ public class SOAPMessageDispatchTests {
Response<SOAPMessage> asyncResponse = dispatch.invokeAsync(msgObject);
assertNotNull("dispatch invokeAsync returned null Response", asyncResponse);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
SOAPMessage response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -175,10 +167,7 @@ public class SOAPMessageDispatchTests {
asyncResponse = dispatch.invokeAsync(msgObject);
assertNotNull("dispatch invokeAsync returned null Response", asyncResponse);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java Thu Dec 28 01:38:27 2017
@@ -32,6 +32,7 @@ import javax.xml.ws.Response;
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -186,10 +187,7 @@ public class StreamSourceDispatchTests {
Future<?> monitor = dispatch.invokeAsync(srcStream, callbackHandler);
// Wait for the async response to be returned
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
Source response = callbackHandler.getValue();
assertNotNull(response);
@@ -215,10 +213,7 @@ public class StreamSourceDispatchTests {
monitor = dispatch.invokeAsync(srcStream, callbackHandler);
// Wait for the async response to be returned
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callbackHandler.getValue();
assertNotNull(response);
@@ -261,10 +256,7 @@ public class StreamSourceDispatchTests {
Future<?> monitor = dispatch.invokeAsync(srcStream, callbackHandler);
// Wait for the async response to be returned
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
Source response = callbackHandler.getValue();
assertNotNull(response);
@@ -295,10 +287,7 @@ public class StreamSourceDispatchTests {
monitor = dispatch.invokeAsync(srcStream, callbackHandler);
// Wait for the async response to be returned
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callbackHandler.getValue();
assertNotNull(response);
@@ -337,10 +326,7 @@ public class StreamSourceDispatchTests {
Response<Source> asyncResponse = dispatch.invokeAsync(srcStream);
// Wait for the async response to be returned
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
Source response = asyncResponse.get();
assertNotNull(response);
@@ -365,10 +351,7 @@ public class StreamSourceDispatchTests {
asyncResponse = dispatch.invokeAsync(srcStream);
// Wait for the async response to be returned
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull(response);
@@ -408,10 +391,7 @@ public class StreamSourceDispatchTests {
Response<Source> asyncResponse = dispatch.invokeAsync(srcStream);
// Wait for the async response to be returned
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
Source response = asyncResponse.get();
assertNotNull(response);
@@ -437,10 +417,7 @@ public class StreamSourceDispatchTests {
asyncResponse = dispatch.invokeAsync(srcStream);
// Wait for the async response to be returned
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull(response);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java Thu Dec 28 01:38:27 2017
@@ -32,6 +32,7 @@ import javax.xml.ws.Response;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.apache.axis2.jaxws.framework.TestUtils.checkUnknownHostURL;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -196,10 +197,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
Future<?> monitor = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
String response = callback.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -219,10 +217,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch");
monitor = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callback.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -254,10 +249,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch with Message Mode");
Future<?> monitor = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
String response = callback.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -276,10 +268,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch with Message Mode");
monitor = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
response = callback.getValue();
assertNotNull("dispatch invoke returned null", response);
@@ -308,10 +297,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
Response<String> asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
String response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -327,10 +313,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -359,10 +342,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch with Message Mode");
Response<String> asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
String response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -378,10 +358,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch with Message Mode");
asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull("dispatch invoke returned null", response);
@@ -494,10 +471,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch with Message Mode");
Future<?> monitor = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
if (callback.hasError()) {
Throwable t = callback.getError();
@@ -523,10 +497,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (callback) Dispatch with Message Mode");
monitor = dispatch.invokeAsync(DispatchTestConstants.sampleSoapMessage, callback);
- while (!monitor.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(monitor);
if (callback.hasError()) {
Throwable t = callback.getError();
@@ -561,10 +532,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
Response<String> asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
Throwable ttemp = null;
try {
@@ -582,10 +550,7 @@ public class StringDispatchTests {
TestLogger.logger.debug(">> Invoking async (polling) Dispatch");
asyncResponse = dispatch.invokeAsync(DispatchTestConstants.sampleBodyContent);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
ttemp = null;
try {
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/TestUtils.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/TestUtils.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/TestUtils.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/TestUtils.java Thu Dec 28 01:38:27 2017
@@ -19,10 +19,14 @@
package org.apache.axis2.jaxws.framework;
+import static org.apache.axis2.jaxws.framework.TestUtils.withRetry;
+import static org.junit.Assert.assertTrue;
+
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
+import java.util.concurrent.Future;
import org.apache.axis2.testutils.RuntimeIgnoreException;
@@ -56,18 +60,30 @@ public final class TestUtils {
}
public static void withRetry(Runnable runnable) throws InterruptedException {
- int retries = 0;
+ int elapsedTime = 0;
+ int interval = 1;
while (true) {
try {
runnable.run();
return;
} catch (AssertionError ex) {
- if (retries++ > 60) {
+ if (elapsedTime > 30000) {
throw ex;
} else {
- Thread.sleep(500);
+ Thread.sleep(interval);
+ elapsedTime += interval;
+ interval = Math.min(500, interval*2);
}
}
}
}
+
+ public static void await(final Future<?> future) throws InterruptedException {
+ withRetry(new Runnable() {
+ public void run() {
+ // check the Future
+ assertTrue("Response is not done!", future.isDone());
+ }
+ });
+ }
}
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java Thu Dec 28 01:38:27 2017
@@ -37,6 +37,7 @@ import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPMessageContext;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -322,10 +323,7 @@ public class SoapMessageMUProviderTests
}
try {
- while (!asyncResponse.isDone()) {
- System.out.println(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
SOAPMessage response = asyncResponse.get();
fail("Should have caught a mustUnderstand exception");
} catch (Exception e) {
@@ -373,10 +371,7 @@ public class SoapMessageMUProviderTests
try {
Response<SOAPMessage> asyncResponse = dispatch.invokeAsync(message);
assertNotNull("No response received", asyncResponse);
- while (!asyncResponse.isDone()) {
- System.out.println(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
SOAPMessage response = asyncResponse.get();
assertNotNull("Response was nulL", response);
String responseString = AttachmentUtil.toString(response);
@@ -420,10 +415,7 @@ public class SoapMessageMUProviderTests
}
try {
- while (!asyncResponse.isDone()) {
- System.out.println(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
assertTrue("Did not receive exception", callback.hasError());
assertTrue("Did not received expected exception",
callback.getError().toString().contains("Must Understand check failed for header http://ws.apache.org/axis2 : muserver"));
@@ -478,10 +470,7 @@ public class SoapMessageMUProviderTests
}
try {
- while (!asyncResponse.isDone()) {
- System.out.println(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
assertFalse("Receive unexpected exception", callback.hasError());
SOAPMessage response = callback.getValue();
assertNotNull(response);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java Thu Dec 28 01:38:27 2017
@@ -35,6 +35,7 @@ import javax.xml.ws.AsyncHandler;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
@@ -124,9 +125,7 @@ public class ProxyNonWrappedTests {
AsyncHandler<ReturnType> handler = new AsyncCallback();
//Invoke operation Asynchronously.
Future<?> monitor = proxy.invokeAsync(invokeObj, handler);
- while(!monitor.isDone()){
- Thread.sleep(1000);
- }
+ await(monitor);
// Try again
@@ -134,9 +133,7 @@ public class ProxyNonWrappedTests {
handler = new AsyncCallback();
//Invoke operation Asynchronously.
monitor = proxy.invokeAsync(invokeObj, handler);
- while(!monitor.isDone()){
- Thread.sleep(1000);
- }
+ await(monitor);
TestLogger.logger.debug("---------------------------------------");
}catch(Exception e){
e.printStackTrace();
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java Thu Dec 28 01:38:27 2017
@@ -33,6 +33,7 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import java.io.File;
@@ -204,10 +205,7 @@ public class ProxyTests {
TestLogger.logger.debug(">> Invoking Proxy with async polling request");
Response<ReturnType> asyncResponse = proxy.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
ReturnType response = asyncResponse.get();
assertNotNull(response);
@@ -215,10 +213,7 @@ public class ProxyTests {
// Try again
asyncResponse = proxy.invokeAsync(request);
- while (!asyncResponse.isDone()) {
- TestLogger.logger.debug(">> Async invocation still not complete");
- Thread.sleep(1000);
- }
+ await(asyncResponse);
response = asyncResponse.get();
assertNotNull(response);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java Thu Dec 28 01:38:27 2017
@@ -19,6 +19,7 @@
package org.apache.axis2.jaxws.sample;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -1033,10 +1034,7 @@ public class AddNumbersHandlerTests {
AddNumbersHandlerAsyncCallback callback = new AddNumbersHandlerAsyncCallback();
Future<?> future = proxy.addNumbersHandlerAsync(10, 10, callback);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
int total = callback.getResponseValue();
@@ -1114,10 +1112,7 @@ public class AddNumbersHandlerTests {
AddNumbersHandlerAsyncCallback callback = new AddNumbersHandlerAsyncCallback();
Future<?> future = proxy.addNumbersHandlerAsync(10, 10, callback);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
int total = callback.getResponseValue();
assertEquals("Local exception should cause value to be 0", 0, total);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java Thu Dec 28 01:38:27 2017
@@ -32,6 +32,7 @@ import org.test.parallelasync.SleepRespo
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.apache.axis2.jaxws.framework.TestUtils.withRetry;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -92,7 +93,7 @@ public class AsyncExecutorTests {
Response<CustomAsyncResponse> resp2 = port.remappedAsync(request2);
// wait until the response for request #2 is done
- waitBlocking(resp2);
+ await(resp2);
// check the waiting request #1
String asleep = port.isAsleep(request1);
@@ -103,7 +104,7 @@ public class AsyncExecutorTests {
//System.out.println(title+"iteration ["+i+"] port.wakeUp(request1 ["+request1+"]) = ["+wake+"]");
// wait until the response for request #1 is done
- waitBlocking(resp1);
+ await(resp1);
// get the responses
String req1_result = null;
@@ -264,15 +265,6 @@ public class AsyncExecutorTests {
return port;
}
- private void waitBlocking(Future<?> monitor){
- while (!monitor.isDone()) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- }
- }
-
/**
* Object used to synchronize and communicate between the thread that sends the request and
* the thread that processes the response.
@@ -410,12 +402,7 @@ public class AsyncExecutorTests {
final Future<?> sr1 = monitor.futureResponse;
CallbackHandler<SleepResponse> sleepCallbackHandler1 = monitor.callbackHandler;
- withRetry(new Runnable() {
- public void run() {
- // check the Future
- assertTrue("Response is not done!", sr1.isDone());
- }
- });
+ await(sr1);
// try to get the response
try {
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java Thu Dec 28 01:38:27 2017
@@ -41,6 +41,7 @@ import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.soap.SOAPFaultException;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.apache.axis2.jaxws.framework.TestUtils.checkUnknownHostURL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -253,10 +254,7 @@ public class FaultyWebServiceTests {
FaultyAsyncHandler callback = new FaultyAsyncHandler();
Future<?> future = proxy.faultyWebServiceAsync(1, callback);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
Exception e = callback.getException();
@@ -275,10 +273,7 @@ public class FaultyWebServiceTests {
callback = new FaultyAsyncHandler();
future = proxy.faultyWebServiceAsync(1, callback);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
e = callback.getException();
@@ -311,10 +306,7 @@ public class FaultyWebServiceTests {
badEndpoint);
Future<?> future = proxy.faultyWebServiceAsync(1);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
Exception e = null;
try {
@@ -337,10 +329,7 @@ public class FaultyWebServiceTests {
// Repeat to verify behavior
proxy.faultyWebServiceAsync(1);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
e = null;
try {
@@ -377,10 +366,7 @@ public class FaultyWebServiceTests {
FaultyAsyncHandler callback = new FaultyAsyncHandler();
Future<?> future = proxy.faultyWebServiceAsync(1, callback);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
Exception e = callback.getException();
e.printStackTrace();
@@ -399,10 +385,7 @@ public class FaultyWebServiceTests {
callback = new FaultyAsyncHandler();
future = proxy.faultyWebServiceAsync(1, callback);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
e = callback.getException();
e.printStackTrace();
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java Thu Dec 28 01:38:27 2017
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.jaxws.sample;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -273,10 +274,7 @@ public class HeadersHandlerTests {
HeadersHandlerAsyncCallback callback = new HeadersHandlerAsyncCallback();
Future<?> future = proxy.headersHandlerAsync(intParam1, intParam2, callback);
- while (!future.isDone()) {
- Thread.sleep(1000);
- TestLogger.logger.debug("Async invocation incomplete");
- }
+ await(future);
int total = callback.getResponseValue();
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java Thu Dec 28 01:38:27 2017
@@ -38,6 +38,7 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceException;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -190,17 +191,13 @@ public class NonWrapTests {
AsyncCallback callback = new AsyncCallback();
Future<?> monitor =proxy.twoWayHolderAsync(twh, callback);
- while(!monitor.isDone()){
- Thread.sleep(1000);
- }
+ await(monitor);
assertNotNull(monitor);
// Repeat to verify behavior
callback = new AsyncCallback();
monitor =proxy.twoWayHolderAsync(twh, callback);
- while(!monitor.isDone()){
- Thread.sleep(1000);
- }
+ await(monitor);
assertNotNull(monitor);
TestLogger.logger.debug("------------------------------");
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java?rev=1819385&r1=1819384&r2=1819385&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java Thu Dec 28 01:38:27 2017
@@ -32,6 +32,7 @@ import org.test.parallelasync.SleepRespo
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
+import static org.apache.axis2.jaxws.framework.TestUtils.await;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -92,7 +93,7 @@ public class ParallelAsyncTests {
Response<CustomAsyncResponse> resp2 = port.remappedAsync(request2);
// wait until the response for request #2 is done
- waitBlocking(resp2);
+ await(resp2);
// check the waiting request #1
String asleep = port.isAsleep(request1);
@@ -103,7 +104,7 @@ public class ParallelAsyncTests {
//System.out.println(title+"iteration ["+i+"] port.wakeUp(request1 ["+request1+"]) = ["+wake+"]");
// wait until the response for request #1 is done
- waitBlocking(resp1);
+ await(resp1);
// get the responses
String req1_result = null;
@@ -241,14 +242,7 @@ public class ParallelAsyncTests {
String wake1 = port.wakeUp(request1);
TestLogger.logger.debug("port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
- // wait a bit..
- Thread.sleep(2000);
-
- // check the Future
- if (sr1.isDone())
- {
- TestLogger.logger.debug("sr1.isDone[TRUE] ");
- }
+ await(sr1);
// try to get the response
boolean gotException = false;
@@ -338,14 +332,7 @@ public class ParallelAsyncTests {
String wake1 = port.wakeUp(request1);
TestLogger.logger.debug("port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
- // wait a bit..
- Thread.sleep(2000);
-
- // check the Future
- if (sr1.isDone())
- {
- TestLogger.logger.debug("sr1.isDone[TRUE] ");
- }
+ await(sr1);
// try to get the response
boolean gotException = false;
@@ -576,13 +563,4 @@ public class ParallelAsyncTests {
return port;
}
-
- private void waitBlocking(Future<?> monitor){
- while (!monitor.isDone()){
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- }
- }
}