Author: markt
Date: Wed Oct 21 07:38:51 2015
New Revision: 1709730
URL: http://svn.apache.org/viewvc?rev=1709730&view=rev
Log:
Allow more time for tests to run (primarily for Gump)
Add additional check that things have started properly.
Modified:
tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
Modified:
tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1709730&r1=1709729&r2=1709730&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
(original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
Wed Oct 21 07:38:51 2015
@@ -70,6 +70,9 @@ public class TestWsWebSocketContainer ex
private static final long TIMEOUT_MS = 5 * 1000;
private static final long MARGIN = 500;
+ // 5s should be plenty but Gump can be a lot slower
+ private static final long START_STOP_WAIT = 60 * 1000;
+
static {
StringBuilder sb = new StringBuilder(4096);
for (int i = 0; i < 4096; i++) {
@@ -898,6 +901,9 @@ public class TestWsWebSocketContainer ex
Session s = connectToEchoServer(wsContainer, new EndpointA(), path);
+ // One for the client, one for the server
+ validateBackgroundProcessCount(2);
+
StringBuilder msg = new StringBuilder();
for (long i = 0; i < size; i++) {
msg.append('x');
@@ -905,7 +911,7 @@ public class TestWsWebSocketContainer ex
s.getBasicRemote().sendText(msg.toString());
- // Wait for up to 5 seconds for the client session to close
+ // Wait for up to 5 seconds for the client session to open
boolean open = s.isOpen();
int count = 0;
while (open != expectOpen && count < 50) {
@@ -922,21 +928,24 @@ public class TestWsWebSocketContainer ex
s.close();
}
- // Wait for up to 5 seconds for the server session to close and the
- // background process to stop
- count = 0;
- while (count < 50) {
- if (BackgroundProcessManager.getInstance().getProcessCount() == 0)
{
+ // Ensure both server and client have shutdown
+ validateBackgroundProcessCount(0);
+ }
+
+
+ private void validateBackgroundProcessCount(int expected) throws Exception
{
+ int count = 0;
+ while (count < (START_STOP_WAIT / 100)) {
+ if (BackgroundProcessManager.getInstance().getProcessCount() ==
expected) {
break;
}
Thread.sleep(100);
count++;
}
+ Assert.assertEquals(expected,
BackgroundProcessManager.getInstance().getProcessCount());
- Assert.assertEquals(0,
BackgroundProcessManager.getInstance().getProcessCount());
}
-
@Test
public void testPerMessageDefalteClient01() throws Exception {
doTestPerMessageDefalteClient(MESSAGE_STRING_1, 1);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]