tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1739079 - /tomcat/trunk/test/org/apache/tomcat/websocket/
Date Thu, 14 Apr 2016 12:48:14 GMT
Author: markt
Date: Thu Apr 14 12:48:14 2016
New Revision: 1739079

URL: http://svn.apache.org/viewvc?rev=1739079&view=rev
Log:
Expand the check that the BackgroundProcessManager has correctly shut down at the end of the
test to more WebSocket tests.

Added:
    tomcat/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java   (with props)
Modified:
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWsPingPongMessages.java
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java

Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java?rev=1739079&r1=1739078&r2=1739079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java Thu Apr 14
12:48:14 2016
@@ -32,11 +32,10 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.websocket.TesterMessageCountClient.BasicText;
 import org.apache.tomcat.websocket.TesterMessageCountClient.TesterProgrammaticEndpoint;
 
-public class TestWebSocketFrameClient extends TomcatBaseTest {
+public class TestWebSocketFrameClient extends WebSocketBaseTest {
 
     @Test
     public void testConnectToServerEndpoint() throws Exception {

Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java?rev=1739079&r1=1739078&r2=1739079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java Thu Apr
14 12:48:14 2016
@@ -33,13 +33,12 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.util.net.TesterSupport;
 import org.apache.tomcat.websocket.TesterMessageCountClient.BasicText;
 import org.apache.tomcat.websocket.TesterMessageCountClient.SleepingText;
 import org.apache.tomcat.websocket.TesterMessageCountClient.TesterProgrammaticEndpoint;
 
-public class TestWebSocketFrameClientSSL extends TomcatBaseTest {
+public class TestWebSocketFrameClientSSL extends WebSocketBaseTest {
 
     @Test
     public void testConnectToServerEndpoint() throws Exception {
@@ -150,20 +149,5 @@ public class TestWebSocketFrameClientSSL
 
         // Close the client session.
         wsSession.close();
-
-        // Make sure the background process has stopped (else in some test
-        // environments it will continue to run and break other tests that check
-        // it has stopped.
-        count = 0;
-        while (count < 50) {
-            if (BackgroundProcessManager.getInstance().getProcessCount() == 0) {
-                break;
-            }
-            Thread.sleep(100);
-            count++;
-        }
-
-        Assert.assertEquals(0, BackgroundProcessManager.getInstance().getProcessCount());
-
     }
 }

Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestWsPingPongMessages.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWsPingPongMessages.java?rev=1739079&r1=1739078&r2=1739079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsPingPongMessages.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsPingPongMessages.java Thu Apr 14 12:48:14
2016
@@ -33,12 +33,11 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.websocket.TesterMessageCountClient.TesterEndpoint;
 import org.apache.tomcat.websocket.TesterMessageCountClient.TesterProgrammaticEndpoint;
 
 
-public class TestWsPingPongMessages extends TomcatBaseTest {
+public class TestWsPingPongMessages extends WebSocketBaseTest {
 
     ByteBuffer applicationData = ByteBuffer.wrap(new String("mydata")
             .getBytes());

Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java?rev=1739079&r1=1739078&r2=1739079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java Thu Apr 14 12:48:14
2016
@@ -38,7 +38,6 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.websocket.TesterMessageCountClient.AsyncBinary;
 import org.apache.tomcat.websocket.TesterMessageCountClient.AsyncHandler;
 import org.apache.tomcat.websocket.TesterMessageCountClient.AsyncText;
@@ -46,7 +45,7 @@ import org.apache.tomcat.websocket.Teste
 import org.apache.tomcat.websocket.TesterMessageCountClient.TesterEndpoint;
 import org.apache.tomcat.websocket.TesterMessageCountClient.TesterProgrammaticEndpoint;
 
-public class TestWsRemoteEndpoint extends TomcatBaseTest {
+public class TestWsRemoteEndpoint extends WebSocketBaseTest {
 
     private static final String SEQUENCE = "ABCDE";
     private static final int S_LEN = SEQUENCE.length();

Modified: tomcat/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java?rev=1739079&r1=1739078&r2=1739079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java Thu Apr 14 12:48:14
2016
@@ -36,11 +36,10 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.websocket.TesterMessageCountClient.TesterProgrammaticEndpoint;
 import org.apache.tomcat.websocket.server.TesterEndpointConfig;
 
-public class TestWsSubprotocols extends TomcatBaseTest {
+public class TestWsSubprotocols extends WebSocketBaseTest {
 
     @Test
     public void testWsSubprotocols() throws Exception {

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=1739079&r1=1739078&r2=1739079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java Thu Apr 14
12:48:14 2016
@@ -50,7 +50,6 @@ import org.junit.Test;
 import org.apache.catalina.Context;
 import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.util.net.TesterSupport;
 import org.apache.tomcat.websocket.TesterMessageCountClient.BasicBinary;
 import org.apache.tomcat.websocket.TesterMessageCountClient.BasicHandler;
@@ -60,7 +59,7 @@ import org.apache.tomcat.websocket.Teste
 import org.apache.tomcat.websocket.server.Constants;
 import org.apache.tomcat.websocket.server.WsContextListener;
 
-public class TestWsWebSocketContainer extends TomcatBaseTest {
+public class TestWsWebSocketContainer extends WebSocketBaseTest {
 
     private static final String MESSAGE_EMPTY = "";
     private static final String MESSAGE_STRING_1 = "qwerty";

Added: tomcat/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java?rev=1739079&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java (added)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java Thu Apr 14 12:48:14
2016
@@ -0,0 +1,45 @@
+/*
+ *  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.tomcat.websocket;
+
+import org.junit.After;
+import org.junit.Assert;
+
+import org.apache.catalina.startup.TomcatBaseTest;
+
+public abstract class WebSocketBaseTest extends TomcatBaseTest {
+
+    @After
+    public void checkBackgroundProcessHasStopped() throws Exception {
+        // Need to stop Tomcat to ensure background processed have been stopped.
+        getTomcatInstance().stop();
+
+        // Make sure the background process has stopped. In some test
+        // environments it will continue to run and break other tests that check
+        // it has stopped.
+        int count = 0;
+        while (count < 50) {
+            if (BackgroundProcessManager.getInstance().getProcessCount() == 0) {
+                break;
+            }
+            Thread.sleep(100);
+            count++;
+        }
+
+        Assert.assertEquals(0, BackgroundProcessManager.getInstance().getProcessCount());
+    }
+}

Propchange: tomcat/trunk/test/org/apache/tomcat/websocket/WebSocketBaseTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message