ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/websocket/WebSocketBaseTest.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/websocket/WebSocketBaseTest.java
Status
scanned
Type
file
Name
WebSocketBaseTest.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2770 (2.7 KB)
MD5
fb9244b9064bde8e30ff0c01eb343cbf
SHA1
cf0f64704bc656452caddd2e5f7291209200e3fc
SHA256
22d91370404e09f130980a0ea75f4afab0858c19fbff2812e2a6ac31e9286c76
SHA512

      
    
SHA1_git
683af59864eb7aa42e52226168d083f186f9b2fa
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
WebSocketBaseTest.java | 2.7 KB |

/* * 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.Context; import org.apache.catalina.LifecycleException; import org.apache.catalina.servlets.DefaultServlet; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.websocket.server.WsContextListener; public abstract class WebSocketBaseTest extends TomcatBaseTest { protected Tomcat startServer(final Class<? extends WsContextListener> configClass) throws LifecycleException { Tomcat tomcat = getTomcatInstance(); // No file system docBase required Context ctx = getProgrammaticRootContext(); ctx.addApplicationListener(configClass.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMappingDecoded("/", "default"); tomcat.start(); return tomcat; } @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; // 5s should be plenty here but Gump can be a lot slower so allow 60s. while (count < 600) { if (BackgroundProcessManager.getInstance().getProcessCount() == 0) { break; } Thread.sleep(100); count++; } try { Assert.assertEquals(0, BackgroundProcessManager.getInstance().getProcessCount()); } finally { // Ensure the next test is not affected BackgroundProcessManager.getInstance().shutdown(); } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
39.53
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9