From e1f19be35302d3cbd7d40ac3bef36438d3209017 Mon Sep 17 00:00:00 2001 From: Lachlan Date: Tue, 14 Jan 2020 09:22:56 +1100 Subject: [PATCH 01/20] Closes #2620 - guard against exceptions for WebSocket onClose and onError (#4346) Signed-off-by: Lachlan Roberts --- .../jetty/websocket/tests/ErrorCloseTest.java | 278 ++++++++++++++++++ .../client/WebSocketUpgradeRequest.java | 10 +- .../websocket/common/WebSocketSession.java | 26 +- 3 files changed, 307 insertions(+), 7 deletions(-) create mode 100644 jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java new file mode 100644 index 00000000000..3e7e19b1110 --- /dev/null +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java @@ -0,0 +1,278 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.tests; + +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.servlet.DispatcherType; + +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.util.log.StacklessLogging; +import org.eclipse.jetty.websocket.api.Session; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.client.WebSocketClient; +import org.eclipse.jetty.websocket.common.WebSocketSession; +import org.eclipse.jetty.websocket.common.WebSocketSessionListener; +import org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer; +import org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ErrorCloseTest +{ + private Server server = new Server(); + private WebSocketClient client = new WebSocketClient(); + private ThrowingSocket serverSocket = new ThrowingSocket(); + private CountDownLatch serverCloseListener = new CountDownLatch(1); + private ServerConnector connector; + private URI serverUri; + + @BeforeEach + public void start() throws Exception + { + connector = new ServerConnector(server); + server.addConnector(connector); + + ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); + contextHandler.setContextPath("/"); + contextHandler.addFilter(WebSocketUpgradeFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); + NativeWebSocketServletContainerInitializer.configure(contextHandler, (context, container) -> + { + container.addMapping("/", (req, resp) -> serverSocket); + container.getFactory().addSessionListener(new WebSocketSessionListener() { + @Override + public void onSessionClosed(WebSocketSession session) + { + serverCloseListener.countDown(); + } + }); + }); + server.setHandler(contextHandler); + + server.start(); + client.start(); + serverUri = new URI("ws://localhost:" + connector.getLocalPort() + "/"); + } + + @AfterEach + public void stop() throws Exception + { + client.stop(); + server.stop(); + } + + @WebSocket + public static class ThrowingSocket extends EventSocket + { + public List methodsToThrow = new ArrayList<>(); + + @Override + public void onOpen(Session session) + { + super.onOpen(session); + if (methodsToThrow.contains("onOpen")) + throw new RuntimeException("throwing from onOpen"); + } + + @Override + public void onMessage(String message) throws IOException + { + super.onMessage(message); + if (methodsToThrow.contains("onMessage")) + throw new RuntimeException("throwing from onMessage"); + } + + @Override + public void onClose(int statusCode, String reason) + { + super.onClose(statusCode, reason); + if (methodsToThrow.contains("onClose")) + throw new RuntimeException("throwing from onClose"); + } + + @Override + public void onError(Throwable cause) + { + super.onError(cause); + if (methodsToThrow.contains("onError")) + throw new RuntimeException("throwing from onError"); + } + } + + @Test + public void testOnOpenThrows() throws Exception + { + serverSocket.methodsToThrow.add("onOpen"); + EventSocket clientSocket = new EventSocket(); + client.connect(clientSocket, serverUri).get(5, TimeUnit.SECONDS); + + assertTrue(serverSocket.closed.await(5, TimeUnit.SECONDS)); + assertTrue(clientSocket.closed.await(5, TimeUnit.SECONDS)); + assertThat(serverSocket.failure.getMessage(), is("throwing from onOpen")); + + // Check we have stopped the WebSocketSession properly. + assertFalse(serverSocket.session.isOpen()); + serverCloseListener.await(5, TimeUnit.SECONDS); + assertTrue(((WebSocketSession)serverSocket.session).isStopped()); + } + + @Test + public void testOnMessageThrows() throws Exception + { + serverSocket.methodsToThrow.add("onMessage"); + EventSocket clientSocket = new EventSocket(); + client.connect(clientSocket, serverUri).get(5, TimeUnit.SECONDS); + clientSocket.session.getRemote().sendString("trigger onMessage error"); + + assertTrue(serverSocket.closed.await(5, TimeUnit.SECONDS)); + assertTrue(clientSocket.closed.await(5, TimeUnit.SECONDS)); + assertThat(serverSocket.failure.getMessage(), is("throwing from onMessage")); + + // Check we have stopped the WebSocketSession properly. + assertFalse(serverSocket.session.isOpen()); + serverCloseListener.await(5, TimeUnit.SECONDS); + assertTrue(((WebSocketSession)serverSocket.session).isStopped()); + } + + + @ParameterizedTest + @ValueSource(strings={"onError","onClose"}) + public void testWebSocketThrowsAfterOnOpenError(String methodToThrow) throws Exception + { + serverSocket.methodsToThrow.add("onOpen"); + serverSocket.methodsToThrow.add(methodToThrow); + EventSocket clientSocket = new EventSocket(); + + try (StacklessLogging stacklessLogging = new StacklessLogging(WebSocketSession.class)) + { + client.connect(clientSocket, serverUri).get(5, TimeUnit.SECONDS); + assertTrue(serverSocket.closed.await(5, TimeUnit.SECONDS)); + assertTrue(clientSocket.closed.await(5, TimeUnit.SECONDS)); + } + + // Check we have stopped the WebSocketSession properly. + assertFalse(serverSocket.session.isOpen()); + serverCloseListener.await(5, TimeUnit.SECONDS); + assertTrue(((WebSocketSession)serverSocket.session).isStopped()); + } + + @ParameterizedTest + @ValueSource(strings={"onError","onClose"}) + public void testWebSocketThrowsAfterOnMessageError(String methodToThrow) throws Exception + { + serverSocket.methodsToThrow.add("onMessage"); + serverSocket.methodsToThrow.add(methodToThrow); + EventSocket clientSocket = new EventSocket(); + client.connect(clientSocket, serverUri).get(5, TimeUnit.SECONDS); + + try (StacklessLogging stacklessLogging = new StacklessLogging(WebSocketSession.class)) + { + clientSocket.session.getRemote().sendString("trigger onMessage error"); + assertTrue(serverSocket.closed.await(5, TimeUnit.SECONDS)); + assertTrue(clientSocket.closed.await(5, TimeUnit.SECONDS)); + } + + // Check we have stopped the WebSocketSession properly. + assertFalse(serverSocket.session.isOpen()); + serverCloseListener.await(5, TimeUnit.SECONDS); + assertTrue(((WebSocketSession)serverSocket.session).isStopped()); + } + + @ParameterizedTest + @ValueSource(strings={"onError","onClose"}) + public void testWebSocketThrowsOnTimeout(String methodToThrow) throws Exception + { + serverSocket.methodsToThrow.add(methodToThrow); + EventSocket clientSocket = new EventSocket(); + client.connect(clientSocket, serverUri).get(5, TimeUnit.SECONDS); + + // Set a short idleTimeout on the server. + assertTrue(serverSocket.open.await(5, TimeUnit.SECONDS)); + serverSocket.session.setIdleTimeout(1000); + + // Wait for server to timeout. + try (StacklessLogging stacklessLogging = new StacklessLogging(WebSocketSession.class)) + { + assertTrue(serverSocket.closed.await(5, TimeUnit.SECONDS)); + assertTrue(clientSocket.closed.await(5, TimeUnit.SECONDS)); + } + + // Check we have stopped the WebSocketSession properly. + assertFalse(serverSocket.session.isOpen()); + serverCloseListener.await(5, TimeUnit.SECONDS); + assertTrue(((WebSocketSession)serverSocket.session).isStopped()); + } + + @ParameterizedTest + @ValueSource(strings={"onError","onClose"}) + public void testWebSocketThrowsOnRemoteDisconnect(String methodToThrow) throws Exception + { + serverSocket.methodsToThrow.add(methodToThrow); + EventSocket clientSocket = new EventSocket(); + client.connect(clientSocket, serverUri).get(5, TimeUnit.SECONDS); + + try (StacklessLogging stacklessLogging = new StacklessLogging(WebSocketSession.class)) + { + clientSocket.session.disconnect(); + assertTrue(serverSocket.closed.await(5, TimeUnit.SECONDS)); + assertTrue(clientSocket.closed.await(5, TimeUnit.SECONDS)); + } + + // Check we have stopped the WebSocketSession properly. + assertFalse(serverSocket.session.isOpen()); + serverCloseListener.await(5, TimeUnit.SECONDS); + assertTrue(((WebSocketSession)serverSocket.session).isStopped()); + } + + @ParameterizedTest + @ValueSource(strings={"onError","onClose"}) + public void testWebSocketThrowsOnLocalDisconnect(String methodToThrow) throws Exception + { + serverSocket.methodsToThrow.add(methodToThrow); + EventSocket clientSocket = new EventSocket(); + client.connect(clientSocket, serverUri).get(5, TimeUnit.SECONDS); + + try (StacklessLogging stacklessLogging = new StacklessLogging(WebSocketSession.class)) + { + serverSocket.session.disconnect(); + assertTrue(serverSocket.closed.await(5, TimeUnit.SECONDS)); + assertTrue(clientSocket.closed.await(5, TimeUnit.SECONDS)); + } + + // Check we have stopped the WebSocketSession properly. + assertFalse(serverSocket.session.isOpen()); + serverCloseListener.await(5, TimeUnit.SECONDS); + assertTrue(((WebSocketSession)serverSocket.session).isStopped()); + } +} diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketUpgradeRequest.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketUpgradeRequest.java index a7f50f3c555..f415e86d2af 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketUpgradeRequest.java +++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketUpgradeRequest.java @@ -535,7 +535,15 @@ public class WebSocketUpgradeRequest extends HttpRequest implements CompleteList private void handleException(Throwable failure) { - localEndpoint.onError(failure); + try + { + localEndpoint.onError(failure); + } + catch (Throwable t) + { + LOG.warn("Exception while notifying onError", t); + } + fut.completeExceptionally(failure); } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java index ca73936d489..660fe71d3df 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java @@ -380,27 +380,41 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem public void callApplicationOnClose(CloseInfo closeInfo) { if (LOG.isDebugEnabled()) - { LOG.debug("callApplicationOnClose({})", closeInfo); - } + if (onCloseCalled.compareAndSet(false, true)) { - websocket.onClose(closeInfo); + try + { + websocket.onClose(closeInfo); + } + catch (Throwable t) + { + LOG.warn("Exception while notifying onClose", t); + } } } public void callApplicationOnError(Throwable cause) { if (LOG.isDebugEnabled()) - { LOG.debug("callApplicationOnError()", cause); - } + if (openFuture != null && !openFuture.isDone()) openFuture.completeExceptionally(cause); // Only notify onError if onClose has not been called. if (!onCloseCalled.get()) - websocket.onError(cause); + { + try + { + websocket.onError(cause); + } + catch (Throwable t) + { + LOG.warn("Exception while notifying onError", t); + } + } } /** From a7b9df96fde1333df9f3c9e6a0765eb983c2838b Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Mon, 13 Jan 2020 11:02:11 +1100 Subject: [PATCH 02/20] cleanup WebSocket logging in EventSocket Signed-off-by: Lachlan Roberts --- .../eclipse/jetty/websocket/tests/EventSocket.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/EventSocket.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/EventSocket.java index fb4ed06e0dd..23ed12a80b7 100644 --- a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/EventSocket.java +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/EventSocket.java @@ -59,21 +59,24 @@ public class EventSocket { this.session = session; behavior = session.getPolicy().getBehavior().name(); - LOG.info("{} onOpen(): {}", toString(), session); + if (LOG.isDebugEnabled()) + LOG.debug("{} onOpen(): {}", toString(), session); open.countDown(); } @OnWebSocketMessage public void onMessage(String message) throws IOException { - LOG.info("{} onMessage(): {}", toString(), message); + if (LOG.isDebugEnabled()) + LOG.debug("{} onMessage(): {}", toString(), message); receivedMessages.offer(message); } @OnWebSocketClose public void onClose(int statusCode, String reason) { - LOG.debug("{} onClose(): {}:{}", toString(), statusCode, reason); + if (LOG.isDebugEnabled()) + LOG.debug("{} onClose(): {}:{}", toString(), statusCode, reason); closeCode = statusCode; closeReason = reason; closed.countDown(); @@ -82,7 +85,8 @@ public class EventSocket @OnWebSocketError public void onError(Throwable cause) { - LOG.info("{} onError(): {}", toString(), cause); + if (LOG.isDebugEnabled()) + LOG.debug("{} onError(): {}", toString(), cause); failure = cause; error.countDown(); } From 8c65309963a286a700698ccfd05426f6cfe2767f Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 14 Jan 2020 12:33:34 -0600 Subject: [PATCH 03/20] Addressing Checkstyle violations in src/test/java Signed-off-by: Joakim Erdfelt --- .../jetty/example/asyncrest/DemoServer.java | 4 +- .../annotations/TestAnnotationParser.java | 2 +- .../client/ClientConnectionCloseTest.java | 17 +- .../client/HttpClientAuthenticationTest.java | 40 +-- .../client/HttpClientChunkedContentTest.java | 4 +- .../jetty/client/HttpClientRedirectTest.java | 38 +-- .../eclipse/jetty/client/HttpClientTest.java | 57 ++--- .../jetty/client/HttpClientURITest.java | 1 + .../client/HttpConnectionLifecycleTest.java | 22 +- .../eclipse/jetty/client/HttpCookieTest.java | 50 ++-- .../org/eclipse/jetty/client/api/Usage.java | 5 +- .../http/HttpDestinationOverHTTPTest.java | 12 +- .../client/http/HttpReceiverOverHTTPTest.java | 14 +- .../client/http/HttpSenderOverHTTPTest.java | 14 +- .../util/MultiPartContentProviderTest.java | 1 + .../client/util/TypedContentProviderTest.java | 1 + .../jetty/deploy/AppLifeCycleTest.java | 18 +- .../jetty/deploy/BadAppDeployTest.java | 4 +- .../DeploymentManagerLifeCyclePathTest.java | 6 +- .../jetty/fcgi/server/HttpClientTest.java | 2 + .../proxy/DrupalHTTP2FastCGIProxyServer.java | 8 +- .../WordPressHTTP2FastCGIProxyServer.java | 10 +- .../TestEndpointMultiplePublishProblem.java | 4 +- .../jetty/http/GZIPContentDecoderTest.java | 4 +- .../org/eclipse/jetty/http/HttpFieldTest.java | 11 +- .../jetty/http/HttpGeneratorServerTest.java | 2 +- .../eclipse/jetty/http/HttpParserTest.java | 14 +- .../org/eclipse/jetty/http/HttpTester.java | 4 +- .../org/eclipse/jetty/http/HttpURITest.java | 1 + .../org/eclipse/jetty/http/MimeTypesTest.java | 12 +- .../jetty/http/MultiPartParserTest.java | 187 +++++++------- .../org/eclipse/jetty/http/PathMapTest.java | 6 +- .../jetty/http/QuotedQualityCSVTest.java | 12 +- .../org/eclipse/jetty/http/SyntaxTest.java | 8 +- .../http/matchers/HttpFieldsMatchersTest.java | 6 +- .../jetty/http/pathmap/PathMappingsTest.java | 1 + .../pathmap/ServletPathSpecOrderTest.java | 1 + .../http/pathmap/UriTemplatePathSpecTest.java | 2 +- .../jetty/http2/client/ProxyProtocolTest.java | 4 +- .../http2/client/SmallThreadPoolLoadTest.java | 4 +- .../jetty/http2/hpack/HpackDecoderTest.java | 10 +- .../eclipse/jetty/http2/hpack/HpackTest.java | 1 + .../jetty/http2/hpack/NBitIntegerTest.java | 12 +- .../jetty/http2/server/H2SpecServer.java | 8 +- .../jetty/http2/server/HTTP2CServerTest.java | 10 +- .../jetty/http2/server/HTTP2ServerTest.java | 6 +- .../infinispan/EmbeddedQueryManagerTest.java | 19 +- .../infinispan/RemoteQueryManagerTest.java | 8 +- .../eclipse/jetty/io/CyclicTimeoutTest.java | 4 +- .../jetty/io/SocketChannelEndPointTest.java | 20 +- .../jetty/util/StringReplaceBenchmark.java | 12 +- .../jetty/maven/plugin/it/TestGetContent.java | 5 +- .../jetty/security/openid/JwtDecoderTest.java | 24 +- .../openid/OpenIdAuthenticationTest.java | 4 +- .../jetty/security/openid/OpenIdProvider.java | 4 +- .../eclipse/jetty/osgi/test/TestOSGiUtil.java | 7 +- .../jetty/plus/webapp/TestConfiguration.java | 4 +- .../jetty/security/ConstraintTest.java | 44 ++-- .../jetty/security/DataConstraintsTest.java | 8 +- .../security/SpecExampleConstraintTest.java | 24 +- .../SpnegoAuthenticatorTest.java | 8 +- .../jetty/server/handler/AbstractHandler.java | 3 - .../server/session/JDBCSessionDataStore.java | 22 +- .../jetty/server/AsyncCompletionTest.java | 14 +- .../eclipse/jetty/server/AsyncStressTest.java | 48 ++-- ...Test.java => CookieCutterLenientTest.java} | 2 +- .../jetty/server/CookieCutterTest.java | 20 +- .../jetty/server/DelayedServerTest.java | 10 +- .../org/eclipse/jetty/server/DumpHandler.java | 10 +- .../jetty/server/ErrorHandlerTest.java | 6 + .../jetty/server/GracefulStopTest.java | 10 +- .../eclipse/jetty/server/HttpOutputTest.java | 1 + .../jetty/server/HttpServerTestBase.java | 7 +- .../jetty/server/HttpServerTestFixture.java | 3 +- .../eclipse/jetty/server/HttpWriterTest.java | 39 +-- .../jetty/server/InclusiveByteRangeTest.java | 26 +- .../jetty/server/LocalConnectorTest.java | 20 +- .../eclipse/jetty/server/MockConnector.java | 2 +- .../jetty/server/PartialRFC2616Test.java | 54 ++--- .../org/eclipse/jetty/server/RequestTest.java | 27 ++- .../eclipse/jetty/server/ResponseTest.java | 40 +-- .../jetty/server/ServerConnectorTest.java | 6 +- .../server/ServerConnectorTimeoutTest.java | 22 +- .../jetty/server/ServletWriterTest.java | 3 +- .../org/eclipse/jetty/server/StressTest.java | 8 +- .../server/handler/ContextHandlerTest.java | 17 +- .../server/handler/InetAccessHandlerTest.java | 8 +- .../server/handler/ResourceHandlerTest.java | 4 +- .../server/resource/RangeWriterTest.java | 8 +- .../jetty/server/ssl/SSLEngineTest.java | 4 +- .../ssl/SniSslConnectionFactoryTest.java | 2 - .../server/ssl/SslConnectionFactoryTest.java | 14 +- .../jetty/servlet/AsyncContextTest.java | 12 +- .../jetty/servlet/AsyncListenerTest.java | 80 +++--- .../jetty/servlet/AsyncServletIOTest.java | 6 +- .../jetty/servlet/AsyncServletTest.java | 78 +++--- .../servlet/ComplianceViolations2616Test.java | 4 +- .../jetty/servlet/DefaultServletTest.java | 74 +++--- .../eclipse/jetty/servlet/DispatcherTest.java | 4 +- .../eclipse/jetty/servlet/ErrorPageTest.java | 18 +- .../jetty/servlet/GzipHandlerTest.java | 9 +- .../eclipse/jetty/servlet/RequestURITest.java | 4 +- .../servlet/ServletContextResourcesTest.java | 4 +- .../jetty/servlet/ServletLifeCycleTest.java | 48 ++-- .../jetty/servlet/ServletRequestLogTest.java | 4 +- .../handler/gzip/GzipContentLengthTest.java | 12 +- .../gzip/GzipDefaultNoRecompressTest.java | 2 +- .../eclipse/jetty/servlets/DoSFilterTest.java | 4 +- .../servlets/EventSourceServletTest.java | 2 +- .../IncludeExcludeBasedFilterTest.java | 8 +- .../jetty/servlets/MultipartFilterTest.java | 1 + .../eclipse/jetty/servlets/PutFilterTest.java | 14 +- .../spring/SpringXmlConfigurationTest.java | 2 +- .../org/eclipse/jetty/start/BaseHomeTest.java | 10 +- .../java/org/eclipse/jetty/start/FSTest.java | 2 +- .../jetty/start/IncludeJettyDirTest.java | 14 +- .../jetty/start/ModuleGraphWriterTest.java | 2 +- .../org/eclipse/jetty/start/ModulesTest.java | 2 +- .../jetty/start/config/ConfigSourcesTest.java | 16 +- .../MavenLocalRepoFileInitializerTest.java | 16 +- .../jetty/unixsocket/UnixSocketClient.java | 6 +- .../org/eclipse/jetty/util/ajax/JSONTest.java | 18 +- .../org/eclipse/jetty/util/B64CodeTest.java | 4 +- .../eclipse/jetty/util/BufferUtilTest.java | 6 +- .../org/eclipse/jetty/util/DateCacheTest.java | 2 +- .../org/eclipse/jetty/util/LazyListTest.java | 228 +++++++++--------- .../org/eclipse/jetty/util/MultiMapTest.java | 42 ++-- .../eclipse/jetty/util/PathWatcherTest.java | 16 +- .../jetty/util/QuotedStringTokenizerTest.java | 8 +- .../util/RolloverFileOutputStreamTest.java | 10 +- .../org/eclipse/jetty/util/ScannerTest.java | 26 +- .../eclipse/jetty/util/StringUtilTest.java | 1 + .../org/eclipse/jetty/util/TypeUtilTest.java | 12 +- .../org/eclipse/jetty/util/URIUtilTest.java | 3 + .../eclipse/jetty/util/URLEncodedTest.java | 149 ++++++------ .../util/UrlEncodedInvalidEncodingTest.java | 4 +- .../jetty/util/Utf8AppendableTest.java | 11 +- .../LifeCycleListenerNestedTest.java | 6 +- .../org/eclipse/jetty/util/log/LogTest.java | 7 +- .../eclipse/jetty/util/log/StdErrLogTest.java | 28 +-- .../util/resource/FileSystemResourceTest.java | 22 +- .../jetty/util/resource/JarResourceTest.java | 4 +- .../jetty/util/resource/JrtResourceTest.java | 12 +- .../jetty/util/resource/PathResourceTest.java | 10 +- .../util/resource/ResourceCollectionTest.java | 22 +- .../jetty/util/security/PasswordTest.java | 1 + .../jetty/util/ssl/SslContextFactoryTest.java | 2 +- .../org/eclipse/jetty/util/ssl/X509Test.java | 24 +- .../util/thread/AbstractThreadPoolTest.java | 4 +- .../util/thread/QueuedThreadPoolTest.java | 4 +- .../jetty/webapp/ClasspathPatternTest.java | 52 ++-- .../jetty/webapp/HugeResourceTest.java | 2 +- .../jetty/webapp/WebInfConfigurationTest.java | 1 + .../websocket/jsr356/LargeMessageTest.java | 2 +- ...tedEndpointScannerGoodSignaturesTest.java} | 4 +- ...EndpointScannerInvalidSignaturesTest.java} | 4 +- .../metadata/EncoderMetadataSetTest.java | 6 +- .../jsr356/utils/ReflectUtilsTest.java | 16 +- .../jsr356/server/ConfiguratorTest.java | 8 +- .../DelayedStartClientOnServerTest.java | 18 +- .../jsr356/server/RestartContextTest.java | 4 +- ...tedEndpointScannerGoodSignaturesTest.java} | 4 +- ...EndpointScannerInvalidSignaturesTest.java} | 4 +- .../websocket/jsr356/server/SessionTest.java | 28 +-- .../jetty/websocket/tests/ErrorCloseTest.java | 14 +- .../tests/client/ClientConnectTest.java | 12 +- .../tests/client/ClientSessionsTest.java | 2 +- .../tests/client/WebSocketClientTest.java | 12 +- .../tests/server/PartialListenerTest.java | 2 +- .../api/extensions/ExtensionConfigTest.java | 4 +- ...QuoteTest.java => QuoteUtilQuoteTest.java} | 2 +- .../websocket/api/util/QuoteUtilTest.java | 18 +- .../client/ConnectionManagerTest.java | 12 +- .../client/TomcatServerQuirksTest.java | 2 +- .../client/WebSocketClientInitTest.java | 4 +- .../jetty/websocket/common/GeneratorTest.java | 12 +- .../jetty/websocket/common/ParserTest.java | 11 +- .../common/TextPayloadParserTest.java | 1 + .../{TestABCase1_1.java => TestABCase11.java} | 30 +-- .../{TestABCase1_2.java => TestABCase12.java} | 30 +-- .../websocket/common/ab/TestABCase2.java | 22 +- .../websocket/common/ab/TestABCase4.java | 8 +- .../{TestABCase7_3.java => TestABCase73.java} | 26 +- .../common/events/EventDriverTest.java | 12 +- .../events/JettyAnnotatedScannerTest.java | 4 +- .../compress/ByteAccumulatorTest.java | 4 +- .../compress/DeflateFrameExtensionTest.java | 22 +- .../PerMessageDeflateExtensionTest.java | 26 +- .../common/io/ConnectionStateTest.java | 6 +- .../io/http/HttpResponseHeaderParserTest.java | 2 +- .../common/message/MessageDebug.java | 1 + .../common/message/Utf8CharBufferTest.java | 1 + .../websocket/common/test/UnitGenerator.java | 2 +- .../common/util/Utf8PartialBuilderTest.java | 7 +- .../server/RedirectWebSocketClientTest.java | 22 +- .../websocket/server/SimpleServletServer.java | 22 +- .../websocket/server/ab/TestABCase1.java | 32 +-- .../websocket/server/ab/TestABCase2.java | 22 +- .../websocket/server/ab/TestABCase3.java | 14 +- .../websocket/server/ab/TestABCase4.java | 20 +- .../websocket/server/ab/TestABCase5.java | 42 ++-- .../websocket/server/ab/TestABCase6.java | 23 +- ...se6_BadUTF.java => TestABCase6BadUTF.java} | 2 +- ...6_GoodUTF.java => TestABCase6GoodUTF.java} | 4 +- .../websocket/server/ab/TestABCase7.java | 24 +- ...es.java => TestABCase7BadStatusCodes.java} | 4 +- ...s.java => TestABCase7GoodStatusCodes.java} | 4 +- .../websocket/server/ab/TestABCase9.java | 84 +++---- .../jetty/continuation/ContinuationsTest.java | 78 +++--- .../jetty/tests/distribution/BadAppTests.java | 6 +- .../http/client/HttpClientContinueTest.java | 46 ++-- .../jetty/test/DefaultHandlerTest.java | 6 +- .../jetty/test/DeploymentErrorTest.java | 8 +- .../jetty/test/HttpInputIntegrationTest.java | 4 +- .../jetty/test/rfcs/RFC2616BaseTest.java | 92 +++---- .../test/support/rawhttp/HttpTesting.java | 2 + .../quickstart/AttributeNormalizerTest.java | 8 +- ...ttributeNormalizerToCanonicalUriTest.java} | 2 +- .../jetty/server/session/JdbcTestHelper.java | 14 +- .../java/org/eclipse/jetty/TestServer.java | 16 +- .../jetty/TestTransparentProxyServer.java | 14 +- 221 files changed, 1792 insertions(+), 1746 deletions(-) rename jetty-server/src/test/java/org/eclipse/jetty/server/{CookieCutter_LenientTest.java => CookieCutterLenientTest.java} (99%) rename jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/{ClientAnnotatedEndpointScanner_GoodSignaturesTest.java => ClientAnnotatedEndpointScannerGoodSignaturesTest.java} (98%) rename jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/{ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java => ClientAnnotatedEndpointScannerInvalidSignaturesTest.java} (96%) rename jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/{ServerAnnotatedEndpointScanner_GoodSignaturesTest.java => ServerAnnotatedEndpointScannerGoodSignaturesTest.java} (98%) rename jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/{ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java => ServerAnnotatedEndpointScannerInvalidSignaturesTest.java} (95%) rename jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/{QuoteUtil_QuoteTest.java => QuoteUtilQuoteTest.java} (98%) rename jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/{TestABCase1_1.java => TestABCase11.java} (95%) rename jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/{TestABCase1_2.java => TestABCase12.java} (94%) rename jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/{TestABCase7_3.java => TestABCase73.java} (92%) rename jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/{TestABCase6_BadUTF.java => TestABCase6BadUTF.java} (99%) rename jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/{TestABCase6_GoodUTF.java => TestABCase6GoodUTF.java} (97%) rename jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/{TestABCase7_BadStatusCodes.java => TestABCase7BadStatusCodes.java} (96%) rename jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/{TestABCase7_GoodStatusCodes.java => TestABCase7GoodStatusCodes.java} (96%) rename tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/{AttributeNormalizer_ToCanonicalUriTest.java => AttributeNormalizerToCanonicalUriTest.java} (97%) diff --git a/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java b/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java index b641f5ab1bd..653979f75b2 100644 --- a/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java +++ b/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java @@ -26,13 +26,13 @@ public class DemoServer public static void main(String[] args) throws Exception { - String jetty_home = System.getProperty("jetty.home", "."); + String jettyHome = System.getProperty("jetty.home", "."); Server server = new Server(Integer.getInteger("jetty.http.port", 8080).intValue()); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); - webapp.setWar(jetty_home + "/target/async-rest/"); + webapp.setWar(jettyHome + "/target/async-rest/"); webapp.setParentLoaderPriority(true); webapp.setServerClasses(new String[]{}); server.setHandler(webapp); diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java index ac33ca5c2fe..1c6b2dcd4d3 100644 --- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java +++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java @@ -220,7 +220,7 @@ public class TestAnnotationParser } @Test - public void testJep238MultiReleaseInJar_JDK10() throws Exception + public void testJep238MultiReleaseInJarJDK10() throws Exception { File jdk10Jar = MavenTestingUtils.getTestResourceFile("jdk10/multirelease-10.jar"); AnnotationParser parser = new AnnotationParser(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ClientConnectionCloseTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ClientConnectionCloseTest.java index d7e41d2e950..8dca0fb3254 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ClientConnectionCloseTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ClientConnectionCloseTest.java @@ -23,7 +23,6 @@ import java.io.InterruptedIOException; import java.nio.ByteBuffer; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -50,13 +49,13 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest { @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ClientConnectionClose_ServerConnectionClose_ClientClosesAfterExchange(Scenario scenario) throws Exception + public void testClientConnectionCloseServerConnectionCloseClientClosesAfterExchange(Scenario scenario) throws Exception { byte[] data = new byte[128 * 1024]; start(scenario, new AbstractHandler() { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); @@ -107,12 +106,12 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ClientConnectionClose_ServerDoesNotRespond_ClientIdleTimeout(Scenario scenario) throws Exception + public void testClientConnectionCloseServerDoesNotRespondClientIdleTimeout(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { baseRequest.setHandled(true); request.startAsync(); @@ -149,13 +148,13 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ClientConnectionClose_ServerPartialResponse_ClientIdleTimeout(Scenario scenario) throws Exception + public void testClientConnectionCloseServerPartialResponseClientIdleTimeout(Scenario scenario) throws Exception { long idleTimeout = 1000; start(scenario, new AbstractHandler() { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); @@ -213,12 +212,12 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ClientConnectionClose_ServerNoConnectionClose_ClientCloses(Scenario scenario) throws Exception + public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); response.setContentLength(0); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java index 0739c4894ea..e85394eb905 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientAuthenticationTest.java @@ -115,51 +115,51 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BasicAuthentication(Scenario scenario) throws Exception + public void testBasicAuthentication(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler()); URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort()); - test_Authentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic")); + testAuthentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic")); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BasicEmptyRealm(Scenario scenario) throws Exception + public void testBasicEmptyRealm(Scenario scenario) throws Exception { realm = ""; startBasic(scenario, new EmptyServerHandler()); URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort()); - test_Authentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic")); + testAuthentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic")); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BasicAnyRealm(Scenario scenario) throws Exception + public void testBasicAnyRealm(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler()); URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort()); - test_Authentication(scenario, new BasicAuthentication(uri, ANY_REALM, "basic", "basic")); + testAuthentication(scenario, new BasicAuthentication(uri, ANY_REALM, "basic", "basic")); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_DigestAuthentication(Scenario scenario) throws Exception + public void testDigestAuthentication(Scenario scenario) throws Exception { startDigest(scenario, new EmptyServerHandler()); URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort()); - test_Authentication(scenario, new DigestAuthentication(uri, realm, "digest", "digest")); + testAuthentication(scenario, new DigestAuthentication(uri, realm, "digest", "digest")); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_DigestAnyRealm(Scenario scenario) throws Exception + public void testDigestAnyRealm(Scenario scenario) throws Exception { startDigest(scenario, new EmptyServerHandler()); URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort()); - test_Authentication(scenario, new DigestAuthentication(uri, ANY_REALM, "digest", "digest")); + testAuthentication(scenario, new DigestAuthentication(uri, ANY_REALM, "digest", "digest")); } - private void test_Authentication(final Scenario scenario, Authentication authentication) throws Exception + private void testAuthentication(final Scenario scenario, Authentication authentication) throws Exception { AuthenticationStore authenticationStore = client.getAuthenticationStore(); @@ -226,7 +226,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BasicAuthentication_ThenRedirect(Scenario scenario) throws Exception + public void testBasicAuthenticationThenRedirect(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler() { @@ -271,7 +271,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_Redirect_ThenBasicAuthentication(Scenario scenario) throws Exception + public void testRedirectThenBasicAuthentication(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler() { @@ -310,7 +310,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BasicAuthentication_WithAuthenticationRemoved(Scenario scenario) throws Exception + public void testBasicAuthenticationWithAuthenticationRemoved(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler()); @@ -359,7 +359,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BasicAuthentication_WithWrongPassword(Scenario scenario) throws Exception + public void testBasicAuthenticationWithWrongPassword(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler()); @@ -379,7 +379,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_Authentication_ThrowsException(Scenario scenario) throws Exception + public void testAuthenticationThrowsException(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler()); @@ -419,7 +419,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_PreemptedAuthentication(Scenario scenario) throws Exception + public void testPreemptedAuthentication(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler()); @@ -449,7 +449,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_NonReproducibleContent(Scenario scenario) throws Exception + public void testNonReproducibleContent(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler()); @@ -484,7 +484,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_RequestFailsAfterResponse(Scenario scenario) throws Exception + public void testRequestFailsAfterResponse(Scenario scenario) throws Exception { startBasic(scenario, new EmptyServerHandler() { @@ -576,7 +576,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_InfiniteAuthentication(Scenario scenario) throws Exception + public void testInfiniteAuthentication(Scenario scenario) throws Exception { String authType = "Authenticate"; start(scenario, new EmptyServerHandler() diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientChunkedContentTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientChunkedContentTest.java index 25dbf475aee..46edd0177a5 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientChunkedContentTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientChunkedContentTest.java @@ -63,7 +63,7 @@ public class HttpClientChunkedContentTest } @Test - public void test_Server_HeadersPauseTerminal_Client_Response() throws Exception + public void testServerHeadersPauseTerminalClientResponse() throws Exception { startClient(); @@ -115,7 +115,7 @@ public class HttpClientChunkedContentTest } @Test - public void test_Server_ContentTerminal_Client_ContentDelay() throws Exception + public void testServerContentTerminalClientContentDelay() throws Exception { startClient(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientRedirectTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientRedirectTest.java index c8c4b0a4a99..4ff3669e345 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientRedirectTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientRedirectTest.java @@ -59,7 +59,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest { @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_303(Scenario scenario) throws Exception + public void test303(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); @@ -75,7 +75,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_303_302(Scenario scenario) throws Exception + public void test303302(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); @@ -91,7 +91,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_303_302_OnDifferentDestinations(Scenario scenario) throws Exception + public void test303302OnDifferentDestinations(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); @@ -107,7 +107,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_301(Scenario scenario) throws Exception + public void test301(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); @@ -124,7 +124,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_301_WithWrongMethod(Scenario scenario) throws Exception + public void test301WithWrongMethod(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); @@ -144,7 +144,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_307_WithRequestContent(Scenario scenario) throws Exception + public void test307WithRequestContent(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); @@ -184,7 +184,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_303_WithConnectionClose_WithBigRequest(Scenario scenario) throws Exception + public void test303WithConnectionCloseWithBigRequest(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); @@ -314,84 +314,84 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_HEAD_301(Scenario scenario) throws Exception + public void testHEAD301(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.MOVED_PERMANENTLY_301); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_301(Scenario scenario) throws Exception + public void testPOST301(Scenario scenario) throws Exception { testGETRedirect(scenario, HttpMethod.POST, HttpStatus.MOVED_PERMANENTLY_301); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_PUT_301(Scenario scenario) throws Exception + public void testPUT301(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.MOVED_PERMANENTLY_301); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_HEAD_302(Scenario scenario) throws Exception + public void testHEAD302(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.FOUND_302); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_302(Scenario scenario) throws Exception + public void testPOST302(Scenario scenario) throws Exception { testGETRedirect(scenario, HttpMethod.POST, HttpStatus.FOUND_302); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_PUT_302(Scenario scenario) throws Exception + public void testPUT302(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.FOUND_302); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_HEAD_303(Scenario scenario) throws Exception + public void testHEAD303(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.SEE_OTHER_303); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_303(Scenario scenario) throws Exception + public void testPOST303(Scenario scenario) throws Exception { testGETRedirect(scenario, HttpMethod.POST, HttpStatus.SEE_OTHER_303); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_PUT_303(Scenario scenario) throws Exception + public void testPUT303(Scenario scenario) throws Exception { testGETRedirect(scenario, HttpMethod.PUT, HttpStatus.SEE_OTHER_303); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_HEAD_307(Scenario scenario) throws Exception + public void testHEAD307(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.TEMPORARY_REDIRECT_307); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_307(Scenario scenario) throws Exception + public void testPOST307(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.POST, HttpStatus.TEMPORARY_REDIRECT_307); } @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_PUT_307(Scenario scenario) throws Exception + public void testPUT307(Scenario scenario) throws Exception { testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.TEMPORARY_REDIRECT_307); } diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java index 5af6ddda767..b082a9753c9 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java @@ -112,6 +112,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(WorkDirExtension.class) public class HttpClientTest extends AbstractHttpClientServerTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public WorkDir testdir; @ParameterizedTest @@ -151,7 +152,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_DestinationCount(Scenario scenario) throws Exception + public void testDestinationCount(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -171,7 +172,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_GET_ResponseWithoutContent(Scenario scenario) throws Exception + public void testGETResponseWithoutContent(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -183,7 +184,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_GET_ResponseWithContent(Scenario scenario) throws Exception + public void testGETResponseWithContent(Scenario scenario) throws Exception { final byte[] data = new byte[]{0, 1, 2, 3, 4, 5, 6, 7}; start(scenario, new AbstractHandler() @@ -207,7 +208,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_GET_WithParameters_ResponseWithContent(Scenario scenario) throws Exception + public void testGETWithParametersResponseWithContent(Scenario scenario) throws Exception { final String paramName1 = "a"; final String paramName2 = "b"; @@ -240,7 +241,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_GET_WithParametersMultiValued_ResponseWithContent(Scenario scenario) throws Exception + public void testGETWithParametersMultiValuedResponseWithContent(Scenario scenario) throws Exception { final String paramName1 = "a"; final String paramName2 = "b"; @@ -279,7 +280,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_WithParameters(Scenario scenario) throws Exception + public void testPOSTWithParameters(Scenario scenario) throws Exception { final String paramName = "a"; final String paramValue = "\u20AC"; @@ -311,7 +312,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_PUT_WithParameters(Scenario scenario) throws Exception + public void testPUTWithParameters(Scenario scenario) throws Exception { final String paramName = "a"; final String paramValue = "\u20AC"; @@ -345,7 +346,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_WithParameters_WithContent(Scenario scenario) throws Exception + public void testPOSTWithParametersWithContent(Scenario scenario) throws Exception { final byte[] content = {0, 1, 2, 3}; final String paramName = "a"; @@ -380,7 +381,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_WithContent_NotifiesRequestContentListener(Scenario scenario) throws Exception + public void testPOSTWithContentNotifiesRequestContentListener(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @@ -411,7 +412,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_POST_WithContent_TracksProgress(Scenario scenario) throws Exception + public void testPOSTWithContentTracksProgress(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @@ -445,7 +446,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_QueuedRequest_IsSent_WhenPreviousRequestSucceeded(Scenario scenario) throws Exception + public void testQueuedRequestIsSentWhenPreviousRequestSucceeded(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -494,7 +495,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_QueuedRequest_IsSent_WhenPreviousRequestClosedConnection(Scenario scenario) throws Exception + public void testQueuedRequestIsSentWhenPreviousRequestClosedConnection(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @@ -510,7 +511,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest client.setMaxConnectionsPerDestination(1); - try (StacklessLogging stackless = new StacklessLogging(org.eclipse.jetty.server.HttpChannel.class)) + try (StacklessLogging ignored = new StacklessLogging(org.eclipse.jetty.server.HttpChannel.class)) { final CountDownLatch latch = new CountDownLatch(2); client.newRequest("localhost", connector.getLocalPort()) @@ -535,7 +536,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ExchangeIsComplete_OnlyWhenBothRequestAndResponseAreComplete(Scenario scenario) throws Exception + public void testExchangeIsCompleteOnlyWhenBothRequestAndResponseAreComplete(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @@ -614,7 +615,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ExchangeIsComplete_WhenRequestFailsMidway_WithResponse(Scenario scenario) throws Exception + public void testExchangeIsCompleteWhenRequestFailsMidwayWithResponse(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @@ -677,7 +678,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ExchangeIsComplete_WhenRequestFails_WithNoResponse(Scenario scenario) throws Exception + public void testExchangeIsCompleteWhenRequestFailsWithNoResponse(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -707,7 +708,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_Request_IdleTimeout(Scenario scenario) throws Exception + public void testRequestIdleTimeout(Scenario scenario) throws Exception { final long idleTimeout = 1000; start(scenario, new AbstractHandler() @@ -824,7 +825,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_HEAD_With_ResponseContentLength(Scenario scenario) throws Exception + public void testHEADWithResponseContentLength(Scenario scenario) throws Exception { final int length = 1024; start(scenario, new AbstractHandler() @@ -1328,7 +1329,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws ServletException { baseRequest.setHandled(true); request.startAsync(); @@ -1355,7 +1356,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void testSmallContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario) throws Exception + public void testSmallContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario) { Assumptions.assumeTrue(HttpScheme.HTTP.is(scenario.getScheme())); @@ -1370,7 +1371,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(NonSslScenarioProvider.class) - public void testBigContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario) throws Exception + public void testBigContentDelimitedByEOFWithSlowRequestHTTP10(Scenario scenario) { ExecutionException e = assertThrows(ExecutionException.class, () -> { @@ -1409,7 +1410,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); // Send Connection: close to avoid that the server chunks the content with HTTP 1.1. @@ -1445,7 +1446,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { int count = requests.incrementAndGet(); if (count == maxRetries) @@ -1474,7 +1475,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); ServletOutputStream output = response.getOutputStream(); @@ -1524,7 +1525,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest startServer(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) { baseRequest.setHandled(true); } @@ -1628,13 +1629,13 @@ public class HttpClientTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_IPv6_Host(Scenario scenario) throws Exception + public void testIPv6Host(Scenario scenario) throws Exception { Assumptions.assumeTrue(Net.isIpv6InterfaceAvailable()); start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); response.setContentType("text/plain"); @@ -1709,7 +1710,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) { baseRequest.setHandled(true); assertThat(request.getHeader("Host"), Matchers.notNullValue()); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientURITest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientURITest.java index 4dfca1528c7..d17dd37d66b 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientURITest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientURITest.java @@ -59,6 +59,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class HttpClientURITest extends AbstractHttpClientServerTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) public void testIPv6Host(Scenario scenario) throws Exception diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpConnectionLifecycleTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpConnectionLifecycleTest.java index b056bd8c671..fcad29b9b03 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpConnectionLifecycleTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpConnectionLifecycleTest.java @@ -18,14 +18,12 @@ package org.eclipse.jetty.client; -import java.io.IOException; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Collection; import java.util.Queue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -62,7 +60,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_SuccessfulRequest_ReturnsConnection(Scenario scenario) throws Exception + public void testSuccessfulRequestReturnsConnection(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -113,7 +111,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_FailedRequest_RemovesConnection(Scenario scenario) throws Exception + public void testFailedRequestRemovesConnection(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -165,7 +163,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BadRequest_RemovesConnection(Scenario scenario) throws Exception + public void testBadRequestRemovesConnection(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -227,7 +225,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ArgumentsSource(ScenarioProvider.class) @Tag("Slow") @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_BadRequest_WithSlowRequest_RemovesConnection(Scenario scenario) throws Exception + public void testBadRequestWithSlowRequestRemovesConnection(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -301,7 +299,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ConnectionFailure_RemovesConnection(Scenario scenario) throws Exception + public void testConnectionFailureRemovesConnection(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -336,12 +334,12 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_ResponseWithConnectionCloseHeader_RemovesConnection(Scenario scenario) throws Exception + public void testResponseWithConnectionCloseHeaderRemovesConnection(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) { response.setHeader("Connection", "close"); baseRequest.setHandled(true); @@ -382,14 +380,14 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_BigRequestContent_ResponseWithConnectionCloseHeader_RemovesConnection(Scenario scenario) throws Exception + public void testBigRequestContentResponseWithConnectionCloseHeaderRemovesConnection(Scenario scenario) throws Exception { try (StacklessLogging ignore = new StacklessLogging(HttpConnection.class)) { start(scenario, new AbstractHandler() { @Override - public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) { response.setHeader("Connection", "close"); baseRequest.setHandled(true); @@ -441,7 +439,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest @ArgumentsSource(ScenarioProvider.class) @Tag("Slow") @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_IdleConnection_IsClosed_OnRemoteClose(Scenario scenario) throws Exception + public void testIdleConnectionIsClosedOnRemoteClose(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpCookieTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpCookieTest.java index f03c235e439..3da1b55c446 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpCookieTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpCookieTest.java @@ -18,7 +18,6 @@ package org.eclipse.jetty.client; -import java.io.IOException; import java.net.HttpCookie; import java.net.URI; import java.util.Arrays; @@ -27,7 +26,6 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -52,14 +50,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_CookieIsStored(Scenario scenario) throws Exception + public void testCookieIsStored(Scenario scenario) throws Exception { final String name = "foo"; final String value = "bar"; start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { response.addCookie(new Cookie(name, value)); } @@ -82,14 +80,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_CookieIsSent(Scenario scenario) throws Exception + public void testCookieIsSent(Scenario scenario) throws Exception { final String name = "foo"; final String value = "bar"; start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { Cookie[] cookies = request.getCookies(); assertNotNull(cookies); @@ -113,12 +111,12 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_CookieWithoutValue(Scenario scenario) throws Exception + public void testCookieWithoutValue(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { response.addHeader("Set-Cookie", ""); } @@ -133,14 +131,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_PerRequestCookieIsSent(Scenario scenario) throws Exception + public void testPerRequestCookieIsSent(Scenario scenario) throws Exception { final String name = "foo"; final String value = "bar"; start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { Cookie[] cookies = request.getCookies(); assertNotNull(cookies); @@ -161,7 +159,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_SetCookieWithoutPath_RequestURIWithOneSegment(Scenario scenario) throws Exception + public void testSetCookieWithoutPathRequestURIWithOneSegment(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -169,7 +167,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo".equals(target) && r == 0) @@ -217,7 +215,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_SetCookieWithoutPath_RequestURIWithTwoSegments(Scenario scenario) throws Exception + public void testSetCookieWithoutPathRequestURIWithTwoSegments(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -225,7 +223,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo/bar".equals(target) && r == 0) @@ -278,7 +276,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_SetCookieWithLongerPath(Scenario scenario) throws Exception + public void testSetCookieWithLongerPath(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -286,7 +284,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo".equals(target) && r == 0) @@ -339,7 +337,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_SetCookieWithShorterPath(Scenario scenario) throws Exception + public void testSetCookieWithShorterPath(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -347,7 +345,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo/bar".equals(target) && r == 0) @@ -400,7 +398,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_TwoSetCookieWithSameNameSamePath(Scenario scenario) throws Exception + public void testTwoSetCookieWithSameNameSamePath(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -409,7 +407,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo".equals(target) && r == 0) @@ -463,7 +461,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_TwoSetCookieWithSameNameDifferentPath(Scenario scenario) throws Exception + public void testTwoSetCookieWithSameNameDifferentPath(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -472,7 +470,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo".equals(target) && r == 0) @@ -533,7 +531,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_TwoSetCookieWithSameNamePath1PrefixOfPath2(Scenario scenario) throws Exception + public void testTwoSetCookieWithSameNamePath1PrefixOfPath2(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -542,7 +540,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo".equals(target) && r == 0) @@ -606,7 +604,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_CookiePathWithTrailingSlash(Scenario scenario) throws Exception + public void testCookiePathWithTrailingSlash(Scenario scenario) throws Exception { String headerName = "X-Request"; String cookieName = "a"; @@ -614,7 +612,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest start(scenario, new EmptyServerHandler() { @Override - protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { int r = request.getIntHeader(headerName); if ("/foo/bar".equals(target) && r == 0) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/api/Usage.java b/jetty-client/src/test/java/org/eclipse/jetty/client/api/Usage.java index b9ecc86c6bb..9fdb072790f 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/api/Usage.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/api/Usage.java @@ -49,10 +49,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @Disabled +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class Usage { @Test - public void testGETBlocking_ShortAPI() throws Exception + public void testGETBlockingShortAPI() throws Exception { HttpClient client = new HttpClient(); client.start(); @@ -120,7 +121,7 @@ public class Usage } @Test - public void testPOSTWithParams_ShortAPI() throws Exception + public void testPOSTWithParamsShortAPI() throws Exception { HttpClient client = new HttpClient(); client.start(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java index f09569174eb..2b45c3ea8a1 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpDestinationOverHTTPTest.java @@ -52,7 +52,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest { @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_FirstAcquire_WithEmptyQueue(Scenario scenario) throws Exception + public void testFirstAcquireWithEmptyQueue(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -72,7 +72,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_SecondAcquire_AfterFirstAcquire_WithEmptyQueue_ReturnsSameConnection(Scenario scenario) throws Exception + public void testSecondAcquireAfterFirstAcquireWithEmptyQueueReturnsSameConnection(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -96,7 +96,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_SecondAcquire_ConcurrentWithFirstAcquire_WithEmptyQueue_CreatesTwoConnections(Scenario scenario) throws Exception + public void testSecondAcquireConcurrentWithFirstAcquireWithEmptyQueueCreatesTwoConnections(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -154,7 +154,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_Acquire_Process_Release_Acquire_ReturnsSameConnection(Scenario scenario) throws Exception + public void testAcquireProcessReleaseAcquireReturnsSameConnection(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -181,7 +181,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_IdleConnection_IdleTimeout(Scenario scenario) throws Exception + public void testIdleConnectionIdleTimeout(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); @@ -209,7 +209,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest @ParameterizedTest @ArgumentsSource(ScenarioProvider.class) - public void test_Request_Failed_If_MaxRequestsQueuedPerDestination_Exceeded(Scenario scenario) throws Exception + public void testRequestFailedIfMaxRequestsQueuedPerDestinationExceeded(Scenario scenario) throws Exception { start(scenario, new EmptyServerHandler()); String scheme = scenario.getScheme(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java index bc8f60efa0e..578a2e4afe5 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java @@ -61,7 +61,7 @@ public class HttpReceiverOverHTTPTest private ByteArrayEndPoint endPoint; private HttpConnectionOverHTTP connection; - public static Stream complianceModes() throws Exception + public static Stream complianceModes() { return Stream.of( HttpCompliance.LEGACY, @@ -102,7 +102,7 @@ public class HttpReceiverOverHTTPTest @ParameterizedTest @MethodSource("complianceModes") - public void test_Receive_NoResponseContent(HttpCompliance compliance) throws Exception + public void testReceiveNoResponseContent(HttpCompliance compliance) throws Exception { init(compliance); endPoint.addInput( @@ -126,7 +126,7 @@ public class HttpReceiverOverHTTPTest @ParameterizedTest @MethodSource("complianceModes") - public void test_Receive_ResponseContent(HttpCompliance compliance) throws Exception + public void testReceiveResponseContent(HttpCompliance compliance) throws Exception { init(compliance); String content = "0123456789ABCDEF"; @@ -154,7 +154,7 @@ public class HttpReceiverOverHTTPTest @ParameterizedTest @MethodSource("complianceModes") - public void test_Receive_ResponseContent_EarlyEOF(HttpCompliance compliance) throws Exception + public void testReceiveResponseContentEarlyEOF(HttpCompliance compliance) throws Exception { init(compliance); String content1 = "0123456789"; @@ -176,7 +176,7 @@ public class HttpReceiverOverHTTPTest @ParameterizedTest @MethodSource("complianceModes") - public void test_Receive_ResponseContent_IdleTimeout(HttpCompliance compliance) throws Exception + public void testReceiveResponseContentIdleTimeout(HttpCompliance compliance) throws Exception { init(compliance); endPoint.addInput( @@ -197,7 +197,7 @@ public class HttpReceiverOverHTTPTest @ParameterizedTest @MethodSource("complianceModes") - public void test_Receive_BadResponse(HttpCompliance compliance) throws Exception + public void testReceiveBadResponse(HttpCompliance compliance) throws Exception { init(compliance); endPoint.addInput( @@ -216,7 +216,7 @@ public class HttpReceiverOverHTTPTest @ParameterizedTest @MethodSource("complianceModes") - public void test_FillInterested_RacingWith_BufferRelease(HttpCompliance compliance) throws Exception + public void testFillInterestedRacingWithBufferRelease(HttpCompliance compliance) throws Exception { init(compliance); connection = new HttpConnectionOverHTTP(endPoint, destination, new Promise.Adapter<>()) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpSenderOverHTTPTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpSenderOverHTTPTest.java index 0c8b642f432..7cb7795af38 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpSenderOverHTTPTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpSenderOverHTTPTest.java @@ -61,7 +61,7 @@ public class HttpSenderOverHTTPTest } @Test - public void test_Send_NoRequestContent() throws Exception + public void testSendNoRequestContent() throws Exception { ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080)); @@ -95,7 +95,7 @@ public class HttpSenderOverHTTPTest @Test @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_Send_NoRequestContent_IncompleteFlush() throws Exception + public void testSendNoRequestContentIncompleteFlush() throws Exception { ByteArrayEndPoint endPoint = new ByteArrayEndPoint("", 16); HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080)); @@ -123,7 +123,7 @@ public class HttpSenderOverHTTPTest } @Test - public void test_Send_NoRequestContent_Exception() throws Exception + public void testSendNoRequestContentException() throws Exception { ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); // Shutdown output to trigger the exception on write @@ -155,7 +155,7 @@ public class HttpSenderOverHTTPTest } @Test - public void test_Send_NoRequestContent_IncompleteFlush_Exception() throws Exception + public void testSendNoRequestContentIncompleteFlushException() throws Exception { ByteArrayEndPoint endPoint = new ByteArrayEndPoint("", 16); HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080)); @@ -191,7 +191,7 @@ public class HttpSenderOverHTTPTest } @Test - public void test_Send_SmallRequestContent_InOneBuffer() throws Exception + public void testSendSmallRequestContentInOneBuffer() throws Exception { ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080)); @@ -226,7 +226,7 @@ public class HttpSenderOverHTTPTest } @Test - public void test_Send_SmallRequestContent_InTwoBuffers() throws Exception + public void testSendSmallRequestContentInTwoBuffers() throws Exception { ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080)); @@ -262,7 +262,7 @@ public class HttpSenderOverHTTPTest } @Test - public void test_Send_SmallRequestContent_Chunked_InTwoChunks() throws Exception + public void testSendSmallRequestContentChunkedInTwoChunks() throws Exception { ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", 8080)); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartContentProviderTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartContentProviderTest.java index 4e44d72480a..98f91a7a5ab 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartContentProviderTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartContentProviderTest.java @@ -62,6 +62,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class MultiPartContentProviderTest extends AbstractHttpClientServerTest { @ParameterizedTest diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/util/TypedContentProviderTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/util/TypedContentProviderTest.java index 260a47d67b2..df074718747 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/util/TypedContentProviderTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/util/TypedContentProviderTest.java @@ -51,6 +51,7 @@ public class TypedContentProviderTest extends AbstractHttpClientServerTest final String value1 = "1"; final String name2 = "b"; final String value2 = "2"; + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck final String value3 = "\u20AC"; start(scenario, new AbstractHandler() diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java index f5be8f6ee97..452c0c51016 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java @@ -86,13 +86,13 @@ public class AppLifeCycleTest } @Test - public void testFindPath_Deployed_Deployed() + public void testFindPathDeployedDeployed() { assertNoPath("deployed", "deployed"); } @Test - public void testFindPath_Deployed_Started() + public void testFindPathDeployedStarted() { List expected = new ArrayList(); expected.add("deployed"); @@ -102,7 +102,7 @@ public class AppLifeCycleTest } @Test - public void testFindPath_Deployed_Undeployed() + public void testFindPathDeployedUndeployed() { List expected = new ArrayList(); expected.add("deployed"); @@ -112,7 +112,7 @@ public class AppLifeCycleTest } @Test - public void testFindPath_Started_Deployed() + public void testFindPathStartedDeployed() { List expected = new ArrayList(); expected.add("started"); @@ -122,13 +122,13 @@ public class AppLifeCycleTest } @Test - public void testFindPath_Started_Started() + public void testFindPathStartedStarted() { assertNoPath("started", "started"); } @Test - public void testFindPath_Started_Undeployed() + public void testFindPathStartedUndeployed() { List expected = new ArrayList(); expected.add("started"); @@ -140,7 +140,7 @@ public class AppLifeCycleTest } @Test - public void testFindPath_Undeployed_Deployed() + public void testFindPathUndeployedDeployed() { List expected = new ArrayList(); expected.add("undeployed"); @@ -150,7 +150,7 @@ public class AppLifeCycleTest } @Test - public void testFindPath_Undeployed_Started() + public void testFindPathUndeployedStarted() { List expected = new ArrayList(); expected.add("undeployed"); @@ -162,7 +162,7 @@ public class AppLifeCycleTest } @Test - public void testFindPath_Undeployed_Uavailable() + public void testFindPathUndeployedUnavailable() { assertNoPath("undeployed", "undeployed"); } diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/BadAppDeployTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/BadAppDeployTest.java index 06bb0d2a505..ef0df63f027 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/BadAppDeployTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/BadAppDeployTest.java @@ -63,7 +63,7 @@ public class BadAppDeployTest } @Test - public void testBadApp_ThrowOnUnavailableTrue_XmlOrder() throws Exception + public void testBadAppThrowOnUnavailableTrueXmlOrder() throws Exception { /* Non-working Bean Order as reported in Issue #3620 It is important that this Order be maintained for an accurate test case. @@ -116,7 +116,7 @@ public class BadAppDeployTest } @Test - public void testBadApp_ThrowOnUnavailableTrue_EmbeddedOrder() throws Exception + public void testBadAppThrowOnUnavailableTrueEmbeddedOrder() throws Exception { /* Working Bean Order ### BEAN: QueuedThreadPool[qtp1530388690]@5b37e0d2{STOPPED,8<=0<=200,i=0,r=-1,q=0}[NO_TRY] diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java index 33ee00fc609..2d15ead3582 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/DeploymentManagerLifeCyclePathTest.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test; public class DeploymentManagerLifeCyclePathTest { @Test - public void testStateTransition_NewToDeployed() throws Exception + public void testStateTransitionNewToDeployed() throws Exception { DeploymentManager depman = new DeploymentManager(); depman.setContexts(new ContextHandlerCollection()); @@ -64,7 +64,7 @@ public class DeploymentManagerLifeCyclePathTest } @Test - public void testStateTransition_Receive() throws Exception + public void testStateTransitionReceive() throws Exception { DeploymentManager depman = new DeploymentManager(); depman.setContexts(new ContextHandlerCollection()); @@ -90,7 +90,7 @@ public class DeploymentManagerLifeCyclePathTest } @Test - public void testStateTransition_DeployedToUndeployed() throws Exception + public void testStateTransitionDeployedToUndeployed() throws Exception { DeploymentManager depman = new DeploymentManager(); depman.setDefaultLifeCycleGoal(null); // no default diff --git a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/HttpClientTest.java b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/HttpClientTest.java index e1720bdf2a5..79e7859148f 100644 --- a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/HttpClientTest.java +++ b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/HttpClientTest.java @@ -65,6 +65,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class HttpClientTest extends AbstractHttpClientServerTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck + @Test public void testGETResponseWithoutContent() throws Exception { diff --git a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/DrupalHTTP2FastCGIProxyServer.java b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/DrupalHTTP2FastCGIProxyServer.java index e3c22bedceb..f17665192cc 100644 --- a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/DrupalHTTP2FastCGIProxyServer.java +++ b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/DrupalHTTP2FastCGIProxyServer.java @@ -47,11 +47,11 @@ public class DrupalHTTP2FastCGIProxyServer // HTTP(S) Configuration HttpConfiguration config = new HttpConfiguration(); - HttpConfiguration https_config = new HttpConfiguration(config); - https_config.addCustomizer(new SecureRequestCustomizer()); + HttpConfiguration httpsConfig = new HttpConfiguration(config); + httpsConfig.addCustomizer(new SecureRequestCustomizer()); // HTTP2 factory - HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config); + HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig); ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory(); alpn.setDefaultProtocol(h2.getProtocol()); @@ -60,7 +60,7 @@ public class DrupalHTTP2FastCGIProxyServer // HTTP2 Connector ServerConnector http2Connector = - new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(https_config)); + new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(httpsConfig)); http2Connector.setPort(8443); http2Connector.setIdleTimeout(15000); server.addConnector(http2Connector); diff --git a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/WordPressHTTP2FastCGIProxyServer.java b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/WordPressHTTP2FastCGIProxyServer.java index 8b59601b4ef..238e8d5bd66 100644 --- a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/WordPressHTTP2FastCGIProxyServer.java +++ b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/proxy/WordPressHTTP2FastCGIProxyServer.java @@ -52,12 +52,12 @@ public class WordPressHTTP2FastCGIProxyServer Server server = new Server(); // HTTP(S) Configuration - HttpConfiguration config = new HttpConfiguration(); - HttpConfiguration https_config = new HttpConfiguration(config); - https_config.addCustomizer(new SecureRequestCustomizer()); + HttpConfiguration httpConfig = new HttpConfiguration(); + HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); + httpsConfig.addCustomizer(new SecureRequestCustomizer()); // HTTP2 factory - HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config); + HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig); ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory(); alpn.setDefaultProtocol(h2.getProtocol()); @@ -66,7 +66,7 @@ public class WordPressHTTP2FastCGIProxyServer // HTTP2 Connector ServerConnector http2Connector = - new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(https_config)); + new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(httpsConfig)); http2Connector.setPort(tlsPort); http2Connector.setIdleTimeout(15000); server.addConnector(http2Connector); diff --git a/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestEndpointMultiplePublishProblem.java b/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestEndpointMultiplePublishProblem.java index 6acf3de5882..635991a9ff0 100644 --- a/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestEndpointMultiplePublishProblem.java +++ b/jetty-http-spi/src/test/java/org/eclipse/jetty/http/spi/TestEndpointMultiplePublishProblem.java @@ -45,13 +45,13 @@ public class TestEndpointMultiplePublishProblem private static String default_impl = System.getProperty("com.sun.net.httpserver.HttpServerProvider"); @BeforeAll - public static void change_Impl() + public static void changeImpl() { System.setProperty("com.sun.net.httpserver.HttpServerProvider", JettyHttpServerProvider.class.getName()); } @AfterAll - public static void restore_Impl() + public static void restoreImpl() { if (default_impl != null) { diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java index 7faa8d19cca..c28478489e1 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java @@ -359,10 +359,10 @@ public class GZIPContentDecoderTest } // Signed Integer Max - final long INT_MAX = Integer.MAX_VALUE; + static final long INT_MAX = Integer.MAX_VALUE; // Unsigned Integer Max == 2^32 - final long UINT_MAX = 0xFFFFFFFFL; + static final long UINT_MAX = 0xFFFFFFFFL; @ParameterizedTest @ValueSource(longs = {INT_MAX, INT_MAX + 1, UINT_MAX, UINT_MAX + 1}) diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldTest.java index 32d186fbbc2..ccffa9ca85d 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldTest.java @@ -32,9 +32,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class HttpFieldTest { - @Test - public void testContainsSimple() throws Exception + public void testContainsSimple() { HttpField field = new HttpField("name", "SomeValue"); assertTrue(field.contains("somevalue")); @@ -50,7 +49,7 @@ public class HttpFieldTest } @Test - public void testCaseInsensitiveHashcode_KnownField() throws Exception + public void testCaseInsensitiveHashcodeKnownField() { HttpField fieldFoo1 = new HttpField("Cookie", "foo"); HttpField fieldFoo2 = new HttpField("cookie", "foo"); @@ -59,7 +58,7 @@ public class HttpFieldTest } @Test - public void testCaseInsensitiveHashcode_UnknownField() throws Exception + public void testCaseInsensitiveHashcodeUnknownField() { HttpField fieldFoo1 = new HttpField("X-Foo", "bar"); HttpField fieldFoo2 = new HttpField("x-foo", "bar"); @@ -68,7 +67,7 @@ public class HttpFieldTest } @Test - public void testContainsList() throws Exception + public void testContainsList() { HttpField field = new HttpField("name", ",aaa,Bbb,CCC, ddd , e e, \"\\\"f,f\\\"\", "); assertTrue(field.contains("aaa")); @@ -91,7 +90,7 @@ public class HttpFieldTest } @Test - public void testQualityContainsList() throws Exception + public void testQualityContainsList() { HttpField field; diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorServerTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorServerTest.java index 180b945b0d9..5574bcf5b9f 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorServerTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorServerTest.java @@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; public class HttpGeneratorServerTest { @Test - public void test_0_9() throws Exception + public void test09() throws Exception { ByteBuffer header = BufferUtil.allocate(8096); ByteBuffer content = BufferUtil.toBuffer("0123456789"); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java index 2f30eeac7c4..d454d5e49eb 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java @@ -48,6 +48,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class HttpParserTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck + static { HttpCompliance.CUSTOM0.sections().remove(HttpComplianceSection.NO_WS_AFTER_FIELD_NAME); @@ -72,16 +74,16 @@ public class HttpParserTest int remaining = buffer.remaining(); while (!parser.isState(State.END) && remaining > 0) { - int was_remaining = remaining; + int wasRemaining = remaining; parser.parseNext(buffer); remaining = buffer.remaining(); - if (remaining == was_remaining) + if (remaining == wasRemaining) break; } } @Test - public void HttpMethodTest() + public void httpMethodTest() { assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer("Wibble "))); assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer("GET"))); @@ -831,8 +833,8 @@ public class HttpParserTest "Foo\"Bar: value\r\n", "Foo/Bar: value\r\n", "Foo]Bar: value\r\n", - "Foo[Bar: value\r\n", - }; + "Foo[Bar: value\r\n" + }; for (String s : bad) { @@ -1558,7 +1560,7 @@ public class HttpParserTest } @Test - public void testResponseReasonIso8859_1() + public void testResponseReasonIso88591() { ByteBuffer buffer = BufferUtil.toBuffer( "HTTP/1.1 302 déplacé temporairement\r\n" + diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpTester.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpTester.java index 248ca2f22d1..96a59bc446b 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpTester.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpTester.java @@ -361,8 +361,8 @@ public class HttpTester return null; byte[] bytes = _content.toByteArray(); - String content_type = get(HttpHeader.CONTENT_TYPE); - String encoding = MimeTypes.getCharsetFromContentType(content_type); + String contentType = get(HttpHeader.CONTENT_TYPE); + String encoding = MimeTypes.getCharsetFromContentType(contentType); Charset charset = encoding == null ? StandardCharsets.UTF_8 : Charset.forName(encoding); return new String(bytes, charset); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java index cb9d0d2b056..dda9de72cb6 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java @@ -102,6 +102,7 @@ public class HttpURITest @Test public void testExtB() throws Exception { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck for (String value : new String[]{"a", "abcdABCD", "\u00C0", "\u697C", "\uD869\uDED5", "\uD840\uDC08"}) { HttpURI uri = new HttpURI("/path?value=" + URLEncoder.encode(value, "UTF-8")); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java index e7db52c8246..efe578d5a87 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java @@ -29,13 +29,13 @@ import static org.junit.jupiter.api.Assertions.assertNull; public class MimeTypesTest { @Test - public void testGetMimeByExtension_Gzip() + public void testGetMimeByExtensionGzip() { assertMimeTypeByExtension("application/gzip", "test.gz"); } @Test - public void testGetMimeByExtension_Png() + public void testGetMimeByExtensionPng() { assertMimeTypeByExtension("image/png", "test.png"); assertMimeTypeByExtension("image/png", "TEST.PNG"); @@ -43,26 +43,26 @@ public class MimeTypesTest } @Test - public void testGetMimeByExtension_Png_MultiDot() + public void testGetMimeByExtensionPngMultiDot() { assertMimeTypeByExtension("image/png", "org.eclipse.jetty.Logo.png"); } @Test - public void testGetMimeByExtension_Png_DeepPath() + public void testGetMimeByExtensionPngDeepPath() { assertMimeTypeByExtension("image/png", "/org/eclipse/jetty/Logo.png"); } @Test - public void testGetMimeByExtension_Text() + public void testGetMimeByExtensionText() { assertMimeTypeByExtension("text/plain", "test.txt"); assertMimeTypeByExtension("text/plain", "TEST.TXT"); } @Test - public void testGetMimeByExtension_NoExtension() + public void testGetMimeByExtensionNoExtension() { MimeTypes mimetypes = new MimeTypes(); String contentType = mimetypes.getMimeByExtension("README"); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartParserTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartParserTest.java index 44358ebabcd..ac5f8cbdbce 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartParserTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartParserTest.java @@ -34,6 +34,7 @@ import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class MultiPartParserTest { @@ -174,12 +175,12 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" + - "name0: value0\r\n" + - "name1 :value1 \r\n" + - "name2:value\r\n" + - " 2\r\n" + - "\r\n" + - "Content"); + "name0: value0\r\n" + + "name1 :value1 \r\n" + + "name2:value\r\n" + + " 2\r\n" + + "\r\n" + + "Content"); parser.parse(data, false); assertThat(parser.getState(), is(State.FIRST_OCTETS)); @@ -194,10 +195,10 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" + - "name: value\r\n" + - "\r\n" + - "\r\n" + - "--BOUNDARY"); + "name: value\r\n" + + "\r\n" + + "\r\n" + + "--BOUNDARY"); parser.parse(data, false); assertThat(parser.getState(), is(State.DELIMITER)); assertThat(data.remaining(), is(0)); @@ -212,9 +213,9 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" + - "name: value\r\n" + - "\r\n" + - "--BOUNDARY"); + "name: value\r\n" + + "\r\n" + + "--BOUNDARY"); parser.parse(data, false); assertThat(parser.getState(), is(State.DELIMITER)); assertThat(data.remaining(), is(0)); @@ -229,9 +230,9 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" + - "name: value\r\n" + - "\r\n" + - "-"); + "name: value\r\n" + + "\r\n" + + "-"); parser.parse(data, false); data = BufferUtil.toBuffer("Content!"); parser.parse(data, false); @@ -249,9 +250,9 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" + - "name: value\n" + - "\r\n" + - "Hello\r\n"); + "name: value\n" + + "\r\n" + + "Hello\r\n"); parser.parse(data, false); assertThat(parser.getState(), is(State.OCTETS)); assertThat(data.remaining(), is(0)); @@ -260,17 +261,17 @@ public class MultiPartParserTest data = BufferUtil.toBuffer( "Now is the time for all good ment to come to the aid of the party.\r\n" + - "How now brown cow.\r\n" + - "The quick brown fox jumped over the lazy dog.\r\n" + - "this is not a --BOUNDARY\r\n"); + "How now brown cow.\r\n" + + "The quick brown fox jumped over the lazy dog.\r\n" + + "this is not a --BOUNDARY\r\n"); parser.parse(data, false); assertThat(parser.getState(), is(State.OCTETS)); assertThat(data.remaining(), is(0)); assertThat(handler.fields, Matchers.contains("name: value", "<>")); assertThat(handler.content, Matchers.contains("Hello", "\r\n", "Now is the time for all good ment to come to the aid of the party.\r\n" + - "How now brown cow.\r\n" + - "The quick brown fox jumped over the lazy dog.\r\n" + - "this is not a --BOUNDARY")); + "How now brown cow.\r\n" + + "The quick brown fox jumped over the lazy dog.\r\n" + + "this is not a --BOUNDARY")); } @Test @@ -280,10 +281,10 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" + - "name: value\n" + - "\r\n" + - "Hello\r\n" + - "--BOUNDARY"); + "name: value\n" + + "\r\n" + + "Hello\r\n" + + "--BOUNDARY"); parser.parse(data, false); assertThat(parser.getState(), is(State.DELIMITER)); assertThat(data.remaining(), is(0)); @@ -298,20 +299,20 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\r\n" + - "name: value\n" + - "\r\n" + - "Now is the time for all good ment to come to the aid of the party.\r\n" + - "How now brown cow.\r\n" + - "The quick brown fox jumped over the lazy dog.\r\n" + - "\r\n" + - "--BOUNDARY"); + "name: value\n" + + "\r\n" + + "Now is the time for all good ment to come to the aid of the party.\r\n" + + "How now brown cow.\r\n" + + "The quick brown fox jumped over the lazy dog.\r\n" + + "\r\n" + + "--BOUNDARY"); parser.parse(data, false); assertThat(parser.getState(), is(State.DELIMITER)); assertThat(data.remaining(), is(0)); assertThat(handler.fields, Matchers.contains("name: value", "<>")); assertThat(handler.content, Matchers.contains("Now is the time for all good ment to come to the aid of the party.\r\n" + - "How now brown cow.\r\n" + - "The quick brown fox jumped over the lazy dog.\r\n", "<>")); + "How now brown cow.\r\n" + + "The quick brown fox jumped over the lazy dog.\r\n", "<>")); } @Test @@ -322,20 +323,20 @@ public class MultiPartParserTest //boundary still requires carriage return ByteBuffer data = BufferUtil.toBuffer("--BOUNDARY\n" + - "name: value\n" + - "\n" + - "Now is the time for all good men to come to the aid of the party.\n" + - "How now brown cow.\n" + - "The quick brown fox jumped over the lazy dog.\n" + - "\r\n" + - "--BOUNDARY"); + "name: value\n" + + "\n" + + "Now is the time for all good men to come to the aid of the party.\n" + + "How now brown cow.\n" + + "The quick brown fox jumped over the lazy dog.\n" + + "\r\n" + + "--BOUNDARY"); parser.parse(data, false); assertThat(parser.getState(), is(State.DELIMITER)); assertThat(data.remaining(), is(0)); assertThat(handler.fields, Matchers.contains("name: value", "<>")); assertThat(handler.content, Matchers.contains("Now is the time for all good men to come to the aid of the party.\n" + - "How now brown cow.\n" + - "The quick brown fox jumped over the lazy dog.\n", "<>")); + "How now brown cow.\n" + + "The quick brown fox jumped over the lazy dog.\n", "<>")); } @Test @@ -378,16 +379,16 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("" + - "--BOUNDARY\r\n" + - "name: value\n" + - "\r\n" + - "Hello\r\n" + - "--BOUNDARY--" + - "epilogue here:" + - "\r\n" + - "--BOUNDARY--" + - "\r\n" + - "--BOUNDARY"); + "--BOUNDARY\r\n" + + "name: value\n" + + "\r\n" + + "Hello\r\n" + + "--BOUNDARY--" + + "epilogue here:" + + "\r\n" + + "--BOUNDARY--" + + "\r\n" + + "--BOUNDARY"); parser.parse(data, false); assertThat(parser.getState(), is(State.DELIMITER)); @@ -405,19 +406,19 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "BOUNDARY"); ByteBuffer data = BufferUtil.toBuffer("" + - "--BOUNDARY\r\n" + - "name: value\n" + - "\r\n" + - "Hello" + - "\r\n" + - "--BOUNDARY\r\n" + - "powerLevel: 9001\n" + - "\r\n" + - "secondary" + - "\r\n" + - "content" + - "\r\n--BOUNDARY--" + - "epilogue here"); + "--BOUNDARY\r\n" + + "name: value\n" + + "\r\n" + + "Hello" + + "\r\n" + + "--BOUNDARY\r\n" + + "powerLevel: 9001\n" + + "\r\n" + + "secondary" + + "\r\n" + + "content" + + "\r\n--BOUNDARY--" + + "epilogue here"); /* Test First Content Section */ parser.parse(data, false); @@ -613,20 +614,20 @@ public class MultiPartParserTest assertThat("Third " + i, parser.parse(dataSeg, true), is(true)); assertThat(handler.fields, Matchers.contains("Content-Disposition: form-data; name=\"text\"", "<>", - "Content-Disposition: form-data; name=\"file1\"; filename=\"a.txt\"", - "Content-Type: text/plain", "<>", - "Content-Disposition: form-data; name=\"file2\"; filename=\"a.html\"", - "Content-Type: text/html", "<>", - "Field1: value1", "Field2: value2", "Field3: value3", - "Field4: value4", "Field5: value5", "Field6: value6", - "Field7: value7", "Field8: value8", "Field9: value 9", "<>", - "Field1: value1", "<>")); + "Content-Disposition: form-data; name=\"file1\"; filename=\"a.txt\"", + "Content-Type: text/plain", "<>", + "Content-Disposition: form-data; name=\"file2\"; filename=\"a.html\"", + "Content-Type: text/html", "<>", + "Field1: value1", "Field2: value2", "Field3: value3", + "Field4: value4", "Field5: value5", "Field6: value6", + "Field7: value7", "Field8: value8", "Field9: value 9", "<>", + "Field1: value1", "<>")); assertThat(handler.contentString(), is("text default" + "<>" + - "Content of a.txt.\n" + "<>" + - "Content of a.html.\n" + "<>" + - "<>" + - "But the amount of denudation which the strata have\n" + + "Content of a.txt.\n" + "<>" + + "Content of a.html.\n" + "<>" + + "<>" + + "But the amount of denudation which the strata have\n" + "in many places suffered, independently of the rate\n" + "of accumulation of the degraded matter, probably\n" + "offers the best evidence of the lapse of time. I remember\n" + @@ -671,17 +672,17 @@ public class MultiPartParserTest MultiPartParser parser = new MultiPartParser(handler, "WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW"); ByteBuffer data = BufferUtil.toBuffer("" + - "Content-Type: multipart/form-data; boundary=WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" + - "\r\n" + - "--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" + - "Content-Disposition: form-data; name=\"part1\"\r\n" + - "\n" + - "wNfミxVam﾿t\r\n" + - "--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\n" + - "Content-Disposition: form-data; name=\"part2\"\r\n" + - "\r\n" + - "&ᄈᄎ￙ᅱᅢO\r\n" + - "--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW--"); + "Content-Type: multipart/form-data; boundary=WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" + + "\r\n" + + "--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\r\n" + + "Content-Disposition: form-data; name=\"part1\"\r\n" + + "\n" + + "wNfミxVam﾿t\r\n" + + "--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW\n" + + "Content-Disposition: form-data; name=\"part2\"\r\n" + + "\r\n" + + "&ᄈᄎ￙ᅱᅢO\r\n" + + "--WebKitFormBoundary7MA4YWf7OaKlSxkTrZu0gW--"); parser.parse(data, true); assertThat(parser.getState(), is(State.END)); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java index 5062c48b7f1..5f6bdc2da06 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java @@ -44,6 +44,7 @@ public class PathMapTest p.put("/", "8"); p.put("/XXX:/YYY", "9"); p.put("", "10"); + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck p.put("/\u20ACuro/*", "11"); String[][] tests = { @@ -64,9 +65,10 @@ public class PathMapTest {"/suffix/path.gz", "7"}, {"/animal/path.gz", "5"}, {"/Other/path", "8"}, + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck {"/\u20ACuro/path", "11"}, - {"/", "10"}, - }; + {"/", "10"} + }; for (String[] test : tests) { diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/QuotedQualityCSVTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/QuotedQualityCSVTest.java index ee39f91ad49..7bbf6547bb2 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/QuotedQualityCSVTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/QuotedQualityCSVTest.java @@ -31,7 +31,7 @@ public class QuotedQualityCSVTest { @Test - public void test7231_5_3_2_example1() + public void test7231Sec532Example1() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue(" audio/*; q=0.2, audio/basic"); @@ -39,7 +39,7 @@ public class QuotedQualityCSVTest } @Test - public void test7231_5_3_2_example2() + public void test7231Sec532Example2() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("text/plain; q=0.5, text/html,"); @@ -48,7 +48,7 @@ public class QuotedQualityCSVTest } @Test - public void test7231_5_3_2_example3() + public void test7231Sec532Example3() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("text/*, text/plain, text/plain;format=flowed, */*"); @@ -58,7 +58,7 @@ public class QuotedQualityCSVTest } @Test - public void test7231_5_3_2_example3_most_specific() + public void test7231532Example3MostSpecific() { QuotedQualityCSV values = new QuotedQualityCSV(QuotedQualityCSV.MOST_SPECIFIC_MIME_ORDERING); values.addValue("text/*, text/plain, text/plain;format=flowed, */*"); @@ -67,7 +67,7 @@ public class QuotedQualityCSVTest } @Test - public void test7231_5_3_2_example4() + public void test7231Sec532Example4() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("text/*;q=0.3, text/html;q=0.7, text/html;level=1,"); @@ -82,7 +82,7 @@ public class QuotedQualityCSVTest } @Test - public void test7231_5_3_4_example1() + public void test7231Sec534Example1() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("compress, gzip"); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java index 248410df7fb..52b1a395e91 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java @@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.fail; public class SyntaxTest { @Test - public void testRequireValidRFC2616Token_Good() + public void testRequireValidRFC2616TokenGood() { String[] tokens = { "name", @@ -50,7 +50,7 @@ public class SyntaxTest } @Test - public void testRequireValidRFC2616Token_Bad() + public void testRequireValidRFC2616TokenBad() { String[] tokens = { "\"name\"", @@ -81,7 +81,7 @@ public class SyntaxTest } @Test - public void testRequireValidRFC6265CookieValue_Good() + public void testRequireValidRFC6265CookieValueGood() { String[] values = { "value", @@ -102,7 +102,7 @@ public class SyntaxTest } @Test - public void testRequireValidRFC6265CookieValue_Bad() + public void testRequireValidRFC6265CookieValueBad() { String[] values = { "va\tlue", diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/matchers/HttpFieldsMatchersTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/matchers/HttpFieldsMatchersTest.java index c8824636934..f70dbfa1d05 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/matchers/HttpFieldsMatchersTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/matchers/HttpFieldsMatchersTest.java @@ -59,7 +59,7 @@ public class HttpFieldsMatchersTest } @Test - public void testContainsHeader_MisMatch() + public void testContainsHeaderMisMatch() { HttpFields fields = new HttpFields(); fields.put("a", "foo"); @@ -75,7 +75,7 @@ public class HttpFieldsMatchersTest } @Test - public void testContainsHeaderValue_MisMatch_NoSuchHeader() + public void testContainsHeaderValueMisMatchNoSuchHeader() { HttpFields fields = new HttpFields(); fields.put("a", "foo"); @@ -91,7 +91,7 @@ public class HttpFieldsMatchersTest } @Test - public void testContainsHeaderValue_MisMatch_NoSuchValue() + public void testContainsHeaderValueMisMatchNoSuchValue() { HttpFields fields = new HttpFields(); fields.put("a", "foo"); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/PathMappingsTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/PathMappingsTest.java index c78e572310a..7fab063c890 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/PathMappingsTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/PathMappingsTest.java @@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class PathMappingsTest { private void assertMatch(PathMappings pathmap, String path, String expectedValue) diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/ServletPathSpecOrderTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/ServletPathSpecOrderTest.java index c6597af6cc3..7787d667ce3 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/ServletPathSpecOrderTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/ServletPathSpecOrderTest.java @@ -56,6 +56,7 @@ public class ServletPathSpecOrderTest data.add(Arguments.of("/downloads/script.gz", "gzipped")); data.add(Arguments.of("/animal/arhive.gz", "animals")); data.add(Arguments.of("/Other/path", "default")); + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck data.add(Arguments.of("/\u20ACuro/path", "money")); data.add(Arguments.of("/", "root")); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecTest.java index d8b66ce3f79..144597165d9 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecTest.java @@ -87,7 +87,7 @@ public class UriTemplatePathSpecTest } @Test - public void testExactPathSpec_TestWebapp() + public void testExactPathSpecTestWebapp() { UriTemplatePathSpec spec = new UriTemplatePathSpec("/deep.thought/"); assertEquals("/deep.thought/", spec.getDeclaration(), "Spec.pathSpec"); diff --git a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/ProxyProtocolTest.java b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/ProxyProtocolTest.java index c33d59c97c9..12e6d8b1e68 100644 --- a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/ProxyProtocolTest.java +++ b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/ProxyProtocolTest.java @@ -87,7 +87,7 @@ public class ProxyProtocolTest } @Test - public void test_PROXY_GET_v1() throws Exception + public void testProxyGetV1() throws Exception { startServer(new AbstractHandler() { @@ -139,7 +139,7 @@ public class ProxyProtocolTest } @Test - public void test_PROXY_GET_v2() throws Exception + public void testProxyGetV2() throws Exception { startServer(new AbstractHandler() { diff --git a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SmallThreadPoolLoadTest.java b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SmallThreadPoolLoadTest.java index d7f58cad407..340e9080543 100644 --- a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SmallThreadPoolLoadTest.java +++ b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SmallThreadPoolLoadTest.java @@ -213,8 +213,8 @@ public class SmallThreadPoolLoadTest extends AbstractTest } case "POST": { - int content_length = request.getContentLength(); - ByteArrayOutputStream2 bout = new ByteArrayOutputStream2(content_length > 0 ? content_length : 16 * 1024); + int contentLength = request.getContentLength(); + ByteArrayOutputStream2 bout = new ByteArrayOutputStream2(contentLength > 0 ? contentLength : 16 * 1024); IO.copy(request.getInputStream(), bout); response.getOutputStream().write(bout.getBuf(), 0, bout.getCount()); break; diff --git a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java index f905d4f377c..5bd553d26e1 100644 --- a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java +++ b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackDecoderTest.java @@ -60,7 +60,7 @@ public class HpackDecoderTest */ @Test - public void testDecodeD_3() throws Exception + public void testDecodeD3() throws Exception { HpackDecoder decoder = new HpackDecoder(4096, 8192); @@ -108,7 +108,7 @@ public class HpackDecoderTest } @Test - public void testDecodeD_4() throws Exception + public void testDecodeD4() throws Exception { HpackDecoder decoder = new HpackDecoder(4096, 8192); @@ -277,7 +277,7 @@ public class HpackDecoderTest /* 8.1.2.1. Pseudo-Header Fields */ @Test - public void test8_1_2_1_PsuedoHeaderFields() throws Exception + public void test8121PseudoHeaderFields() throws Exception { // 1:Sends a HEADERS frame that contains a unknown pseudo-header field MetaDataBuilder mdb = new MetaDataBuilder(4096); @@ -329,7 +329,7 @@ public class HpackDecoderTest } @Test - public void test8_1_2_2_ConnectionSpecificHeaderFields() throws Exception + public void test8122ConnectionSpecificHeaderFields() throws Exception { MetaDataBuilder mdb; @@ -366,7 +366,7 @@ public class HpackDecoderTest } @Test - public void test8_1_2_3_RequestPseudoHeaderFields() throws Exception + public void test8123RequestPseudoHeaderFields() throws Exception { { MetaDataBuilder mdb = new MetaDataBuilder(4096); diff --git a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java index ef9dc649799..acbf1f97193 100644 --- a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java +++ b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/HpackTest.java @@ -145,6 +145,7 @@ public class HpackTest ByteBuffer buffer = BufferUtil.allocate(16 * 1024); HttpFields fields0 = new HttpFields(); + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck fields0.add("Cookie", "[\uD842\uDF9F]"); fields0.add("custom-key", "[\uD842\uDF9F]"); Response original0 = new MetaData.Response(HttpVersion.HTTP_2, 200, fields0); diff --git a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/NBitIntegerTest.java b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/NBitIntegerTest.java index e1588efcc10..5191eb9ccb2 100644 --- a/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/NBitIntegerTest.java +++ b/jetty-http2/http2-hpack/src/test/java/org/eclipse/jetty/http2/hpack/NBitIntegerTest.java @@ -131,7 +131,7 @@ public class NBitIntegerTest } @Test - public void testEncodeExampleD_1_1() + public void testEncodeExampleD11() { ByteBuffer buf = BufferUtil.allocate(16); int p = BufferUtil.flipToFill(buf); @@ -146,7 +146,7 @@ public class NBitIntegerTest } @Test - public void testDecodeExampleD_1_1() + public void testDecodeExampleD11() { ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("77EaFF")); buf.position(2); @@ -155,7 +155,7 @@ public class NBitIntegerTest } @Test - public void testEncodeExampleD_1_2() + public void testEncodeExampleD12() { ByteBuffer buf = BufferUtil.allocate(16); int p = BufferUtil.flipToFill(buf); @@ -170,7 +170,7 @@ public class NBitIntegerTest } @Test - public void testDecodeExampleD_1_2() + public void testDecodeExampleD12() { ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("881f9a0aff")); buf.position(2); @@ -179,7 +179,7 @@ public class NBitIntegerTest } @Test - public void testEncodeExampleD_1_3() + public void testEncodeExampleD13() { ByteBuffer buf = BufferUtil.allocate(16); int p = BufferUtil.flipToFill(buf); @@ -194,7 +194,7 @@ public class NBitIntegerTest } @Test - public void testDecodeExampleD_1_3() + public void testDecodeExampleD13() { ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("882aFf")); buf.position(1); diff --git a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java index 3554e71a5df..9f5b8fa97e0 100644 --- a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java +++ b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java @@ -34,11 +34,11 @@ public class H2SpecServer Server server = new Server(); - HttpConfiguration http_config = new HttpConfiguration(); - http_config.setRequestHeaderSize(16 * 1024); + HttpConfiguration httpConfig = new HttpConfiguration(); + httpConfig.setRequestHeaderSize(16 * 1024); - HttpConnectionFactory http = new HttpConnectionFactory(http_config); - HTTP2CServerConnectionFactory h2c = new HTTP2CServerConnectionFactory(http_config); + HttpConnectionFactory http = new HttpConnectionFactory(httpConfig); + HTTP2CServerConnectionFactory h2c = new HTTP2CServerConnectionFactory(httpConfig); ServerConnector connector = new ServerConnector(server, http, h2c); connector.setPort(port); server.addConnector(connector); diff --git a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java index 980aa3d36d9..b261aadc6f5 100644 --- a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java +++ b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java @@ -82,7 +82,7 @@ public class HTTP2CServerTest extends AbstractServerTest } @Test - public void testHTTP_1_0_Simple() throws Exception + public void testHTTP10Simple() throws Exception { try (Socket client = new Socket("localhost", connector.getLocalPort())) { @@ -97,7 +97,7 @@ public class HTTP2CServerTest extends AbstractServerTest } @Test - public void testHTTP_1_1_Simple() throws Exception + public void testHTTP11Simple() throws Exception { try (Socket client = new Socket("localhost", connector.getLocalPort())) { @@ -115,7 +115,7 @@ public class HTTP2CServerTest extends AbstractServerTest } @Test - public void testHTTP_1_1_Upgrade() throws Exception + public void testHTTP11Upgrade() throws Exception { try (Socket client = new Socket("localhost", connector.getLocalPort())) { @@ -223,7 +223,7 @@ public class HTTP2CServerTest extends AbstractServerTest } @Test - public void testHTTP_2_0_Direct() throws Exception + public void testHTTP20Direct() throws Exception { final CountDownLatch latch = new CountDownLatch(3); @@ -290,7 +290,7 @@ public class HTTP2CServerTest extends AbstractServerTest } @Test - public void testHTTP_2_0_DirectWithoutH2C() throws Exception + public void testHTTP20DirectWithoutH2C() throws Exception { AtomicLong fills = new AtomicLong(); // Remove "h2c", leaving only "http/1.1". diff --git a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java index 9e222c4dd0d..041f54a0e5d 100644 --- a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java +++ b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java @@ -383,15 +383,15 @@ public class HTTP2ServerTest extends AbstractServerTest @Test public void testNonISOHeader() throws Exception { - try (StacklessLogging stackless = new StacklessLogging(HttpChannel.class)) + try (StacklessLogging ignored = new StacklessLogging(HttpChannel.class)) { startServer(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) { // Invalid header name, the connection must be closed. - response.setHeader("Euro_(\u20AC)", "42"); + response.setHeader("Euro_(%E2%82%AC)", "42"); } }); diff --git a/jetty-infinispan/infinispan-embedded-query/src/test/java/org/eclipse/jetty/server/session/infinispan/EmbeddedQueryManagerTest.java b/jetty-infinispan/infinispan-embedded-query/src/test/java/org/eclipse/jetty/server/session/infinispan/EmbeddedQueryManagerTest.java index c96d9868916..31eb0084a16 100644 --- a/jetty-infinispan/infinispan-embedded-query/src/test/java/org/eclipse/jetty/server/session/infinispan/EmbeddedQueryManagerTest.java +++ b/jetty-infinispan/infinispan-embedded-query/src/test/java/org/eclipse/jetty/server/session/infinispan/EmbeddedQueryManagerTest.java @@ -47,13 +47,10 @@ public class EmbeddedQueryManagerTest public static final String DEFAULT_CACHE_NAME = "session_test_cache"; @Test - public void test() throws Exception + public void test() { - - String _name = DEFAULT_CACHE_NAME + System.currentTimeMillis(); - EmbeddedCacheManager _manager; - - _manager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build()); + String name = DEFAULT_CACHE_NAME + System.currentTimeMillis(); + EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build()); //TODO verify that this is being indexed properly, if you change expiry to something that is not a valid field it still passes the tests SearchMapping mapping = new SearchMapping(); @@ -62,7 +59,7 @@ public class EmbeddedQueryManagerTest properties.put(Environment.MODEL_MAPPING, mapping); properties.put("hibernate.search.default.indexBase", MavenTestingUtils.getTargetTestingDir().getAbsolutePath()); - Configuration dcc = _manager.getDefaultCacheConfiguration(); + Configuration dcc = cacheManager.getDefaultCacheConfiguration(); ConfigurationBuilder b = new ConfigurationBuilder(); if (dcc != null) b = b.read(dcc); @@ -70,8 +67,8 @@ public class EmbeddedQueryManagerTest b.indexing().index(Index.ALL).addIndexedEntity(SessionData.class).withProperties(properties); Configuration c = b.build(); - _manager.defineConfiguration(_name, c); - Cache _cache = _manager.getCache(_name); + cacheManager.defineConfiguration(name, c); + Cache cache = cacheManager.getCache(name); //put some sessions into the cache int numSessions = 10; @@ -92,11 +89,11 @@ public class EmbeddedQueryManagerTest expiredSessions.add("sd" + i); //add to cache - _cache.put("sd" + i, sd); + cache.put("sd" + i, sd); } //run the query - QueryManager qm = new EmbeddedQueryManager(_cache); + QueryManager qm = new EmbeddedQueryManager(cache); Set queryResult = qm.queryExpiredSessions(currentTime); // Check that the result is correct diff --git a/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java b/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java index 3b6b5bcbb3c..6fd5521e9f0 100644 --- a/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java +++ b/jetty-infinispan/infinispan-remote-query/src/test/java/org/eclipse/jetty/server/session/infinispan/RemoteQueryManagerTest.java @@ -70,7 +70,7 @@ public class RemoteQueryManagerTest serCtx.registerProtoFiles(fds); serCtx.registerMarshaller(new SessionDataMarshaller()); - RemoteCache _cache = remoteCacheManager.getCache(DEFAULT_CACHE_NAME); + RemoteCache cache = remoteCacheManager.getCache(DEFAULT_CACHE_NAME); ByteArrayOutputStream baos; try (InputStream is = RemoteQueryManagerTest.class.getClassLoader().getResourceAsStream("session.proto")) @@ -106,12 +106,12 @@ public class RemoteQueryManagerTest expiredSessions.add(id); //add to cache - _cache.put(id, sd); - assertNotNull(_cache.get(id)); + cache.put(id, sd); + assertNotNull(cache.get(id)); } //run the query - QueryManager qm = new RemoteQueryManager(_cache); + QueryManager qm = new RemoteQueryManager(cache); Set queryResult = qm.queryExpiredSessions(currentTime); // Check that the result is correct diff --git a/jetty-io/src/test/java/org/eclipse/jetty/io/CyclicTimeoutTest.java b/jetty-io/src/test/java/org/eclipse/jetty/io/CyclicTimeoutTest.java index 218117bdfe6..0d7c202273a 100644 --- a/jetty-io/src/test/java/org/eclipse/jetty/io/CyclicTimeoutTest.java +++ b/jetty-io/src/test/java/org/eclipse/jetty/io/CyclicTimeoutTest.java @@ -146,10 +146,10 @@ public class CyclicTimeoutTest QueuedThreadPool pool = new QueuedThreadPool(200); pool.start(); - long test_until = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(1500); + long testUntil = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(1500); assertTrue(_timeout.schedule(100, TimeUnit.MILLISECONDS)); - while (System.nanoTime() < test_until) + while (System.nanoTime() < testUntil) { CountDownLatch latch = new CountDownLatch(1); pool.execute(() -> diff --git a/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java b/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java index f90671ca526..5454627a1ad 100644 --- a/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java +++ b/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java @@ -744,7 +744,7 @@ public class SocketChannelEndPointTest return; } - EndPoint _endp = getEndPoint(); + EndPoint endp = getEndPoint(); try { _last = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); @@ -757,17 +757,17 @@ public class SocketChannelEndPointTest BufferUtil.compact(_in); if (BufferUtil.isFull(_in)) throw new IllegalStateException("FULL " + BufferUtil.toDetailString(_in)); - int filled = _endp.fill(_in); + int filled = endp.fill(_in); if (filled > 0) progress = true; // If the tests wants to block, then block - while (_blockAt.get() > 0 && _endp.isOpen() && _in.remaining() < _blockAt.get()) + while (_blockAt.get() > 0 && endp.isOpen() && _in.remaining() < _blockAt.get()) { FutureCallback future = _blockingRead = new FutureCallback(); fillInterested(); future.get(); - filled = _endp.fill(_in); + filled = endp.fill(_in); progress |= filled > 0; } @@ -783,18 +783,18 @@ public class SocketChannelEndPointTest for (int i = 0; i < _writeCount.get(); i++) { FutureCallback blockingWrite = new FutureCallback(); - _endp.write(blockingWrite, out.asReadOnlyBuffer()); + endp.write(blockingWrite, out.asReadOnlyBuffer()); blockingWrite.get(); } progress = true; } // are we done? - if (_endp.isInputShutdown()) - _endp.shutdownOutput(); + if (endp.isInputShutdown()) + endp.shutdownOutput(); } - if (_endp.isOpen()) + if (endp.isOpen()) fillInterested(); } catch (ExecutionException e) @@ -803,9 +803,9 @@ public class SocketChannelEndPointTest try { FutureCallback blockingWrite = new FutureCallback(); - _endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in))); + endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in))); blockingWrite.get(); - _endp.shutdownOutput(); + endp.shutdownOutput(); } catch (Exception e2) { diff --git a/jetty-jmh/src/main/java/org/eclipse/jetty/util/StringReplaceBenchmark.java b/jetty-jmh/src/main/java/org/eclipse/jetty/util/StringReplaceBenchmark.java index 42aca5175a6..29d4e6a8a6b 100644 --- a/jetty-jmh/src/main/java/org/eclipse/jetty/util/StringReplaceBenchmark.java +++ b/jetty-jmh/src/main/java/org/eclipse/jetty/util/StringReplaceBenchmark.java @@ -71,37 +71,37 @@ public class StringReplaceBenchmark } @Benchmark - public void testJavaStringReplace_Growth(Blackhole blackhole) + public void testJavaStringReplaceGrowth(Blackhole blackhole) { blackhole.consume(input.replace("'", "FOOBAR")); } @Benchmark - public void testJavaStringReplace_Same(Blackhole blackhole) + public void testJavaStringReplaceSame(Blackhole blackhole) { blackhole.consume(input.replace("'", "X")); } @Benchmark - public void testJavaStringReplace_Reduce(Blackhole blackhole) + public void testJavaStringReplaceReduce(Blackhole blackhole) { blackhole.consume(input.replace("'", "")); } @Benchmark - public void testJettyStringUtilReplace_Growth(Blackhole blackhole) + public void testJettyStringUtilReplaceGrowth(Blackhole blackhole) { blackhole.consume(StringUtil.replace(input, "'", "FOOBAR")); } @Benchmark - public void testJettyStringUtilReplace_Same(Blackhole blackhole) + public void testJettyStringUtilReplaceSame(Blackhole blackhole) { blackhole.consume(StringUtil.replace(input, "'", "X")); } @Benchmark - public void testJettyStringUtilReplace_Reduce(Blackhole blackhole) + public void testJettyStringUtilReplaceReduce(Blackhole blackhole) { blackhole.consume(StringUtil.replace(input, "'", "")); } diff --git a/jetty-maven-plugin/src/test/java/org/eclipse/jetty/maven/plugin/it/TestGetContent.java b/jetty-maven-plugin/src/test/java/org/eclipse/jetty/maven/plugin/it/TestGetContent.java index c1ce688532f..6196c780880 100644 --- a/jetty-maven-plugin/src/test/java/org/eclipse/jetty/maven/plugin/it/TestGetContent.java +++ b/jetty-maven-plugin/src/test/java/org/eclipse/jetty/maven/plugin/it/TestGetContent.java @@ -32,13 +32,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -/** - * - */ public class TestGetContent { @Test - public void get_content_response() + public void getContentResponse() throws Exception { int port = getPort(); diff --git a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/JwtDecoderTest.java b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/JwtDecoderTest.java index f93704dfb06..e0b8fbc5f0d 100644 --- a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/JwtDecoderTest.java +++ b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/JwtDecoderTest.java @@ -46,7 +46,7 @@ public class JwtDecoderTest Arguments.of("XX==", "XX=="), Arguments.of("XXX=", "XXX="), Arguments.of("", "") - ); + ); } public static Stream badPaddingExamples() @@ -101,17 +101,17 @@ public class JwtDecoderTest public void testDecodeMissingPadding() { // Example given in Issue #4128 which requires the re-adding the B64 padding to decode. - String jwt = "eyJraWQiOiIxNTU1OTM0ODQ3IiwieDV0IjoiOWdCOW9zRldSRHRSMkhtNGNmVnJnWTBGcmZRIiwiYWxnIjoiUlMyNTYifQ" - + ".eyJhdF9oYXNoIjoiQTA0NUoxcE5YRk1nYzlXN2wxSk1fUSIsImRlbGVnYXRpb25faWQiOiJjZTBhNjRlNS0xYWY3LTQ2MzEtOGUz" - + "NC1mNDE5N2JkYzVjZTAiLCJhY3IiOiJ1cm46c2U6Y3VyaXR5OmF1dGhlbnRpY2F0aW9uOmh0bWwtZm9ybTpodG1sLXByaW1hcnkiL" - + "CJzX2hhc2giOiIwc1FtRG9YY3FwcnM4NWUzdy0wbHdBIiwiYXpwIjoiNzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYz" - + "c2IiwiYXV0aF90aW1lIjoxNTY5NjU4MDk1LCJleHAiOjE1Njk2NjE5OTUsIm5iZiI6MTU2OTY1ODM5NSwianRpIjoiZjJkNWI2YzE" - + "tNTIxYi00Y2Y5LThlNWEtOTg5NGJhNmE0MzkyIiwiaXNzIjoiaHR0cHM6Ly9ub3JkaWNhcGlzLmN1cml0eS5pby9-IiwiYXVkIjoi" - + "NzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYzc2Iiwic3ViIjoibmlrb3MiLCJpYXQiOjE1Njk2NTgzOTUsInB1cnBvc" - + "2UiOiJpZCJ9.Wd458zNmXggpkDN6vbS3-aiajh4-VbkmcStLYUqahYJUp9p-AUI_RZttWvwh3UDMG9rWww_ya8KFK_SkPfKooEaSN" - + "OjOhw0ox4d-9lgti3J49eRyO20RViXvRHyLVtcjv5IaqvMXgwW60Thubv19OION7DstyArffcxNNSpiqDq6wjd0T2DJ3gSXXlJHLT" - + "Wrry3svqu1j_GCbHc04XYGicxsusKgc3n22dh4I6p4trdo0Gu5Un0bZ8Yov7IzWItqTgm9X5r9gZlAOLcAuK1WTwkzAwZJ24HgvxK" - + "muYfV_4ZCg_VPN2Op8YPuRAQOgUERpeTv1RDFTOG9GKZIMBVR0A"; + String jwt = "eyJraWQiOiIxNTU1OTM0ODQ3IiwieDV0IjoiOWdCOW9zRldSRHRSMkhtNGNmVnJnWTBGcmZRIiwiYWxnIjoiUlMyNTYifQ" + + ".eyJhdF9oYXNoIjoiQTA0NUoxcE5YRk1nYzlXN2wxSk1fUSIsImRlbGVnYXRpb25faWQiOiJjZTBhNjRlNS0xYWY3LTQ2MzEtOGUz" + + "NC1mNDE5N2JkYzVjZTAiLCJhY3IiOiJ1cm46c2U6Y3VyaXR5OmF1dGhlbnRpY2F0aW9uOmh0bWwtZm9ybTpodG1sLXByaW1hcnkiL" + + "CJzX2hhc2giOiIwc1FtRG9YY3FwcnM4NWUzdy0wbHdBIiwiYXpwIjoiNzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYz" + + "c2IiwiYXV0aF90aW1lIjoxNTY5NjU4MDk1LCJleHAiOjE1Njk2NjE5OTUsIm5iZiI6MTU2OTY1ODM5NSwianRpIjoiZjJkNWI2YzE" + + "tNTIxYi00Y2Y5LThlNWEtOTg5NGJhNmE0MzkyIiwiaXNzIjoiaHR0cHM6Ly9ub3JkaWNhcGlzLmN1cml0eS5pby9-IiwiYXVkIjoi" + + "NzZiZTc5Y2ItM2E1Ni00ZTE3LTg3NzYtNDI1Nzc5MjRjYzc2Iiwic3ViIjoibmlrb3MiLCJpYXQiOjE1Njk2NTgzOTUsInB1cnBvc" + + "2UiOiJpZCJ9.Wd458zNmXggpkDN6vbS3-aiajh4-VbkmcStLYUqahYJUp9p-AUI_RZttWvwh3UDMG9rWww_ya8KFK_SkPfKooEaSN" + + "OjOhw0ox4d-9lgti3J49eRyO20RViXvRHyLVtcjv5IaqvMXgwW60Thubv19OION7DstyArffcxNNSpiqDq6wjd0T2DJ3gSXXlJHLT" + + "Wrry3svqu1j_GCbHc04XYGicxsusKgc3n22dh4I6p4trdo0Gu5Un0bZ8Yov7IzWItqTgm9X5r9gZlAOLcAuK1WTwkzAwZJ24HgvxK" + + "muYfV_4ZCg_VPN2Op8YPuRAQOgUERpeTv1RDFTOG9GKZIMBVR0A"; // Decode the ID Token and verify the claims are the correct. Map decodedClaims = JwtDecoder.decode(jwt); diff --git a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java index 2dfa30e1e61..c5b50298e11 100644 --- a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java +++ b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdAuthenticationTest.java @@ -110,7 +110,7 @@ public class OpenIdAuthenticationTest context.setSecurityHandler(securityHandler); server.start(); - String redirectUri = "http://localhost:"+connector.getLocalPort() + "/j_security_check"; + String redirectUri = "http://localhost:" + connector.getLocalPort() + "/j_security_check"; openIdProvider.addRedirectUri(redirectUri); client = new HttpClient(); @@ -127,7 +127,7 @@ public class OpenIdAuthenticationTest @Test public void testLoginLogout() throws Exception { - String appUriString = "http://localhost:"+connector.getLocalPort(); + String appUriString = "http://localhost:" + connector.getLocalPort(); // Initially not authenticated ContentResponse response = client.GET(appUriString + "/"); diff --git a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdProvider.java b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdProvider.java index 487d35c6b93..da84a291ece 100644 --- a/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdProvider.java +++ b/jetty-openid/src/test/java/org/eclipse/jetty/security/openid/OpenIdProvider.java @@ -142,8 +142,8 @@ public class OpenIdProvider extends ContainerLifeCycle final Request baseRequest = Request.getBaseRequest(req); final Response baseResponse = baseRequest.getResponse(); redirectUri += "?code=" + authCode + "&state=" + state; - int redirectCode = (baseRequest.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() ? - HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER); + int redirectCode = (baseRequest.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() + ? HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER); baseResponse.sendRedirect(redirectCode, resp.encodeRedirectURL(redirectUri)); } } diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestOSGiUtil.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestOSGiUtil.java index e71c1e2ce55..025069dac0f 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestOSGiUtil.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestOSGiUtil.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -191,10 +190,10 @@ public class TestOSGiUtil protected static Bundle getBundle(BundleContext bundleContext, String symbolicName) { - Map _bundles = new HashMap<>(); + Map bundles = new HashMap<>(); for (Bundle b : bundleContext.getBundles()) { - Bundle prevBundle = _bundles.put(b.getSymbolicName(), b); + Bundle prevBundle = bundles.put(b.getSymbolicName(), b); String err = prevBundle != null ? "2 versions of the bundle " + b.getSymbolicName() + " " + b.getHeaders().get("Bundle-Version") + @@ -202,7 +201,7 @@ public class TestOSGiUtil prevBundle.getHeaders().get("Bundle-Version") : ""; assertNull(err, prevBundle); } - return _bundles.get(symbolicName); + return bundles.get(symbolicName); } protected static void assertActiveBundle(BundleContext bundleContext, String symbolicName) throws Exception diff --git a/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/TestConfiguration.java b/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/TestConfiguration.java index 3f8815fd14f..e4a09a62f4d 100644 --- a/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/TestConfiguration.java +++ b/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/TestConfiguration.java @@ -38,7 +38,7 @@ public class TestConfiguration @Test public void testIt() throws Exception { - ClassLoader old_loader = Thread.currentThread().getContextClassLoader(); + ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); try { @@ -130,7 +130,7 @@ public class TestConfiguration } finally { - Thread.currentThread().setContextClassLoader(old_loader); + Thread.currentThread().setContextClassLoader(oldLoader); } } } diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java index 4832bae49dd..8d6af8c29b3 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java @@ -99,27 +99,27 @@ public class ConstraintTest _config = _connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration(); _server.setConnectors(new Connector[]{_connector}); - ContextHandler _context = new ContextHandler(); - SessionHandler _session = new SessionHandler(); + ContextHandler contextHandler = new ContextHandler(); + SessionHandler sessionHandler = new SessionHandler(); - TestLoginService _loginService = new TestLoginService(TEST_REALM); + TestLoginService loginService = new TestLoginService(TEST_REALM); - _loginService.putUser("user0", new Password("password"), new String[]{}); - _loginService.putUser("user", new Password("password"), new String[]{"user"}); - _loginService.putUser("user2", new Password("password"), new String[]{"user"}); - _loginService.putUser("admin", new Password("password"), new String[]{"user", "administrator"}); - _loginService.putUser("user3", new Password("password"), new String[]{"foo"}); + loginService.putUser("user0", new Password("password"), new String[]{}); + loginService.putUser("user", new Password("password"), new String[]{"user"}); + loginService.putUser("user2", new Password("password"), new String[]{"user"}); + loginService.putUser("admin", new Password("password"), new String[]{"user", "administrator"}); + loginService.putUser("user3", new Password("password"), new String[]{"foo"}); - _context.setContextPath("/ctx"); - _server.setHandler(_context); - _context.setHandler(_session); + contextHandler.setContextPath("/ctx"); + _server.setHandler(contextHandler); + contextHandler.setHandler(sessionHandler); - _server.addBean(_loginService); + _server.addBean(loginService); _security = new ConstraintSecurityHandler(); - _session.setHandler(_security); - RequestHandler _handler = new RequestHandler(); - _security.setHandler(_handler); + sessionHandler.setHandler(_security); + RequestHandler requestHandler = new RequestHandler(); + _security.setHandler(requestHandler); _security.setConstraintMappings(getConstraintMappings(), getKnownRoles()); } @@ -242,7 +242,7 @@ public class ConstraintTest * @throws Exception if test fails */ @Test - public void testSecurityElementExample13_1() throws Exception + public void testSecurityElementExample131() throws Exception { ServletSecurityElement element = new ServletSecurityElement(); List mappings = ConstraintSecurityHandler.createConstraintsWithMappingsForPath("foo", "/foo/*", element); @@ -256,7 +256,7 @@ public class ConstraintTest * @throws Exception if test fails */ @Test - public void testSecurityElementExample13_2() throws Exception + public void testSecurityElementExample132() throws Exception { HttpConstraintElement httpConstraintElement = new HttpConstraintElement(TransportGuarantee.CONFIDENTIAL); ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement); @@ -274,7 +274,7 @@ public class ConstraintTest * @ServletSecurity(@HttpConstraint(EmptyRoleSemantic.DENY)) */ @Test - public void testSecurityElementExample13_3() throws Exception + public void testSecurityElementExample133() throws Exception { HttpConstraintElement httpConstraintElement = new HttpConstraintElement(EmptyRoleSemantic.DENY); ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement); @@ -292,7 +292,7 @@ public class ConstraintTest * @ServletSecurity(@HttpConstraint(rolesAllowed = "R1")) */ @Test - public void testSecurityElementExample13_4() throws Exception + public void testSecurityElementExample134() throws Exception { HttpConstraintElement httpConstraintElement = new HttpConstraintElement(TransportGuarantee.NONE, "R1"); ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement); @@ -317,7 +317,7 @@ public class ConstraintTest * transportGuarantee = TransportGuarantee.CONFIDENTIAL)}) */ @Test - public void testSecurityElementExample13_5() throws Exception + public void testSecurityElementExample135() throws Exception { List methodElements = new ArrayList(); methodElements.add(new HttpMethodConstraintElement("GET", new HttpConstraintElement(TransportGuarantee.NONE, "R1"))); @@ -343,7 +343,7 @@ public class ConstraintTest * @ServletSecurity(value = @HttpConstraint(rolesAllowed = "R1"), httpMethodConstraints = @HttpMethodConstraint("GET")) */ @Test - public void testSecurityElementExample13_6() throws Exception + public void testSecurityElementExample136() throws Exception { List methodElements = new ArrayList(); methodElements.add(new HttpMethodConstraintElement("GET")); @@ -370,7 +370,7 @@ public class ConstraintTest * emptyRoleSemantic = EmptyRoleSemantic.DENY)) */ @Test - public void testSecurityElementExample13_7() throws Exception + public void testSecurityElementExample137() throws Exception { List methodElements = new ArrayList(); methodElements.add(new HttpMethodConstraintElement("TRACE", new HttpConstraintElement(EmptyRoleSemantic.DENY))); diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java index 97cfa2a1a6c..edc7395b9c5 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java @@ -79,12 +79,12 @@ public class DataConstraintsTest _connectorS = new LocalConnector(_server, https); _server.setConnectors(new Connector[]{_connector, _connectorS}); - ContextHandler _context = new ContextHandler(); + ContextHandler contextHandler = new ContextHandler(); _session = new SessionHandler(); - _context.setContextPath("/ctx"); - _server.setHandler(_context); - _context.setHandler(_session); + contextHandler.setContextPath("/ctx"); + _server.setHandler(contextHandler); + contextHandler.setHandler(_session); _security = new ConstraintSecurityHandler(); _session.setHandler(_security); diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java index 424c3d0be6f..125c8f492e8 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/SpecExampleConstraintTest.java @@ -67,21 +67,21 @@ public class SpecExampleConstraintTest _connector = new LocalConnector(_server); _server.setConnectors(new Connector[]{_connector}); - ContextHandler _context = new ContextHandler(); + ContextHandler context = new ContextHandler(); _session = new SessionHandler(); - TestLoginService _loginService = new TestLoginService(TEST_REALM); + TestLoginService loginService = new TestLoginService(TEST_REALM); - _loginService.putUser("fred", new Password("password"), IdentityService.NO_ROLES); - _loginService.putUser("harry", new Password("password"), new String[]{"HOMEOWNER"}); - _loginService.putUser("chris", new Password("password"), new String[]{"CONTRACTOR"}); - _loginService.putUser("steven", new Password("password"), new String[]{"SALESCLERK"}); + loginService.putUser("fred", new Password("password"), IdentityService.NO_ROLES); + loginService.putUser("harry", new Password("password"), new String[]{"HOMEOWNER"}); + loginService.putUser("chris", new Password("password"), new String[]{"CONTRACTOR"}); + loginService.putUser("steven", new Password("password"), new String[]{"SALESCLERK"}); - _context.setContextPath("/ctx"); - _server.setHandler(_context); - _context.setHandler(_session); + context.setContextPath("/ctx"); + _server.setHandler(context); + context.setHandler(_session); - _server.addBean(_loginService); + _server.addBean(loginService); } @BeforeEach @@ -89,8 +89,8 @@ public class SpecExampleConstraintTest { _security = new ConstraintSecurityHandler(); _session.setHandler(_security); - RequestHandler _handler = new RequestHandler(); - _security.setHandler(_handler); + RequestHandler handler = new RequestHandler(); + _security.setHandler(handler); /* diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticatorTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticatorTest.java index 6fbedfac041..4a22a970511 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticatorTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/authentication/SpnegoAuthenticatorTest.java @@ -118,10 +118,10 @@ public class SpnegoAuthenticatorTest }; Request req = channel.getRequest(); Response res = channel.getResponse(); - HttpFields http_fields = new HttpFields(); + HttpFields httpFields = new HttpFields(); // Create a bogus Authorization header. We don't care about the actual credentials. - http_fields.add(HttpHeader.AUTHORIZATION, "Basic asdf"); - MetaData.Request metadata = new MetaData.Request(http_fields); + httpFields.add(HttpHeader.AUTHORIZATION, "Basic asdf"); + MetaData.Request metadata = new MetaData.Request(httpFields); metadata.setURI(new HttpURI("http://localhost")); req.setMetaData(metadata); @@ -168,7 +168,7 @@ public class SpnegoAuthenticatorTest { public MockConnector() { - super(new Server() , null, null, null, 0); + super(new Server(), null, null, null, 0); } @Override diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/AbstractHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/AbstractHandler.java index 5d74244f3e9..fa6f2ef73cb 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/AbstractHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/AbstractHandler.java @@ -55,9 +55,6 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand private Server _server; - /** - * - */ public AbstractHandler() { } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java index 9ebce9a267c..3a70904661f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java @@ -709,23 +709,24 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore statement.setLong(10, data.getExpiry()); statement.setLong(11, data.getMaxInactiveMs()); - if(!data.getAllAttributes().isEmpty()) + if (!data.getAllAttributes().isEmpty()) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos)) { - SessionData.serializeAttributes( data, oos ); + SessionData.serializeAttributes(data, oos); byte[] bytes = baos.toByteArray(); - ByteArrayInputStream bais = new ByteArrayInputStream( bytes ); - statement.setBinaryStream( 12, bais, bytes.length );//attribute map as blob + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + statement.setBinaryStream(12, bais, bytes.length);//attribute map as blob } } else { - statement.setBinaryStream( 12, EMPTY, 0); + statement.setBinaryStream(12, EMPTY, 0); } statement.executeUpdate(); - if ( LOG.isDebugEnabled() ) LOG.debug( "Inserted session " + data ); + if (LOG.isDebugEnabled()) + LOG.debug("Inserted session " + data); } } } @@ -745,7 +746,7 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore statement.setLong(5, data.getExpiry()); statement.setLong(6, data.getMaxInactiveMs()); - if(!data.getAllAttributes().isEmpty()) + if (!data.getAllAttributes().isEmpty()) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos)) @@ -754,17 +755,18 @@ public class JDBCSessionDataStore extends AbstractSessionDataStore byte[] bytes = baos.toByteArray(); try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) { - statement.setBinaryStream( 7, bais, bytes.length );//attribute map as blob + statement.setBinaryStream(7, bais, bytes.length);//attribute map as blob } } } else { - statement.setBinaryStream( 7, EMPTY, 0); + statement.setBinaryStream(7, EMPTY, 0); } statement.executeUpdate(); - if ( LOG.isDebugEnabled() ) LOG.debug( "Updated session " + data ); + if (LOG.isDebugEnabled()) + LOG.debug("Updated session " + data); } } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncCompletionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncCompletionTest.java index c858017d384..f26f5b0b8ee 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncCompletionTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncCompletionTest.java @@ -172,9 +172,9 @@ public class AsyncCompletionTest extends HttpServerTestFixture } enum WriteStyle - {ARRAY, BUFFER, BYTE, BYTE_THEN_ARRAY, PRINT} - - ; + { + ARRAY, BUFFER, BYTE, BYTE_THEN_ARRAY, PRINT + } public static Stream asyncIOWriteTests() { @@ -444,9 +444,6 @@ public class AsyncCompletionTest extends HttpServerTestFixture { throw new RuntimeException(e); } - finally - { - } } @Override @@ -703,7 +700,10 @@ public class AsyncCompletionTest extends HttpServerTestFixture } enum ContentStyle - {BUFFER, STREAM} // TODO more types needed here + { + BUFFER, STREAM + // TODO more types needed here + } private static class SendContentHandler extends AbstractHandler { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java index d57974e3ec2..caab5ed3be6 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java @@ -188,33 +188,33 @@ public class AsyncStressTest @Override public void handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { - int read_before = 0; - long sleep_for = -1; - long suspend_for = -1; - long resume_after = -1; - long complete_after = -1; + int readBefore = 0; + long sleepFor = -1; + long suspendFor = -1; + long resumeAfter = -1; + long completeAfter = -1; final String uri = baseRequest.getHttpURI().toString(); if (request.getParameter("read") != null) - read_before = Integer.parseInt(request.getParameter("read")); + readBefore = Integer.parseInt(request.getParameter("read")); if (request.getParameter("sleep") != null) - sleep_for = Integer.parseInt(request.getParameter("sleep")); + sleepFor = Integer.parseInt(request.getParameter("sleep")); if (request.getParameter("suspend") != null) - suspend_for = Integer.parseInt(request.getParameter("suspend")); + suspendFor = Integer.parseInt(request.getParameter("suspend")); if (request.getParameter("resume") != null) - resume_after = Integer.parseInt(request.getParameter("resume")); + resumeAfter = Integer.parseInt(request.getParameter("resume")); if (request.getParameter("complete") != null) - complete_after = Integer.parseInt(request.getParameter("complete")); + completeAfter = Integer.parseInt(request.getParameter("complete")); if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType())) { - if (read_before > 0) + if (readBefore > 0) { - byte[] buf = new byte[read_before]; + byte[] buf = new byte[readBefore]; request.getInputStream().read(buf); } - else if (read_before < 0) + else if (readBefore < 0) { InputStream in = request.getInputStream(); int b = in.read(); @@ -224,13 +224,13 @@ public class AsyncStressTest } } - if (suspend_for >= 0) + if (suspendFor >= 0) { final AsyncContext asyncContext = baseRequest.startAsync(); asyncContext.addListener(__asyncListener); - if (suspend_for > 0) - asyncContext.setTimeout(suspend_for); - if (complete_after > 0) + if (suspendFor > 0) + asyncContext.setTimeout(suspendFor); + if (completeAfter > 0) { TimerTask complete = new TimerTask() { @@ -259,17 +259,17 @@ public class AsyncStressTest }; synchronized (_timer) { - _timer.schedule(complete, complete_after); + _timer.schedule(complete, completeAfter); } } - else if (complete_after == 0) + else if (completeAfter == 0) { response.setStatus(200); response.getOutputStream().println("COMPLETED " + request.getHeader("result")); baseRequest.setHandled(true); asyncContext.complete(); } - else if (resume_after > 0) + else if (resumeAfter > 0) { TimerTask resume = new TimerTask() { @@ -281,19 +281,19 @@ public class AsyncStressTest }; synchronized (_timer) { - _timer.schedule(resume, resume_after); + _timer.schedule(resume, resumeAfter); } } - else if (resume_after == 0) + else if (resumeAfter == 0) { asyncContext.dispatch(); } } - else if (sleep_for >= 0) + else if (sleepFor >= 0) { try { - Thread.sleep(sleep_for); + Thread.sleep(sleepFor); } catch (InterruptedException e) { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutter_LenientTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterLenientTest.java similarity index 99% rename from jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutter_LenientTest.java rename to jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterLenientTest.java index ae77728325f..85275042ddf 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutter_LenientTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterLenientTest.java @@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.is; * Tests of poor various name=value scenarios and expectations of results * due to our efforts at being lenient with what we receive. */ -public class CookieCutter_LenientTest +public class CookieCutterLenientTest { public static Stream data() { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java index 246242e5670..05a7ba91cc0 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java @@ -55,7 +55,7 @@ public class CookieCutterTest * Example from RFC2109 and RFC2965 */ @Test - public void testRFC_Single() + public void testRFCSingle() { String rawCookie = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\""; @@ -72,7 +72,7 @@ public class CookieCutterTest *

*/ @Test - public void testRFC_Single_Lenient_NoSpaces() + public void testRFCSingleLenientNoSpaces() { String rawCookie = "$Version=\"1\";Customer=\"WILE_E_COYOTE\";$Path=\"/acme\""; @@ -86,7 +86,7 @@ public class CookieCutterTest * Example from RFC2109 and RFC2965 */ @Test - public void testRFC_Double() + public void testRFCDouble() { String rawCookie = "$Version=\"1\"; " + "Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " + @@ -103,7 +103,7 @@ public class CookieCutterTest * Example from RFC2109 and RFC2965 */ @Test - public void testRFC_Triple() + public void testRFCTriple() { String rawCookie = "$Version=\"1\"; " + "Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " + @@ -122,7 +122,7 @@ public class CookieCutterTest * Example from RFC2109 and RFC2965 */ @Test - public void testRFC_PathExample() + public void testRFCPathExample() { String rawCookie = "$Version=\"1\"; " + "Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " + @@ -139,7 +139,7 @@ public class CookieCutterTest * Example from RFC2109 */ @Test - public void testRFC2109_CookieSpoofingExample() + public void testRFC2109CookieSpoofingExample() { String rawCookie = "$Version=\"1\"; " + "session_id=\"1234\"; " + @@ -156,7 +156,7 @@ public class CookieCutterTest * Example from RFC2965 */ @Test - public void testRFC2965_CookieSpoofingExample() + public void testRFC2965CookieSpoofingExample() { String rawCookie = "$Version=\"1\"; session_id=\"1234\", " + "$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\""; @@ -177,7 +177,7 @@ public class CookieCutterTest * Example from RFC6265 */ @Test - public void testRFC6265_SidExample() + public void testRFC6265SidExample() { String rawCookie = "SID=31d4d96e407aad42"; @@ -191,7 +191,7 @@ public class CookieCutterTest * Example from RFC6265 */ @Test - public void testRFC6265_SidLangExample() + public void testRFC6265SidLangExample() { String rawCookie = "SID=31d4d96e407aad42; lang=en-US"; @@ -209,7 +209,7 @@ public class CookieCutterTest *

*/ @Test - public void testRFC6265_SidLangExample_Lenient() + public void testRFC6265SidLangExampleLenient() { String rawCookie = "SID=31d4d96e407aad42;lang=en-US"; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/DelayedServerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/DelayedServerTest.java index fcd0ebacbe9..c27cc54cc8f 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/DelayedServerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/DelayedServerTest.java @@ -74,14 +74,15 @@ public class DelayedServerTest extends HttpServerTestBase @Override public void succeeded() { - pool.execute(()-> + pool.execute(() -> { try { Thread.sleep(10); } - catch (InterruptedException e) + catch (InterruptedException ignored) { + // ignored } finally { @@ -93,14 +94,15 @@ public class DelayedServerTest extends HttpServerTestBase @Override public void failed(Throwable x) { - pool.execute(()-> + pool.execute(() -> { try { Thread.sleep(20); } - catch (InterruptedException e) + catch (InterruptedException ignored) { + // ignored } finally { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java b/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java index 2333591e3ca..0b023024228 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java @@ -154,17 +154,17 @@ public class DumpHandler extends AbstractHandler } } - String cookie_name = request.getParameter("CookieName"); - if (cookie_name != null && cookie_name.trim().length() > 0) + String cookieName = request.getParameter("CookieName"); + if (cookieName != null && cookieName.trim().length() > 0) { - String cookie_action = request.getParameter("Button"); + String cookieAction = request.getParameter("Button"); try { String val = request.getParameter("CookieVal"); val = val.replaceAll("[ \n\r=<>]", "?"); Cookie cookie = - new Cookie(cookie_name.trim(), val); - if ("Clear Cookie".equals(cookie_action)) + new Cookie(cookieName.trim(), val); + if ("Clear Cookie".equals(cookieAction)) cookie.setMaxAge(0); response.addCookie(cookie); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ErrorHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ErrorHandlerTest.java index f31dadbda29..3ab71fdcda8 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ErrorHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ErrorHandlerTest.java @@ -120,7 +120,9 @@ public class ErrorHandlerTest // produce an exception with a UTF-8 cause message if (target.startsWith("/utf8message/")) { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharacters String message = "Euro is € and \u20AC and %E2%82%AC"; + // @checkstyle-enable-check : AvoidEscapedUnicodeCharacters throw new ServletException(new RuntimeException(message)); } } @@ -456,8 +458,10 @@ public class ErrorHandlerTest if (path.startsWith("/utf8")) { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharacters // we are Not expecting UTF-8 output, look for mangled ISO-8859-1 version assertThat("content", content, containsString("Euro is &euro; and \u20AC and %E2%82%AC")); + // @checkstyle-enabled-check : AvoidEscapedUnicodeCharacters } } @@ -556,8 +560,10 @@ public class ErrorHandlerTest if (path.startsWith("/utf8")) { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharacters // we are expecting UTF-8 output, look for it. assertThat("content", content, containsString("Euro is &euro; and \u20AC and %E2%82%AC")); + // @checkstyle-enable-check : AvoidEscapedUnicodeCharacters } } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/GracefulStopTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/GracefulStopTest.java index 7803af2e545..6cd9a8b7548 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/GracefulStopTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/GracefulStopTest.java @@ -168,9 +168,9 @@ public class GracefulStopTest client.close(); } - /** * Test completed writes during shutdown do not close output + * * @throws Exception on test failure */ @Test @@ -205,7 +205,7 @@ public class GracefulStopTest stopper.start(); final int port = connector.getLocalPort(); - try(Socket client = new Socket("127.0.0.1", port)) + try (Socket client = new Socket("127.0.0.1", port)) { client.getOutputStream().write(( "GET / HTTP/1.1\r\n" + @@ -215,7 +215,9 @@ public class GracefulStopTest client.getOutputStream().flush(); while (!connector.isShutdown()) + { Thread.sleep(10); + } handler.latchB.countDown(); @@ -838,7 +840,7 @@ public class GracefulStopTest int c = 0; try { - int content_length = request.getContentLength(); + int contentLength = request.getContentLength(); InputStream in = request.getInputStream(); while (true) @@ -850,7 +852,7 @@ public class GracefulStopTest baseRequest.setHandled(true); response.setStatus(200); - response.getWriter().printf("read %d/%d%n", c, content_length); + response.getWriter().printf("read %d/%d%n", c, contentLength); } catch (Throwable th) { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java index 8b5b0e615cc..f4fc978533e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java @@ -890,6 +890,7 @@ public class HttpOutputTest response.setCharacterEncoding("UTF8"); HttpOutput out = (HttpOutput)response.getOutputStream(); + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck exp.print("\u20AC\u0939\uD55C"); out.print("\u20AC\u0939\uD55C"); exp.print("zero"); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java index c878c3e9a4b..8e939831236 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java @@ -274,6 +274,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture assertThat(response, Matchers.containsString("HTTP/1.1 400 ")); } } + @Test public void testExceptionThrownInHandlerLoop() throws Exception { @@ -512,7 +513,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture "\r\n" + "ABCDE\r\n" + "\r\n" - //@checkstyle-enable-check : IllegalTokenText + //@checkstyle-enable-check : IllegalTokenText ).getBytes()); os.flush(); @@ -1199,7 +1200,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture "Connection: close\r\n" + "\r\n" + "abcdefghi\n" - //@checkstyle-enable-check : IllegalTokenText + //@checkstyle-enable-check : IllegalTokenText ).getBytes(StandardCharsets.ISO_8859_1)); String in = IO.toString(is); @@ -1864,7 +1865,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture public SendAsyncContentHandler(int size) { content = BufferUtil.allocate(size); - Arrays.fill(content.array(),0,size,(byte)'X'); + Arrays.fill(content.array(), 0, size, (byte)'X'); content.position(0); content.limit(size); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestFixture.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestFixture.java index 4f39491c7fd..a6c63c59a74 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestFixture.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestFixture.java @@ -40,6 +40,8 @@ import org.junit.jupiter.api.BeforeEach; public class HttpServerTestFixture { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck + // Useful constants protected static final long PAUSE = 10L; protected static final int LOOPS = 50; @@ -186,7 +188,6 @@ public class HttpServerTestFixture } } - protected static class SendErrorHandler extends AbstractHandler { private final int code; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java index 09ca23b05be..b62d6a507a1 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java @@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class HttpWriterTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck private HttpOutput _httpOut; private ByteBuffer _bytes; @@ -67,33 +68,33 @@ public class HttpWriterTest @Test public void testSimpleUTF8() throws Exception { - HttpWriter _writer = new Utf8HttpWriter(_httpOut); - _writer.write("Now is the time"); + HttpWriter writer = new Utf8HttpWriter(_httpOut); + writer.write("Now is the time"); assertArrayEquals("Now is the time".getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes)); } @Test public void testUTF8() throws Exception { - HttpWriter _writer = new Utf8HttpWriter(_httpOut); - _writer.write("How now \uFF22rown cow"); + HttpWriter writer = new Utf8HttpWriter(_httpOut); + writer.write("How now \uFF22rown cow"); assertArrayEquals("How now \uFF22rown cow".getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes)); } @Test public void testUTF16() throws Exception { - HttpWriter _writer = new EncodingHttpWriter(_httpOut, StringUtil.__UTF16); - _writer.write("How now \uFF22rown cow"); + HttpWriter writer = new EncodingHttpWriter(_httpOut, StringUtil.__UTF16); + writer.write("How now \uFF22rown cow"); assertArrayEquals("How now \uFF22rown cow".getBytes(StandardCharsets.UTF_16), BufferUtil.toArray(_bytes)); } @Test public void testNotCESU8() throws Exception { - HttpWriter _writer = new Utf8HttpWriter(_httpOut); + HttpWriter writer = new Utf8HttpWriter(_httpOut); String data = "xxx\uD801\uDC00xxx"; - _writer.write(data); + writer.write(data); assertEquals("787878F0909080787878", TypeUtil.toHexString(BufferUtil.toArray(_bytes))); assertArrayEquals(data.getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes)); assertEquals(3 + 4 + 3, _bytes.remaining()); @@ -106,7 +107,7 @@ public class HttpWriterTest @Test public void testMultiByteOverflowUTF8() throws Exception { - HttpWriter _writer = new Utf8HttpWriter(_httpOut); + HttpWriter writer = new Utf8HttpWriter(_httpOut); final String singleByteStr = "a"; final String multiByteDuplicateStr = "\uFF22"; int remainSize = 1; @@ -127,7 +128,7 @@ public class HttpWriterTest int length = HttpWriter.MAX_OUTPUT_CHARS - multiByteStrByteLength + remainSize + 1; sb.toString().getChars(0, length, buf, 0); - _writer.write(buf, 0, length); + writer.write(buf, 0, length); assertEquals(sb.toString(), new String(BufferUtil.toArray(_bytes), StandardCharsets.UTF_8)); } @@ -135,20 +136,20 @@ public class HttpWriterTest @Test public void testISO8859() throws Exception { - HttpWriter _writer = new Iso88591HttpWriter(_httpOut); - _writer.write("How now \uFF22rown cow"); + HttpWriter writer = new Iso88591HttpWriter(_httpOut); + writer.write("How now \uFF22rown cow"); assertEquals(new String(BufferUtil.toArray(_bytes), StandardCharsets.ISO_8859_1), "How now ?rown cow"); } @Test public void testUTF16x2() throws Exception { - HttpWriter _writer = new Utf8HttpWriter(_httpOut); + HttpWriter writer = new Utf8HttpWriter(_httpOut); String source = "\uD842\uDF9F"; byte[] bytes = source.getBytes(StandardCharsets.UTF_8); - _writer.write(source.toCharArray(), 0, source.toCharArray().length); + writer.write(source.toCharArray(), 0, source.toCharArray().length); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8); @@ -166,7 +167,7 @@ public class HttpWriterTest @Test public void testMultiByteOverflowUTF16x2() throws Exception { - HttpWriter _writer = new Utf8HttpWriter(_httpOut); + HttpWriter writer = new Utf8HttpWriter(_httpOut); final String singleByteStr = "a"; int remainSize = 1; @@ -186,7 +187,7 @@ public class HttpWriterTest String source = sb.toString(); byte[] bytes = source.getBytes(StandardCharsets.UTF_8); - _writer.write(source.toCharArray(), 0, source.toCharArray().length); + writer.write(source.toCharArray(), 0, source.toCharArray().length); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8); @@ -202,9 +203,9 @@ public class HttpWriterTest } @Test - public void testMultiByteOverflowUTF16x2_2() throws Exception + public void testMultiByteOverflowUTF16X22() throws Exception { - HttpWriter _writer = new Utf8HttpWriter(_httpOut); + HttpWriter writer = new Utf8HttpWriter(_httpOut); final String singleByteStr = "a"; int remainSize = 1; @@ -224,7 +225,7 @@ public class HttpWriterTest String source = sb.toString(); byte[] bytes = source.getBytes(StandardCharsets.UTF_8); - _writer.write(source.toCharArray(), 0, source.toCharArray().length); + writer.write(source.toCharArray(), 0, source.toCharArray().length); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/InclusiveByteRangeTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/InclusiveByteRangeTest.java index dee6f295298..00fc727b501 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/InclusiveByteRangeTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/InclusiveByteRangeTest.java @@ -252,7 +252,7 @@ public class InclusiveByteRangeTest } @Test - public void testRange_OpenEnded() + public void testRangeOpenEnded() { assertSimpleRange(50, 499, "bytes=50-", 500); } @@ -281,75 +281,75 @@ public class InclusiveByteRangeTest @Test @Disabled - public void testBadRange_SetPartiallyBad() + public void testBadRangeSetPartiallyBad() { assertBadRangeList(500, "bytes=1-50,1-b,a-50"); } @Test - public void testBadRange_NoNumbers() + public void testBadRangeNoNumbers() { assertBadRangeList(500, "bytes=a-b"); } @Test - public void testBadRange_Empty() + public void testBadRangeEmpty() { assertBadRangeList(500, "bytes="); } @Test @Disabled - public void testBadRange_ZeroPrefixed() + public void testBadRangeZeroPrefixed() { assertBadRangeList(500, "bytes=01-050"); } @Test - public void testBadRange_Hex() + public void testBadRangeHex() { assertBadRangeList(500, "bytes=0F-FF"); } @Test @Disabled - public void testBadRange_TabWhitespace() + public void testBadRangeTabWhitespace() { assertBadRangeList(500, "bytes=\t1\t-\t50"); } @Test - public void testBadRange_TabDelim() + public void testBadRangeTabDelim() { assertBadRangeList(500, "bytes=1-50\t90-101\t200-250"); } @Test - public void testBadRange_SemiColonDelim() + public void testBadRangeSemiColonDelim() { assertBadRangeList(500, "bytes=1-50;90-101;200-250"); } @Test - public void testBadRange_NegativeSize() + public void testBadRangeNegativeSize() { assertBadRangeList(500, "bytes=50-1"); } @Test - public void testBadRange_DoubleDash() + public void testBadRangeDoubleDash() { assertBadRangeList(500, "bytes=1--20"); } @Test - public void testBadRange_TrippleDash() + public void testBadRangeTrippleDash() { assertBadRangeList(500, "bytes=1---"); } @Test - public void testBadRange_ZeroedNegativeSize() + public void testBadRangeZeroedNegativeSize() { assertBadRangeList(500, "bytes=050-001"); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/LocalConnectorTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/LocalConnectorTest.java index 79813a8020a..7c855cd4e7f 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/LocalConnectorTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/LocalConnectorTest.java @@ -98,7 +98,7 @@ public class LocalConnectorTest } @Test - public void testOneResponse_10() throws Exception + public void testOneResponse10() throws Exception { String response = _connector.getResponse("GET /R1 HTTP/1.0\r\n\r\n"); assertThat(response, containsString("HTTP/1.1 200 OK")); @@ -106,7 +106,7 @@ public class LocalConnectorTest } @Test - public void testOneResponse_10_keep_alive() throws Exception + public void testOneResponse10KeepAlive() throws Exception { String response = _connector.getResponse( "GET /R1 HTTP/1.0\r\n" + @@ -117,7 +117,7 @@ public class LocalConnectorTest } @Test - public void testOneResponse_10_keep_alive_empty() throws Exception + public void testOneResponse10KeepAliveEmpty() throws Exception { String response = _connector.getResponse( "GET /R1?empty=true HTTP/1.0\r\n" + @@ -128,7 +128,7 @@ public class LocalConnectorTest } @Test - public void testOneResponse_11() throws Exception + public void testOneResponse11() throws Exception { String response = _connector.getResponse( "GET /R1 HTTP/1.1\r\n" + @@ -139,7 +139,7 @@ public class LocalConnectorTest } @Test - public void testOneResponse_11_close() throws Exception + public void testOneResponse11close() throws Exception { String response = _connector.getResponse( "GET /R1 HTTP/1.1\r\n" + @@ -151,7 +151,7 @@ public class LocalConnectorTest } @Test - public void testOneResponse_11_empty() throws Exception + public void testOneResponse11empty() throws Exception { String response = _connector.getResponse( "GET /R1?empty=true HTTP/1.1\r\n" + @@ -163,7 +163,7 @@ public class LocalConnectorTest } @Test - public void testOneResponse_11_chunked() throws Exception + public void testOneResponse11chunked() throws Exception { String response = _connector.getResponse( "GET /R1?flush=true HTTP/1.1\r\n" + @@ -175,7 +175,7 @@ public class LocalConnectorTest } @Test - public void testThreeResponsePipeline_11() throws Exception + public void testThreeResponsePipeline11() throws Exception { LocalEndPoint endp = _connector.connect(); endp.addInput( @@ -201,7 +201,7 @@ public class LocalConnectorTest } @Test - public void testThreeResponse_11() throws Exception + public void testThreeResponse11() throws Exception { LocalEndPoint endp = _connector.connect(); endp.addInput( @@ -234,7 +234,7 @@ public class LocalConnectorTest } @Test - public void testThreeResponseClosed_11() throws Exception + public void testThreeResponseClosed11() throws Exception { LocalEndPoint endp = _connector.connect(); endp.addInput( diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java b/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java index 18ea5267385..cc76b5ee895 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java @@ -24,7 +24,7 @@ class MockConnector extends AbstractConnector { public MockConnector() { - super(new Server() , null, null, null, 0); + super(new Server(), null, null, null, 0); } @Override diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java b/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java index 0535ab9db43..d82ba750f8d 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java @@ -82,7 +82,7 @@ public class PartialRFC2616Test } @Test - public void test3_3() + public void test33() { try { @@ -108,9 +108,8 @@ public class PartialRFC2616Test } } - @Test - public void test3_3_2() + public void test332() { try { @@ -119,7 +118,7 @@ public class PartialRFC2616Test checkContains(get, 0, "Content-Type: text/html", "GET _content"); checkContains(get, 0, "", "GET body"); int cli = get.indexOf("Content-Length"); - String contentLength = get.substring(cli,get.indexOf("\r",cli)); + String contentLength = get.substring(cli, get.indexOf("\r", cli)); String head = connector.getResponse("HEAD /R1 HTTP/1.0\n" + "Host: localhost\n" + "\n"); checkContains(head, 0, "HTTP/1.1 200", "HEAD"); @@ -134,9 +133,8 @@ public class PartialRFC2616Test } } - @Test - public void test3_6_a() throws Exception + public void test36a() throws Exception { int offset = 0; // Chunk last @@ -150,12 +148,12 @@ public class PartialRFC2616Test "5;\015\012" + "123\015\012\015\012" + "0;\015\012\015\012"); - //@checkstyle-enable-check : IllegalTokenText + //@checkstyle-enable-check : IllegalTokenText checkContains(response, offset, "HTTP/1.1 400 Bad", "Chunked last"); } @Test - public void test3_6_b() throws Exception + public void test36b() throws Exception { String response; int offset = 0; @@ -201,7 +199,7 @@ public class PartialRFC2616Test } @Test - public void test3_6_c() throws Exception + public void test36c() throws Exception { String response; int offset = 0; @@ -249,7 +247,7 @@ public class PartialRFC2616Test } @Test - public void test3_6_d() throws Exception + public void test36d() throws Exception { String response; int offset = 0; @@ -281,7 +279,7 @@ public class PartialRFC2616Test } @Test - public void test3_9() throws Exception + public void test39() throws Exception { HttpFields fields = new HttpFields(); @@ -297,7 +295,7 @@ public class PartialRFC2616Test } @Test - public void test4_1() throws Exception + public void test41() throws Exception { int offset = 0; // If _content length not used, second request will not be read. @@ -327,7 +325,7 @@ public class PartialRFC2616Test } @Test - public void test4_4_2() throws Exception + public void test442() throws Exception { String response; int offset = 0; @@ -356,7 +354,7 @@ public class PartialRFC2616Test } @Test - public void test4_4_3() throws Exception + public void test443() throws Exception { // Due to smuggling concerns, handling has been changed to // treat content length and chunking as a bad request. @@ -389,7 +387,7 @@ public class PartialRFC2616Test } @Test - public void test4_4_4() throws Exception + public void test444() throws Exception { // No _content length assertTrue(true, "Skip 411 checks as IE breaks this rule"); @@ -413,7 +411,7 @@ public class PartialRFC2616Test } @Test - public void test5_2_1() throws Exception + public void test521() throws Exception { // Default Host int offset = 0; @@ -425,7 +423,7 @@ public class PartialRFC2616Test } @Test - public void test5_2_2() throws Exception + public void test522() throws Exception { // Default Host int offset = 0; @@ -443,7 +441,7 @@ public class PartialRFC2616Test } @Test - public void test5_2() throws Exception + public void test52() throws Exception { // Virtual Host int offset = 0; @@ -466,7 +464,7 @@ public class PartialRFC2616Test } @Test - public void test8_1() throws Exception + public void test81() throws Exception { int offset = 0; String response = connector.getResponse("GET /R1 HTTP/1.1\n" + "Host: localhost\n" + "\n", 250, TimeUnit.MILLISECONDS); @@ -500,7 +498,7 @@ public class PartialRFC2616Test } @Test - public void test10_4_18() throws Exception + public void test10418() throws Exception { // Expect Failure int offset = 0; @@ -515,7 +513,7 @@ public class PartialRFC2616Test } @Test - public void test8_2_3_dash5() throws Exception + public void test823Dash5() throws Exception { // Expect with body: client sends the content right away, we should not send 100-Continue int offset = 0; @@ -529,13 +527,13 @@ public class PartialRFC2616Test "\n" + //@checkstyle-disable-check : IllegalTokenText "123456\015\012"); - //@checkstyle-enable-check : IllegalTokenText + //@checkstyle-enable-check : IllegalTokenText checkNotContained(response, offset, "HTTP/1.1 100 ", "8.2.3 expect 100"); offset = checkContains(response, offset, "HTTP/1.1 200 OK", "8.2.3 expect with body") + 1; } @Test - public void test8_2_3() throws Exception + public void test823() throws Exception { int offset = 0; // Expect 100 @@ -559,7 +557,7 @@ public class PartialRFC2616Test } @Test - public void test8_2_4() throws Exception + public void test824() throws Exception { // Expect 100 not sent int offset = 0; @@ -575,7 +573,7 @@ public class PartialRFC2616Test } @Test - public void test9_2() throws Exception + public void test92() throws Exception { int offset = 0; @@ -594,7 +592,7 @@ public class PartialRFC2616Test } @Test - public void test9_4() + public void test94() { try { @@ -617,7 +615,7 @@ public class PartialRFC2616Test } @Test - public void test14_23() throws Exception + public void test1423() throws Exception { try (StacklessLogging stackless = new StacklessLogging(HttpParser.class)) { @@ -640,7 +638,7 @@ public class PartialRFC2616Test } @Test - public void test19_6() + public void test196() { try { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index 77b7c933b1b..d015ae8ece9 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -80,6 +80,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class RequestTest { private static final Logger LOG = Log.getLogger(RequestTest.class); @@ -153,7 +154,7 @@ public class RequestTest } @Test - public void testParamExtraction_BadSequence() throws Exception + public void testParamExtractionBadSequence() throws Exception { _handler._checker = new RequestTester() { @@ -179,7 +180,7 @@ public class RequestTest } @Test - public void testParamExtraction_Timeout() throws Exception + public void testParamExtractionTimeout() throws Exception { _handler._checker = new RequestTester() { @@ -637,17 +638,17 @@ public class RequestTest final long HUGE_LENGTH = (long)Integer.MAX_VALUE * 10L; _handler._checker = (request, response) -> - request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1); + request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1); request.getContentLengthLong() == HUGE_LENGTH; //Send a request with encoded form content String request = "POST / HTTP/1.1\r\n" + - "Host: whatever\r\n" + - "Content-Type: application/octet-stream\n" + - "Content-Length: " + HUGE_LENGTH + "\n" + - "Connection: close\n" + - "\n" + - "\n"; + "Host: whatever\r\n" + + "Content-Type: application/octet-stream\n" + + "Content-Length: " + HUGE_LENGTH + "\n" + + "Connection: close\n" + + "\n" + + "\n"; System.out.println(request); @@ -665,8 +666,8 @@ public class RequestTest _handler._checker = (request, response) -> request.getHeader("Content-Length").equals(hugeLength) && - request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1); - request.getContentLengthLong() == (-1); // exact behavior here not specified in Servlet javadoc + request.getContentLength() == (-1) && // per HttpServletRequest javadoc this must return (-1); + request.getContentLengthLong() == (-1); // exact behavior here not specified in Servlet javadoc //Send a request with encoded form content String request = "POST / HTTP/1.1\r\n" + @@ -1869,8 +1870,8 @@ public class RequestTest ((Request)request).setHandled(true); if (request.getContentLength() > 0 && - !request.getContentType().startsWith(MimeTypes.Type.FORM_ENCODED.asString()) && - !request.getContentType().startsWith("multipart/form-data")) + !request.getContentType().startsWith(MimeTypes.Type.FORM_ENCODED.asString()) && + !request.getContentType().startsWith("multipart/form-data")) _content = IO.toString(request.getInputStream()); if (_checker != null && _checker.check(request, response)) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java index 39b13805265..c6183cf33fa 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java @@ -89,6 +89,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class ResponseTest { @@ -121,14 +122,14 @@ public class ResponseTest BufferUtil.clear(_content); _server = new Server(); - Scheduler _scheduler = new TimerScheduler(); + Scheduler scheduler = new TimerScheduler(); HttpConfiguration config = new HttpConfiguration(); - LocalConnector connector = new LocalConnector(_server, null, _scheduler, null, 1, new HttpConnectionFactory(config)); + LocalConnector connector = new LocalConnector(_server, null, scheduler, null, 1, new HttpConnectionFactory(config)); _server.addConnector(connector); _server.setHandler(new DumpHandler()); _server.start(); - AbstractEndPoint endp = new ByteArrayEndPoint(_scheduler, 5000) + AbstractEndPoint endp = new ByteArrayEndPoint(scheduler, 5000) { @Override public InetSocketAddress getLocalAddress() @@ -518,20 +519,20 @@ public class ResponseTest Response response = getResponse(); Request request = response.getHttpChannel().getRequest(); - SessionHandler session_handler = new SessionHandler(); - session_handler.setServer(_server); - session_handler.setUsingCookies(true); - session_handler.start(); - request.setSessionHandler(session_handler); + SessionHandler sessionHandler = new SessionHandler(); + sessionHandler.setServer(_server); + sessionHandler.setUsingCookies(true); + sessionHandler.start(); + request.setSessionHandler(sessionHandler); HttpSession session = request.getSession(true); assertThat(session, not(nullValue())); assertTrue(session.isNew()); - HttpField set_cookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE); - assertThat(set_cookie, not(nullValue())); - assertThat(set_cookie.getValue(), startsWith("JSESSIONID")); - assertThat(set_cookie.getValue(), containsString(session.getId())); + HttpField setCookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE); + assertThat(setCookie, not(nullValue())); + assertThat(setCookie.getValue(), startsWith("JSESSIONID")); + assertThat(setCookie.getValue(), containsString(session.getId())); response.setHeader("Some", "Header"); response.addCookie(new Cookie("Some", "Cookie")); response.getOutputStream().print("X"); @@ -539,10 +540,10 @@ public class ResponseTest response.reset(); - set_cookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE); - assertThat(set_cookie, not(nullValue())); - assertThat(set_cookie.getValue(), startsWith("JSESSIONID")); - assertThat(set_cookie.getValue(), containsString(session.getId())); + setCookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE); + assertThat(setCookie, not(nullValue())); + assertThat(setCookie.getValue(), startsWith("JSESSIONID")); + assertThat(setCookie.getValue(), containsString(session.getId())); assertThat(response.getHttpFields().size(), is(2)); response.getWriter(); } @@ -576,7 +577,7 @@ public class ResponseTest } @Test - public void testPrint_Empty() throws Exception + public void testPrintEmpty() throws Exception { Response response = getResponse(); response.setCharacterEncoding(UTF_8.name()); @@ -688,7 +689,6 @@ public class ResponseTest else response.sendError(code, message); - assertTrue(response.getHttpOutput().isClosed()); assertEquals(code, response.getStatus()); assertEquals(null, response.getReason()); @@ -988,7 +988,7 @@ public class ResponseTest * https://bugs.chromium.org/p/chromium/issues/detail?id=700618 */ @Test - public void testAddCookie_JavaxServletHttp() throws Exception + public void testAddCookieJavaxServletHttp() throws Exception { Response response = getResponse(); @@ -1007,7 +1007,7 @@ public class ResponseTest * https://bugs.chromium.org/p/chromium/issues/detail?id=700618 */ @Test - public void testAddCookie_JavaNet() throws Exception + public void testAddCookieJavaNet() throws Exception { java.net.HttpCookie cookie = new java.net.HttpCookie("foo", URLEncoder.encode("bar;baz", UTF_8.toString())); cookie.setPath("/secure"); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java index 04492f01473..44c48d5895d 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java @@ -119,7 +119,7 @@ public class ServerConnectorTest } @Test - public void testReuseAddress_Default() throws Exception + public void testReuseAddressDefault() throws Exception { Server server = new Server(); ServerConnector connector = new ServerConnector(server); @@ -154,7 +154,7 @@ public class ServerConnectorTest } @Test - public void testReuseAddress_True() throws Exception + public void testReuseAddressTrue() throws Exception { Server server = new Server(); ServerConnector connector = new ServerConnector(server); @@ -190,7 +190,7 @@ public class ServerConnectorTest } @Test - public void testReuseAddress_False() throws Exception + public void testReuseAddressFalse() throws Exception { Server server = new Server(); ServerConnector connector = new ServerConnector(server); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTimeoutTest.java index a302345b37e..7fbb2588bbc 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTimeoutTest.java @@ -70,14 +70,14 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest public void testIdleTimeoutAfterSuspend() throws Exception { _server.stop(); - SuspendHandler _handler = new SuspendHandler(); + SuspendHandler handler = new SuspendHandler(); SessionHandler session = new SessionHandler(); - session.setHandler(_handler); + session.setHandler(handler); _server.setHandler(session); _server.start(); - _handler.setSuspendFor(100); - _handler.setResumeAfter(25); + handler.setSuspendFor(100); + handler.setResumeAfter(25); assertTimeoutPreemptively(ofSeconds(10), () -> { String process = process(null).toUpperCase(Locale.ENGLISH); @@ -88,14 +88,14 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest @Test public void testIdleTimeoutAfterTimeout() throws Exception { - SuspendHandler _handler = new SuspendHandler(); + SuspendHandler handler = new SuspendHandler(); _server.stop(); SessionHandler session = new SessionHandler(); - session.setHandler(_handler); + session.setHandler(handler); _server.setHandler(session); _server.start(); - _handler.setSuspendFor(50); + handler.setSuspendFor(50); assertTimeoutPreemptively(ofSeconds(10), () -> { String process = process(null).toUpperCase(Locale.ENGLISH); @@ -106,15 +106,15 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest @Test public void testIdleTimeoutAfterComplete() throws Exception { - SuspendHandler _handler = new SuspendHandler(); + SuspendHandler handler = new SuspendHandler(); _server.stop(); SessionHandler session = new SessionHandler(); - session.setHandler(_handler); + session.setHandler(handler); _server.setHandler(session); _server.start(); - _handler.setSuspendFor(100); - _handler.setCompleteAfter(25); + handler.setSuspendFor(100); + handler.setCompleteAfter(25); assertTimeoutPreemptively(ofSeconds(10), () -> { String process = process(null).toUpperCase(Locale.ENGLISH); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ServletWriterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ServletWriterTest.java index 2d370b2d97a..91a58edf59d 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ServletWriterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ServletWriterTest.java @@ -72,7 +72,8 @@ public class ServletWriterTest char[] chars = new char[128 * 1024 * 1024]; CountDownLatch latch = new CountDownLatch(1); AtomicReference serverThreadRef = new AtomicReference<>(); - start(chars.length, new AbstractHandler() { + start(chars.length, new AbstractHandler() + { @Override public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java index 00cc465e838..fc041d2260a 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java @@ -104,8 +104,8 @@ public class StressTest _connector.setIdleTimeout(30000); _server.addConnector(_connector); - TestHandler _handler = new TestHandler(); - _server.setHandler(_handler); + TestHandler handler = new TestHandler(); + _server.setHandler(handler); _server.start(); } @@ -256,9 +256,9 @@ public class StressTest throw throwable; } - for (ConcurrentLinkedQueue _latency : _latencies) + for (ConcurrentLinkedQueue latency : _latencies) { - assertEquals(_handled.get(), _latency.size()); + assertEquals(_handled.get(), latency.size()); } } finally diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java index 6c7c6558075..cd10401fae3 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java @@ -27,7 +27,6 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -545,7 +544,7 @@ public class ContextHandlerTest } @Test - public void testVirtualHostManagement() throws Exception + public void testVirtualHostManagement() { ContextHandler context = new ContextHandler("/"); @@ -659,7 +658,7 @@ public class ContextHandlerTest } @Test - public void testLogNameFromContextPath_Deep() throws Exception + public void testLogNameFromContextPathDeep() throws Exception { ContextHandler handler = new ContextHandler(); handler.setServer(new Server()); @@ -676,7 +675,7 @@ public class ContextHandlerTest } @Test - public void testLogNameFromContextPath_Root() throws Exception + public void testLogNameFromContextPathRoot() throws Exception { ContextHandler handler = new ContextHandler(); handler.setServer(new Server()); @@ -693,7 +692,7 @@ public class ContextHandlerTest } @Test - public void testLogNameFromContextPath_Undefined() throws Exception + public void testLogNameFromContextPathUndefined() throws Exception { ContextHandler handler = new ContextHandler(); handler.setServer(new Server()); @@ -709,7 +708,7 @@ public class ContextHandlerTest } @Test - public void testLogNameFromContextPath_Empty() throws Exception + public void testLogNameFromContextPathEmpty() throws Exception { ContextHandler handler = new ContextHandler(); handler.setServer(new Server()); @@ -726,7 +725,7 @@ public class ContextHandlerTest } @Test - public void testClassPath_WithSpaces() throws IOException + public void testClassPathWithSpaces() throws IOException { ContextHandler handler = new ContextHandler(); handler.setServer(new Server()); @@ -815,7 +814,7 @@ public class ContextHandlerTest } @Override - public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { baseRequest.setHandled(true); this.handled = true; @@ -830,7 +829,7 @@ public class ContextHandlerTest private static final class ContextPathHandler extends AbstractHandler { @Override - public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/InetAccessHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/InetAccessHandlerTest.java index c044dd084b8..6b6da0a2104 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/InetAccessHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/InetAccessHandlerTest.java @@ -131,7 +131,8 @@ public class InetAccessHandlerTest testConnector(_connector2.getLocalPort(), include, exclude, includeConnectors, excludeConnectors, codePerConnector.get(1)); } - private void testConnector(int port, String include, String exclude, String includeConnectors, String excludeConnectors, String code) throws IOException { + private void testConnector(int port, String include, String exclude, String includeConnectors, String excludeConnectors, String code) throws IOException + { try (Socket socket = new Socket("127.0.0.1", port);) { socket.setSoTimeout(5000); @@ -157,6 +158,7 @@ public class InetAccessHandlerTest /** * Data for this test. + * * @return Format of data: include;exclude;includeConnectors;excludeConnectors;assertionStatusCodePerConnector */ public static Stream data() @@ -211,12 +213,12 @@ public class InetAccessHandlerTest {"127.0.0.1-127.0.0.254", "", "http_connector1;http_connector2", "", "200;200"}, {"192.0.0.1", "", "http_connector1;http_connector2", "", "403;403"}, {"192.0.0.1-192.0.0.254", "", "http_connector1;http_connector2", "", "403;403"}, - + // exclude takes precedence over include {"127.0.0.1", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"}, {"127.0.0.1-127.0.0.254", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"}, {"192.0.0.1", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"}, - {"192.0.0.1-192.0.0.254", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"}, + {"192.0.0.1-192.0.0.254", "", "http_connector1;http_connector2", "http_connector1;http_connector2", "200;200"} }; return Arrays.asList(data).stream().map(Arguments::of); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java index b2b1744f448..1ba31a73f17 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java @@ -195,11 +195,11 @@ public class ResourceHandlerTest assertThat(response.getStatus(), equalTo(200)); assertThat(response.get(LAST_MODIFIED), Matchers.notNullValue()); assertThat(response.getContent(), containsString("simple text")); - String last_modified = response.get(LAST_MODIFIED); + String lastModified = response.get(LAST_MODIFIED); response = HttpTester.parseResponse(_local.getResponse( "GET /resource/simple.txt HTTP/1.0\r\n" + - "If-Modified-Since: " + last_modified + "\r\n" + + "If-Modified-Since: " + lastModified + "\r\n" + "\r\n")); assertThat(response.getStatus(), equalTo(304)); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/resource/RangeWriterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/resource/RangeWriterTest.java index 1777952383e..04b72c3c0ef 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/resource/RangeWriterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/resource/RangeWriterTest.java @@ -127,7 +127,7 @@ public class RangeWriterTest @ParameterizedTest(name = "[{index}] {0}") @MethodSource("impls") - public void testSameRange_MultipleTimes(String description, RangeWriter rangeWriter) throws IOException + public void testSameRangeMultipleTimes(String description, RangeWriter rangeWriter) throws IOException { ByteArrayOutputStream outputStream; @@ -142,7 +142,7 @@ public class RangeWriterTest @ParameterizedTest(name = "[{index}] {0}") @MethodSource("impls") - public void testMultipleRanges_Ordered(String description, RangeWriter rangeWriter) throws IOException + public void testMultipleRangesOrdered(String description, RangeWriter rangeWriter) throws IOException { ByteArrayOutputStream outputStream; @@ -161,7 +161,7 @@ public class RangeWriterTest @ParameterizedTest(name = "[{index}] {0}") @MethodSource("impls") - public void testMultipleRanges_Overlapping(String description, RangeWriter rangeWriter) throws IOException + public void testMultipleRangesOverlapping(String description, RangeWriter rangeWriter) throws IOException { ByteArrayOutputStream outputStream; @@ -180,7 +180,7 @@ public class RangeWriterTest @ParameterizedTest(name = "[{index}] {0}") @MethodSource("impls") - public void testMultipleRanges_ReverseOrder(String description, RangeWriter rangeWriter) throws IOException + public void testMultipleRangesReverseOrder(String description, RangeWriter rangeWriter) throws IOException { ByteArrayOutputStream outputStream; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java index 2a52a1791f9..d834045b9dc 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java @@ -369,8 +369,8 @@ public class SSLEngineTest public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // System.err.println("HANDLE "+request.getRequestURI()); - String ssl_id = (String)request.getAttribute("javax.servlet.request.ssl_session_id"); - assertNotNull(ssl_id); + String sslId = (String)request.getAttribute("javax.servlet.request.ssl_session_id"); + assertNotNull(sslId); if (request.getParameter("dump") != null) { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SniSslConnectionFactoryTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SniSslConnectionFactoryTest.java index d06b681b2d3..d37ccf9dc2b 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SniSslConnectionFactoryTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SniSslConnectionFactoryTest.java @@ -272,8 +272,6 @@ public class SniSslConnectionFactoryTest assertThat(response.getStatus(), is(400)); } - - @Test public void testWrongSNIRejectedFunction() throws Exception { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslConnectionFactoryTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslConnectionFactoryTest.java index c9288b35849..c93518414df 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslConnectionFactoryTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslConnectionFactoryTest.java @@ -77,12 +77,12 @@ public class SslConnectionFactoryTest _server = new Server(); - HttpConfiguration http_config = new HttpConfiguration(); - http_config.setSecureScheme("https"); - http_config.setSecurePort(8443); - http_config.setOutputBufferSize(32768); - HttpConfiguration https_config = new HttpConfiguration(http_config); - https_config.addCustomizer(new SecureRequestCustomizer()); + HttpConfiguration httpConfig = new HttpConfiguration(); + httpConfig.setSecureScheme("https"); + httpConfig.setSecurePort(8443); + httpConfig.setOutputBufferSize(32768); + HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); + httpsConfig.addCustomizer(new SecureRequestCustomizer()); SslContextFactory sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(keystoreFile.getAbsolutePath()); @@ -91,7 +91,7 @@ public class SslConnectionFactoryTest ServerConnector https = _connector = new ServerConnector(_server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), - new HttpConnectionFactory(https_config)); + new HttpConnectionFactory(httpsConfig)); https.setPort(0); https.setIdleTimeout(30000); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java index 9facc718f63..96341d79669 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java @@ -93,10 +93,10 @@ public class AsyncContextTest _contextHandler.addServlet(new ServletHolder(new BadExpireServlet()), "/badexpire/*"); _contextHandler.addServlet(new ServletHolder(new ErrorServlet()), "/error/*"); - ErrorPageErrorHandler error_handler = new ErrorPageErrorHandler(); - _contextHandler.setErrorHandler(error_handler); - error_handler.addErrorPage(500, "/error/500"); - error_handler.addErrorPage(IOException.class.getName(), "/error/IOE"); + ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler(); + _contextHandler.setErrorHandler(errorHandler); + errorHandler.addErrorPage(500, "/error/500"); + errorHandler.addErrorPage(IOException.class.getName(), "/error/IOE"); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] @@ -227,7 +227,7 @@ public class AsyncContextTest } @Test - public void testDispatchAsyncContext_EncodedUrl() throws Exception + public void testDispatchAsyncContextEncodedUrl() throws Exception { String request = "GET /ctx/test/hello%2fthere?dispatch=true HTTP/1.1\r\n" + "Host: localhost\r\n" + @@ -260,7 +260,7 @@ public class AsyncContextTest } @Test - public void testDispatchAsyncContext_SelfEncodedUrl() throws Exception + public void testDispatchAsyncContextSelfEncodedUrl() throws Exception { String request = "GET /ctx/self/hello%2fthere?dispatch=true HTTP/1.1\r\n" + "Host: localhost\r\n" + diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncListenerTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncListenerTest.java index f064d8bd7ba..480b2ae789b 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncListenerTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncListenerTest.java @@ -70,9 +70,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_Throw_OnError_Dispatch() throws Exception + public void testStartAsyncThrowOnErrorDispatch() throws Exception { - test_StartAsync_Throw_OnError(event -> event.getAsyncContext().dispatch("/dispatch")); + testStartAsyncThrowOnError(event -> event.getAsyncContext().dispatch("/dispatch")); String httpResponse = connector.getResponse( "GET /ctx/path HTTP/1.1\r\n" + "Host: localhost\r\n" + @@ -82,9 +82,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_Throw_OnError_Complete() throws Exception + public void testStartAsyncThrowOnErrorComplete() throws Exception { - test_StartAsync_Throw_OnError(event -> + testStartAsyncThrowOnError(event -> { HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse(); response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500); @@ -106,9 +106,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_Throw_OnError_Throw() throws Exception + public void testStartAsyncThrowOnErrorThrow() throws Exception { - test_StartAsync_Throw_OnError(event -> + testStartAsyncThrowOnError(event -> { throw new IOException(); }); @@ -122,9 +122,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_Throw_OnError_Nothing() throws Exception + public void testStartAsyncThrowOnErrorNothing() throws Exception { - test_StartAsync_Throw_OnError(event -> + testStartAsyncThrowOnError(event -> { }); String httpResponse = connector.getResponse( @@ -137,9 +137,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_Throw_OnError_SendError() throws Exception + public void testStartAsyncThrowOnErrorSendError() throws Exception { - test_StartAsync_Throw_OnError(event -> + testStartAsyncThrowOnError(event -> { HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse(); response.sendError(HttpStatus.BAD_GATEWAY_502, "Message!!!"); @@ -155,9 +155,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_Throw_OnError_SendError_CustomErrorPage() throws Exception + public void testStartAsyncThrowOnErrorSendErrorCustomErrorPage() throws Exception { - test_StartAsync_Throw_OnError(event -> + testStartAsyncThrowOnError(event -> { HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse(); response.sendError(HttpStatus.BAD_GATEWAY_502); @@ -184,14 +184,14 @@ public class AsyncListenerTest assertThat(httpResponse, containsString("CUSTOM")); } - private void test_StartAsync_Throw_OnError(IOConsumer consumer) throws Exception + private void testStartAsyncThrowOnError(IOConsumer consumer) throws Exception { ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/ctx"); context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException { AsyncContext asyncContext = request.startAsync(); asyncContext.setTimeout(10000); @@ -209,7 +209,7 @@ public class AsyncListenerTest context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) { response.setStatus(HttpStatus.OK_200); } @@ -217,7 +217,7 @@ public class AsyncListenerTest context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.getOutputStream().print("CUSTOM"); } @@ -227,9 +227,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnTimeout_Dispatch() throws Exception + public void testStartAsyncOnTimeoutDispatch() throws Exception { - test_StartAsync_OnTimeout(500, event -> event.getAsyncContext().dispatch("/dispatch")); + testStartAsyncOnTimeout(500, event -> event.getAsyncContext().dispatch("/dispatch")); String httpResponse = connector.getResponse( "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + @@ -239,9 +239,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnTimeout_Complete() throws Exception + public void testStartAsyncOnTimeoutComplete() throws Exception { - test_StartAsync_OnTimeout(500, event -> + testStartAsyncOnTimeout(500, event -> { HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse(); response.setStatus(HttpStatus.OK_200); @@ -259,9 +259,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnTimeout_Throw() throws Exception + public void testStartAsyncOnTimeoutThrow() throws Exception { - test_StartAsync_OnTimeout(500, event -> + testStartAsyncOnTimeout(500, event -> { throw new TestRuntimeException(); }); @@ -276,9 +276,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnTimeout_Nothing() throws Exception + public void testStartAsyncOnTimeoutNothing() throws Exception { - test_StartAsync_OnTimeout(500, event -> + testStartAsyncOnTimeout(500, event -> { }); String httpResponse = connector.getResponse( @@ -290,9 +290,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnTimeout_SendError() throws Exception + public void testStartAsyncOnTimeoutSendError() throws Exception { - test_StartAsync_OnTimeout(500, event -> + testStartAsyncOnTimeout(500, event -> { HttpServletResponse response = (HttpServletResponse)event.getAsyncContext().getResponse(); response.sendError(HttpStatus.BAD_GATEWAY_502); @@ -307,9 +307,9 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnTimeout_SendError_CustomErrorPage() throws Exception + public void testStartAsyncOnTimeoutSendErrorCustomErrorPage() throws Exception { - test_StartAsync_OnTimeout(500, event -> + testStartAsyncOnTimeout(500, event -> { AsyncContext asyncContext = event.getAsyncContext(); HttpServletResponse response = (HttpServletResponse)asyncContext.getResponse(); @@ -339,13 +339,13 @@ public class AsyncListenerTest assertThat(httpResponse, containsString("CUSTOM")); } - private void test_StartAsync_OnTimeout(long timeout, IOConsumer consumer) throws Exception + private void testStartAsyncOnTimeout(long timeout, IOConsumer consumer) throws Exception { ServletContextHandler context = new ServletContextHandler(); context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) { AsyncContext asyncContext = request.startAsync(); asyncContext.setTimeout(timeout); @@ -362,7 +362,7 @@ public class AsyncListenerTest context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) { response.setStatus(HttpStatus.OK_200); } @@ -370,7 +370,7 @@ public class AsyncListenerTest context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.getOutputStream().print("CUSTOM"); } @@ -380,20 +380,20 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnComplete_Throw() throws Exception + public void testStartAsyncOnCompleteThrow() throws Exception { ServletContextHandler context = new ServletContextHandler(); context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { AsyncContext asyncContext = request.startAsync(); asyncContext.setTimeout(10000); asyncContext.addListener(new AsyncListenerAdapter() { @Override - public void onComplete(AsyncEvent event) throws IOException + public void onComplete(AsyncEvent event) { throw new TestRuntimeException(); } @@ -415,7 +415,7 @@ public class AsyncListenerTest } @Test - public void test_StartAsync_OnTimeout_CalledBy_PooledThread() throws Exception + public void testStartAsyncOnTimeoutCalledByPooledThread() throws Exception { String threadNamePrefix = "async_listener"; threadPool = new QueuedThreadPool(); @@ -424,14 +424,14 @@ public class AsyncListenerTest context.addServlet(new ServletHolder(new HttpServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + protected void service(HttpServletRequest request, HttpServletResponse response) { AsyncContext asyncContext = request.startAsync(); asyncContext.setTimeout(1000); asyncContext.addListener(new AsyncListenerAdapter() { @Override - public void onTimeout(AsyncEvent event) throws IOException + public void onTimeout(AsyncEvent event) { if (Thread.currentThread().getName().startsWith(threadNamePrefix)) response.setStatus(HttpStatus.OK_200); @@ -459,7 +459,7 @@ public class AsyncListenerTest public static class AsyncListenerAdapter implements AsyncListener { @Override - public void onComplete(AsyncEvent event) throws IOException + public void onComplete(AsyncEvent event) { } @@ -474,7 +474,7 @@ public class AsyncListenerTest } @Override - public void onStartAsync(AsyncEvent event) throws IOException + public void onStartAsync(AsyncEvent event) { } } diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletIOTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletIOTest.java index 0ed1b1d9052..56ce0e39997 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletIOTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletIOTest.java @@ -93,9 +93,9 @@ public class AsyncServletIOTest _wQTP = new WrappingQTP(); _server = new Server(_wQTP); - HttpConfiguration http_config = new HttpConfiguration(); - http_config.setOutputBufferSize(4096); - _connector = new ServerConnector(_server, new HttpConnectionFactory(http_config)); + HttpConfiguration httpConfig = new HttpConfiguration(); + httpConfig.setOutputBufferSize(4096); + _connector = new ServerConnector(_server, new HttpConnectionFactory(httpConfig)); _server.setConnectors(new Connector[]{_connector}); ServletContextHandler context = new ServletContextHandler(); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java index a112e275379..3e88e4d4144 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java @@ -716,43 +716,43 @@ public class AsyncServletTest historyAdd("wrapped" + ((request instanceof ServletRequestWrapper) ? " REQ" : "") + ((response instanceof ServletResponseWrapper) ? " RSP" : "")); boolean wrap = "true".equals(request.getParameter("wrap")); - int read_before = 0; - long sleep_for = -1; - long start_for = -1; - long start2_for = -1; - long dispatch_after = -1; - long dispatch2_after = -1; - long complete_after = -1; - long complete2_after = -1; + int readBefore = 0; + long sleepFor = -1; + long startFor = -1; + long start2For = -1; + long dispatchAfter = -1; + long dispatch2After = -1; + long completeAfter = -1; + long complete2After = -1; if (request.getParameter("read") != null) - read_before = Integer.parseInt(request.getParameter("read")); + readBefore = Integer.parseInt(request.getParameter("read")); if (request.getParameter("sleep") != null) - sleep_for = Integer.parseInt(request.getParameter("sleep")); + sleepFor = Integer.parseInt(request.getParameter("sleep")); if (request.getParameter("start") != null) - start_for = Integer.parseInt(request.getParameter("start")); + startFor = Integer.parseInt(request.getParameter("start")); if (request.getParameter("start2") != null) - start2_for = Integer.parseInt(request.getParameter("start2")); + start2For = Integer.parseInt(request.getParameter("start2")); if (request.getParameter("dispatch") != null) - dispatch_after = Integer.parseInt(request.getParameter("dispatch")); + dispatchAfter = Integer.parseInt(request.getParameter("dispatch")); final String path = request.getParameter("path"); if (request.getParameter("dispatch2") != null) - dispatch2_after = Integer.parseInt(request.getParameter("dispatch2")); + dispatch2After = Integer.parseInt(request.getParameter("dispatch2")); if (request.getParameter("complete") != null) - complete_after = Integer.parseInt(request.getParameter("complete")); + completeAfter = Integer.parseInt(request.getParameter("complete")); if (request.getParameter("complete2") != null) - complete2_after = Integer.parseInt(request.getParameter("complete2")); + complete2After = Integer.parseInt(request.getParameter("complete2")); if (request.getAttribute("State") == null) { request.setAttribute("State", new Integer(1)); historyAdd("initial"); - if (read_before > 0) + if (readBefore > 0) { - byte[] buf = new byte[read_before]; + byte[] buf = new byte[readBefore]; request.getInputStream().read(buf); } - else if (read_before < 0) + else if (readBefore < 0) { InputStream in = request.getInputStream(); int b = in.read(); @@ -788,18 +788,18 @@ public class AsyncServletTest }.start(); } - if (start_for >= 0) + if (startFor >= 0) { final AsyncContext async = wrap ? request.startAsync(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response)) : request.startAsync(); - if (start_for > 0) - async.setTimeout(start_for); + if (startFor > 0) + async.setTimeout(startFor); async.addListener(__listener); historyAdd("start"); if ("1".equals(request.getParameter("throw"))) throw new QuietServletException(new Exception("test throw in async 1")); - if (complete_after > 0) + if (completeAfter > 0) { TimerTask complete = new TimerTask() { @@ -821,17 +821,17 @@ public class AsyncServletTest }; synchronized (_timer) { - _timer.schedule(complete, complete_after); + _timer.schedule(complete, completeAfter); } } - else if (complete_after == 0) + else if (completeAfter == 0) { response.setStatus(200); response.getOutputStream().println("COMPLETED\n"); historyAdd("complete"); async.complete(); } - else if (dispatch_after > 0) + else if (dispatchAfter > 0) { TimerTask dispatch = new TimerTask() { @@ -853,10 +853,10 @@ public class AsyncServletTest }; synchronized (_timer) { - _timer.schedule(dispatch, dispatch_after); + _timer.schedule(dispatch, dispatchAfter); } } - else if (dispatch_after == 0) + else if (dispatchAfter == 0) { historyAdd("dispatch"); if (path != null) @@ -865,11 +865,11 @@ public class AsyncServletTest async.dispatch(); } } - else if (sleep_for >= 0) + else if (sleepFor >= 0) { try { - Thread.sleep(sleep_for); + Thread.sleep(sleepFor); } catch (InterruptedException e) { @@ -888,22 +888,22 @@ public class AsyncServletTest { historyAdd("!initial"); - if (start2_for >= 0 && request.getAttribute("2nd") == null) + if (start2For >= 0 && request.getAttribute("2nd") == null) { final AsyncContext async = wrap ? request.startAsync(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response)) : request.startAsync(); async.addListener(__listener); request.setAttribute("2nd", "cycle"); - if (start2_for > 0) + if (start2For > 0) { - async.setTimeout(start2_for); + async.setTimeout(start2For); } historyAdd("start"); if ("2".equals(request.getParameter("throw"))) throw new QuietServletException(new Exception("test throw in async 2")); - if (complete2_after > 0) + if (complete2After > 0) { TimerTask complete = new TimerTask() { @@ -925,17 +925,17 @@ public class AsyncServletTest }; synchronized (_timer) { - _timer.schedule(complete, complete2_after); + _timer.schedule(complete, complete2After); } } - else if (complete2_after == 0) + else if (complete2After == 0) { response.setStatus(200); response.getOutputStream().println("COMPLETED\n"); historyAdd("complete"); async.complete(); } - else if (dispatch2_after > 0) + else if (dispatch2After > 0) { TimerTask dispatch = new TimerTask() { @@ -948,10 +948,10 @@ public class AsyncServletTest }; synchronized (_timer) { - _timer.schedule(dispatch, dispatch2_after); + _timer.schedule(dispatch, dispatch2After); } } - else if (dispatch2_after == 0) + else if (dispatch2After == 0) { historyAdd("dispatch"); async.dispatch(); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ComplianceViolations2616Test.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ComplianceViolations2616Test.java index ebb27a4a3ce..ac9b650adec 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ComplianceViolations2616Test.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ComplianceViolations2616Test.java @@ -134,7 +134,7 @@ public class ComplianceViolations2616Test } @Test - public void testNoColonHeader_Middle() throws Exception + public void testNoColonHeaderMiddle() throws Exception { StringBuffer req1 = new StringBuffer(); req1.append("GET /dump/ HTTP/1.1\r\n"); @@ -151,7 +151,7 @@ public class ComplianceViolations2616Test } @Test - public void testNoColonHeader_End() throws Exception + public void testNoColonHeaderEnd() throws Exception { StringBuffer req1 = new StringBuffer(); req1.append("GET /dump/ HTTP/1.1\r\n"); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java index eb2ab3a2a1a..565e9a24614 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java @@ -273,7 +273,7 @@ public class DefaultServletTest * This test ensures that this behavior will not arise again. */ @Test - public void testListingFilenamesOnly_UrlResource() throws Exception + public void testListingFilenamesOnlyUrlResource() throws Exception { URL extraResource = context.getClassLoader().getResource("rez/one"); assertNotNull(extraResource, "Must have extra jar resource in classloader"); @@ -874,7 +874,7 @@ public class DefaultServletTest * Ensure that oddball directory names are served with proper escaping */ @Test - public void testWelcomeRedirect_DirWithQuestion() throws Exception + public void testWelcomeRedirectDirWithQuestion() throws Exception { FS.ensureDirExists(docRoot); context.setBaseResource(new PathResource(docRoot)); @@ -908,7 +908,7 @@ public class DefaultServletTest * Ensure that oddball directory names are served with proper escaping */ @Test - public void testWelcomeRedirect_DirWithSemicolon() throws Exception + public void testWelcomeRedirectDirWithSemicolon() throws Exception { FS.ensureDirExists(docRoot); context.setBaseResource(new PathResource(docRoot)); @@ -1500,7 +1500,7 @@ public class DefaultServletTest body = response.getContent(); assertThat(body, containsString("Hello Text 0")); String etag = response.get(HttpHeader.ETAG); - String etag_gzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\""); + String etagGzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\""); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1509,7 +1509,7 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain")); assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding")); assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "gzip")); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip)); body = response.getContent(); assertThat(body, containsString("fake gzip")); @@ -1520,7 +1520,7 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/gzip")); assertThat(response, not(containsHeader(HttpHeader.VARY))); assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING))); - assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_gzip))); + assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagGzip))); assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG)); body = response.getContent(); assertThat(body, containsString("fake gzip")); @@ -1532,30 +1532,30 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/gzip")); assertThat(response, not(containsHeader(HttpHeader.VARY))); assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING))); - assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_gzip))); + assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagGzip))); assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG)); body = response.getContent(); assertThat(body, containsString("fake gzip")); - String bad_etag_gzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2X--gzip\""); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + bad_etag_gzip + "\r\n\r\n"); + String badEtagGzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2X--gzip\""); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + badEtagGzip + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(not(HttpStatus.NOT_MODIFIED_304))); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag_gzip + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etagGzip + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag)); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag_gzip + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etagGzip + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1599,7 +1599,7 @@ public class DefaultServletTest assertThat(body, containsString("Hello Text 0")); String etag = response.get(HttpHeader.ETAG); - String etag_gzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\""); + String etagGzip = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--gzip\""); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1608,7 +1608,7 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain")); assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding")); assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "gzip")); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip)); body = response.getContent(); assertThat(body, containsString("fake gzip")); @@ -1619,25 +1619,25 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/gzip")); assertThat(response, not(containsHeader(HttpHeader.VARY))); assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING))); - assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_gzip))); + assertThat("Should not contain gzip variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagGzip))); assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG)); body = response.getContent(); assertThat(body, containsString("fake gzip")); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag_gzip + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etagGzip + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: " + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag)); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag_gzip + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etagGzip + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_gzip)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagGzip)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1674,7 +1674,7 @@ public class DefaultServletTest assertThat(body, containsString("Hello Text 0")); String etag = response.get(HttpHeader.ETAG); - String etag_br = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\""); + String etagBr = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\""); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip;q=0.9,br\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1683,7 +1683,7 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain")); assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding")); assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "br")); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr)); body = response.getContent(); assertThat(body, containsString("fake br")); @@ -1694,7 +1694,7 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/brotli")); assertThat(response, not(containsHeader(HttpHeader.VARY))); assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING))); - assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_br))); + assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagBr))); assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG)); body = response.getContent(); assertThat(body, containsString("fake br")); @@ -1706,25 +1706,25 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/brotli")); assertThat(response, not(containsHeader(HttpHeader.VARY))); assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING))); - assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_br))); + assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagBr))); assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG)); body = response.getContent(); assertThat(body, containsString("fake br")); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag_br + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etagBr + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag)); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag_br + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etagBr + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1765,7 +1765,7 @@ public class DefaultServletTest assertThat(body, containsString("Hello Text 0")); String etag = response.get(HttpHeader.ETAG); - String etag_br = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\""); + String etagBr = etag.replaceFirst("([^\"]*)\"(.*)\"", "$1\"$2--br\""); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1774,7 +1774,7 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain")); assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding")); assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "br")); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr)); body = response.getContent(); assertThat(body, containsString("fake brotli")); @@ -1785,25 +1785,25 @@ public class DefaultServletTest assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "application/brotli")); assertThat(response, not(containsHeader(HttpHeader.VARY))); assertThat(response, not(containsHeader(HttpHeader.CONTENT_ENCODING))); - assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etag_br))); + assertThat("Should not contain br variant", response, not(containsHeaderValue(HttpHeader.ETAG, etagBr))); assertThat("Should have a different ETag", response, containsHeader(HttpHeader.ETAG)); body = response.getContent(); assertThat(body, containsString("fake brotli")); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag_br + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etagBr + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: " + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag)); - rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag_br + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etagBr + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); - assertThat(response, containsHeaderValue(HttpHeader.ETAG, etag_br)); + assertThat(response, containsHeaderValue(HttpHeader.ETAG, etagBr)); rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nIf-None-Match: W/\"foobar\"," + etag + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); @@ -1931,9 +1931,9 @@ public class DefaultServletTest assertThat(response.toString(), response.getStatus(), is(HttpStatus.OK_200)); assertThat(response, containsHeader(HttpHeader.LAST_MODIFIED)); - String last_modified = response.get(HttpHeader.LAST_MODIFIED); + String lastModified = response.get(HttpHeader.LAST_MODIFIED); - rawResponse = connector.getResponse("GET /context/file.txt HTTP/1.1\r\nHost:test\r\nConnection:close\r\nIf-Modified-Since: " + last_modified + "\r\n\r\n"); + rawResponse = connector.getResponse("GET /context/file.txt HTTP/1.1\r\nHost:test\r\nConnection:close\r\nIf-Modified-Since: " + lastModified + "\r\n\r\n"); response = HttpTester.parseResponse(rawResponse); assertThat(response.toString(), response.getStatus(), is(HttpStatus.NOT_MODIFIED_304)); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java index 0399b54762d..cee4e52bd40 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java @@ -656,8 +656,8 @@ public class DispatcherTest @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - byte[] cp1251_bytes = TypeUtil.fromHexString("d2e5ecefe5f0e0f2f3f0e0"); - String expectedCP1251String = new String(cp1251_bytes, "cp1251"); + byte[] cp1251Bytes = TypeUtil.fromHexString("d2e5ecefe5f0e0f2f3f0e0"); + String expectedCP1251String = new String(cp1251Bytes, "cp1251"); assertEquals("/context/ForwardServlet", request.getAttribute(Dispatcher.FORWARD_REQUEST_URI)); assertEquals("/context", request.getAttribute(Dispatcher.FORWARD_CONTEXT_PATH)); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java index 0d10132f70c..45668965ed7 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ErrorPageTest.java @@ -183,7 +183,7 @@ public class ErrorPageTest } @Test - public void testGenerateAcceptableResponse_noAcceptHeader() throws Exception + public void testGenerateAcceptableResponseNoAcceptHeader() throws Exception { // no global error page here _errorPageErrorHandler.getErrorPages().remove(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE); @@ -196,7 +196,7 @@ public class ErrorPageTest } @Test - public void testGenerateAcceptableResponse_htmlAcceptHeader() throws Exception + public void testGenerateAcceptableResponseHtmlAcceptHeader() throws Exception { // no global error page here _errorPageErrorHandler.getErrorPages().remove(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE); @@ -211,7 +211,7 @@ public class ErrorPageTest } @Test - public void testGenerateAcceptableResponse_noHtmlAcceptHeader() throws Exception + public void testGenerateAcceptableResponseNoHtmlAcceptHeader() throws Exception { // no global error page here _errorPageErrorHandler.getErrorPages().remove(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE); @@ -415,7 +415,7 @@ public class ErrorPageTest @Test public void testPermanentlyUnavailable() throws Exception { - try (StacklessLogging ignore =new StacklessLogging(_context.getLogger())) + try (StacklessLogging ignore = new StacklessLogging(_context.getLogger())) { try (StacklessLogging ignore2 = new StacklessLogging(HttpChannel.class)) { @@ -426,10 +426,11 @@ public class ErrorPageTest } } } + @Test public void testUnavailable() throws Exception { - try (StacklessLogging ignore =new StacklessLogging(_context.getLogger())) + try (StacklessLogging ignore = new StacklessLogging(_context.getLogger())) { try (StacklessLogging ignore2 = new StacklessLogging(HttpChannel.class)) { @@ -494,7 +495,7 @@ public class ErrorPageTest { final CountDownLatch hold = new CountDownLatch(1); final String mode = request.getParameter("mode"); - switch(mode) + switch (mode) { case "DSC": case "SDC": @@ -510,7 +511,7 @@ public class ErrorPageTest { try { - switch(mode) + switch (mode) { case "SDC": response.sendError(599); @@ -553,7 +554,7 @@ public class ErrorPageTest break; } } - catch(IllegalStateException e) + catch (IllegalStateException e) { Log.getLog().ignore(e); } @@ -661,7 +662,6 @@ public class ErrorPageTest } } - public static class UnavailableServlet extends HttpServlet implements Servlet { @Override diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerTest.java index 47e1c8ab76a..d2ee014e837 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/GzipHandlerTest.java @@ -196,6 +196,7 @@ public class GzipHandlerTest out.setWriteListener(new WriteListener() { int count = writes == null ? 1 : Integer.valueOf(writes); + { response.setContentLength(count * __bytes.length); } @@ -203,7 +204,7 @@ public class GzipHandlerTest @Override public void onWritePossible() throws IOException { - while(out.isReady()) + while (out.isReady()) { if (count-- == 0) { @@ -426,7 +427,9 @@ public class GzipHandlerTest byte[] bytes = testOut.toByteArray(); for (int i = 0; i < writes; i++) - assertEquals(__content, new String(Arrays.copyOfRange(bytes,i * __bytes.length, (i + 1) * __bytes.length), StandardCharsets.UTF_8), "chunk " + i); + { + assertEquals(__content, new String(Arrays.copyOfRange(bytes, i * __bytes.length, (i + 1) * __bytes.length), StandardCharsets.UTF_8), "chunk " + i); + } } @Test @@ -450,8 +453,6 @@ public class GzipHandlerTest assertThat(response.getStatus(), is(200)); assertThat(response.get("Content-Encoding"), Matchers.equalToIgnoringCase("gzip")); assertThat(response.getCSV("Vary", false), Matchers.contains("Accept-Encoding")); - - } @Test diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/RequestURITest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/RequestURITest.java index d99baa54246..062692d3d4b 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/RequestURITest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/RequestURITest.java @@ -183,7 +183,7 @@ public class RequestURITest @ParameterizedTest @MethodSource("data") - public void testGetRequestURI_HTTP10(String rawpath, String expectedReqUri, String expectedQuery) throws Exception + public void testGetRequestURIHTTP10(String rawpath, String expectedReqUri, String expectedQuery) throws Exception { try (Socket client = newSocket(serverURI.getHost(), serverURI.getPort())) { @@ -205,7 +205,7 @@ public class RequestURITest @ParameterizedTest @MethodSource("data") - public void testGetRequestURI_HTTP11(String rawpath, String expectedReqUri, String expectedQuery) throws Exception + public void testGetRequestURIHTTP11(String rawpath, String expectedReqUri, String expectedQuery) throws Exception { try (Socket client = newSocket(serverURI.getHost(), serverURI.getPort())) { diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextResourcesTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextResourcesTest.java index df95fe383ea..92264a20638 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextResourcesTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextResourcesTest.java @@ -102,7 +102,7 @@ public class ServletContextResourcesTest } @Test - public void testGetResourceAsStream_Root() throws Exception + public void testGetResourceAsStreamRoot() throws Exception { context.addServlet(ResourceAsStreamServlet.class, "/*"); @@ -117,7 +117,7 @@ public class ServletContextResourcesTest } @Test - public void testGetResourceAsStream_Content() throws Exception + public void testGetResourceAsStreamContent() throws Exception { context.addServlet(ResourceAsStreamServlet.class, "/*"); diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java index c988c2b8979..f41c3bbbf93 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletLifeCycleTest.java @@ -63,40 +63,48 @@ public class ServletLifeCycleTest sh.addListener(new ListenerHolder(TestListener.class)); context.addEventListener(context.getServletContext().createListener(TestListener2.class)); - sh.addFilterWithMapping(TestFilter.class,"/*", EnumSet.of(DispatcherType.REQUEST)); - sh.addFilterWithMapping(new FilterHolder(context.getServletContext().createFilter(TestFilter2.class)),"/*", EnumSet.of(DispatcherType.REQUEST)); + sh.addFilterWithMapping(TestFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); + sh.addFilterWithMapping(new FilterHolder(context.getServletContext().createFilter(TestFilter2.class)), "/*", EnumSet.of(DispatcherType.REQUEST)); sh.addServletWithMapping(TestServlet.class, "/1/*").setInitOrder(1); sh.addServletWithMapping(TestServlet2.class, "/2/*").setInitOrder(-1); - sh.addServletWithMapping(new ServletHolder(context.getServletContext().createServlet(TestServlet3.class)) {{setInitOrder(1);}}, "/3/*"); + sh.addServletWithMapping(new ServletHolder(context.getServletContext().createServlet(TestServlet3.class)) + { + { + setInitOrder(1); + } + }, "/3/*"); assertThat(events, Matchers.contains( "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener2", "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter2", - "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet3")); + "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet3" + )); events.clear(); server.start(); assertThat(events, Matchers.contains( - "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener", - "ContextInitialized class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener2", - "ContextInitialized class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener", - "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter", - "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter", - "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter2", - "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet", - "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet", - "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet3")); + "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener", + "ContextInitialized class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener2", + "ContextInitialized class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener", + "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter", + "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter", + "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter2", + "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet", + "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet", + "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet3" + )); events.clear(); connector.getResponse("GET /2/info HTTP/1.0\r\n\r\n"); assertThat(events, Matchers.contains( - "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet2", - "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet2", - "doFilter class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter", - "doFilter class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter2", - "service class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet2")); + "Decorate class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet2", + "init class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet2", + "doFilter class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter", + "doFilter class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestFilter2", + "service class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet2" + )); events.clear(); server.stop(); @@ -114,7 +122,8 @@ public class ServletLifeCycleTest "destroy class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet2", "Destroy class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet", "destroy class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestServlet", - "Destroy class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener")); + "Destroy class org.eclipse.jetty.servlet.ServletLifeCycleTest$TestListener" + )); // Listener added before start is not destroyed EventListener[] listeners = context.getEventListeners(); @@ -152,6 +161,7 @@ public class ServletLifeCycleTest events.add("contextDestroyed " + this.getClass()); } } + public static class TestListener2 extends TestListener { } diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java index 5fa6e9886d8..7ab63abd0e6 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletRequestLogTest.java @@ -379,7 +379,7 @@ public class ServletRequestLogTest */ @ParameterizedTest @MethodSource("data") - public void testLogHandlerCollection_ErrorHandler_ServerBean(Servlet testServlet, String requestPath, String expectedLogEntry) throws Exception + public void testLogHandlerCollectionErrorHandlerServerBean(Servlet testServlet, String requestPath, String expectedLogEntry) throws Exception { Server server = new Server(); ServerConnector connector = new ServerConnector(server); @@ -470,7 +470,7 @@ public class ServletRequestLogTest */ @ParameterizedTest @MethodSource("data") - public void testLogHandlerCollection_SimpleErrorPageMapping(Servlet testServlet, String requestPath, String expectedLogEntry) throws Exception + public void testLogHandlerCollectionSimpleErrorPageMapping(Servlet testServlet, String requestPath, String expectedLogEntry) throws Exception { Server server = new Server(); ServerConnector connector = new ServerConnector(server); diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipContentLengthTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipContentLengthTest.java index ed59a5424dd..e2efbdfa3c0 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipContentLengthTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipContentLengthTest.java @@ -126,7 +126,7 @@ public class GzipContentLengthTest */ @ParameterizedTest @MethodSource("scenarios") - public void testAsyncTimeoutCompleteWrite_Default(Scenario scenario) throws Exception + public void testAsyncTimeoutCompleteWriteDefault(Scenario scenario) throws Exception { testWithGzip(scenario, AsyncTimeoutCompleteWrite.Default.class); } @@ -139,7 +139,7 @@ public class GzipContentLengthTest */ @ParameterizedTest @MethodSource("scenarios") - public void testAsyncTimeoutCompleteWrite_Passed(Scenario scenario) throws Exception + public void testAsyncTimeoutCompleteWritePassed(Scenario scenario) throws Exception { testWithGzip(scenario, AsyncTimeoutCompleteWrite.Passed.class); } @@ -152,7 +152,7 @@ public class GzipContentLengthTest */ @ParameterizedTest @MethodSource("scenarios") - public void testAsyncTimeoutDispatchWrite_Default(Scenario scenario) throws Exception + public void testAsyncTimeoutDispatchWriteDefault(Scenario scenario) throws Exception { testWithGzip(scenario, AsyncTimeoutDispatchWrite.Default.class); } @@ -165,7 +165,7 @@ public class GzipContentLengthTest */ @ParameterizedTest @MethodSource("scenarios") - public void testAsyncTimeoutDispatchWrite_Passed(Scenario scenario) throws Exception + public void testAsyncTimeoutDispatchWritePassed(Scenario scenario) throws Exception { testWithGzip(scenario, AsyncTimeoutDispatchWrite.Passed.class); } @@ -178,7 +178,7 @@ public class GzipContentLengthTest */ @ParameterizedTest @MethodSource("scenarios") - public void testAsyncScheduledDispatchWrite_Default(Scenario scenario) throws Exception + public void testAsyncScheduledDispatchWriteDefault(Scenario scenario) throws Exception { testWithGzip(scenario, AsyncScheduledDispatchWrite.Default.class); } @@ -191,7 +191,7 @@ public class GzipContentLengthTest */ @ParameterizedTest @MethodSource("scenarios") - public void testAsyncScheduledDispatchWrite_Passed(Scenario scenario) throws Exception + public void testAsyncScheduledDispatchWritePassed(Scenario scenario) throws Exception { testWithGzip(scenario, AsyncScheduledDispatchWrite.Passed.class); } diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipDefaultNoRecompressTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipDefaultNoRecompressTest.java index 623e0d0e6e3..384dcabe188 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipDefaultNoRecompressTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipDefaultNoRecompressTest.java @@ -71,7 +71,7 @@ public class GzipDefaultNoRecompressTest @ParameterizedTest @MethodSource("data") - public void testNotGzipHandlered_Default_AlreadyCompressed(String alreadyCompressedFilename, String expectedContentType, String compressionType) throws Exception + public void testNotGzipHandleredDefaultAlreadyCompressed(String alreadyCompressedFilename, String expectedContentType, String compressionType) throws Exception { GzipTester tester = new GzipTester(testingdir.getEmptyPathDir(), compressionType); diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java index d566cb3ae46..56d2f2aa504 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/DoSFilterTest.java @@ -91,7 +91,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest } @Test - public void testRemotePortLoadIdCreation_ipv6() throws ServletException + public void testRemotePortLoadIdCreationIpv6() throws ServletException { final ServletRequest request = new RemoteAddressRequest("::192.9.5.5", 12345); DoSFilter doSFilter = new DoSFilter(); @@ -114,7 +114,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest } @Test - public void testRemotePortLoadIdCreation_ipv4() throws ServletException + public void testRemotePortLoadIdCreationIpv4() throws ServletException { final ServletRequest request = new RemoteAddressRequest("127.0.0.1", 12345); DoSFilter doSFilter = new DoSFilter(); diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/EventSourceServletTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/EventSourceServletTest.java index ba91fcacb6d..0d36798f9b6 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/EventSourceServletTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/EventSourceServletTest.java @@ -194,7 +194,7 @@ public class EventSourceServletTest public void testEncoding() throws Exception { // The EURO symbol - final String data = "\u20AC"; + final String data = "%E2%82%AC"; class S extends EventSourceServlet { @Override diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/IncludeExcludeBasedFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/IncludeExcludeBasedFilterTest.java index 65be1291a6b..570da438261 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/IncludeExcludeBasedFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/IncludeExcludeBasedFilterTest.java @@ -322,12 +322,12 @@ public class IncludeExcludeBasedFilterTest @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletRequest http_request = (HttpServletRequest)request; - HttpServletResponse http_response = (HttpServletResponse)response; + HttpServletRequest httpRequest = (HttpServletRequest)request; + HttpServletResponse httpResponse = (HttpServletResponse)response; - if (super.shouldFilter(http_request, http_response)) + if (super.shouldFilter(httpRequest, httpResponse)) { - http_response.setHeader("X-Custom-Value", "1"); + httpResponse.setHeader("X-Custom-Value", "1"); } chain.doFilter(request, response); diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java index 1c8cae75a68..d6e2369796e 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java @@ -60,6 +60,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class MultipartFilterTest { private File _dir; diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java index 13c5d7cd0d9..932c2adac42 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/PutFilterTest.java @@ -135,15 +135,15 @@ public class PutFilterTest request.setHeader("Content-Type", "text/plain"); String data2 = "Blah blah blah Blah blah"; request.setContent(data2); - String to_send = BufferUtil.toString(request.generate()); + String toSend = BufferUtil.toString(request.generate()); URL url = new URL(tester.createConnector(true)); Socket socket = new Socket(url.getHost(), url.getPort()); OutputStream out = socket.getOutputStream(); - int l = to_send.length(); - out.write(to_send.substring(0, l - 10).getBytes()); + int l = toSend.length(); + out.write(toSend.substring(0, l - 10).getBytes()); out.flush(); Thread.sleep(100); - out.write(to_send.substring(l - 10, l - 5).getBytes()); + out.write(toSend.substring(l - 10, l - 5).getBytes()); out.flush(); // loop until the resource is hidden (ie the PUT is starting to @@ -162,7 +162,7 @@ public class PutFilterTest while (response.getStatus() == 200); assertEquals(HttpServletResponse.SC_NOT_FOUND, response.getStatus()); - out.write(to_send.substring(l - 5).getBytes()); + out.write(toSend.substring(l - 5).getBytes()); out.flush(); String in = IO.toString(socket.getInputStream()); @@ -247,8 +247,8 @@ public class PutFilterTest assertTrue(!file.exists()); - File n_file = new File(_dir, "blah.txt"); - assertTrue(n_file.exists()); + File nFile = new File(_dir, "blah.txt"); + assertTrue(nFile.exists()); } @Test diff --git a/jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java b/jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java index 855b14c0886..87b750f9ba2 100644 --- a/jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java +++ b/jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java @@ -155,7 +155,7 @@ public class SpringXmlConfigurationTest } @Test - public void XmlConfigurationMain() throws Exception + public void xmlConfigurationMain() throws Exception { XmlConfiguration.main("src/test/resources/org/eclipse/jetty/spring/jetty.xml"); } diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java index e79890d7568..f694642b995 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java @@ -98,7 +98,7 @@ public class BaseHomeTest } @Test - public void testGetPath_OnlyHome() throws IOException + public void testGetPathOnlyHome() throws IOException { File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); @@ -116,7 +116,7 @@ public class BaseHomeTest } @Test - public void testGetPaths_OnlyHome() throws IOException + public void testGetPathsOnlyHome() throws IOException { File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); @@ -138,7 +138,7 @@ public class BaseHomeTest } @Test - public void testGetPaths_OnlyHome_InisOnly() throws IOException + public void testGetPathsOnlyHomeInisOnly() throws IOException { File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); @@ -160,7 +160,7 @@ public class BaseHomeTest } @Test - public void testGetPaths_Both() throws IOException + public void testGetPathsBoth() throws IOException { File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); File baseDir = MavenTestingUtils.getTestResourceDir("hb.1/base"); @@ -193,7 +193,7 @@ public class BaseHomeTest } @Test - public void testGetPath_Both() throws IOException + public void testGetPathBoth() throws IOException { File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); File baseDir = MavenTestingUtils.getTestResourceDir("hb.1/base"); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/FSTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/FSTest.java index f452b4737c3..e538c7642d8 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/FSTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/FSTest.java @@ -37,7 +37,7 @@ public class FSTest } @Test - public void testCanReadDirectory_NotDir() + public void testCanReadDirectoryNotDir() { File bogusFile = MavenTestingUtils.getTestResourceFile("bogus.xml"); assertFalse(FS.canReadDirectory(bogusFile.toPath()), "Can read dir: " + bogusFile); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java index 84849467e19..5c4e45be0be 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/IncludeJettyDirTest.java @@ -114,7 +114,7 @@ public class IncludeJettyDirTest } @Test - public void testCommandLine_1Extra() throws Exception + public void testCommandLine1Extra() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -148,7 +148,7 @@ public class IncludeJettyDirTest } @Test - public void testCommandLine_1Extra_FromSimpleProp() throws Exception + public void testCommandLine1ExtraFromSimpleProp() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -184,7 +184,7 @@ public class IncludeJettyDirTest } @Test - public void testCommandLine_1Extra_FromPropPrefix() throws Exception + public void testCommandLine1ExtraFromPropPrefix() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -226,7 +226,7 @@ public class IncludeJettyDirTest } @Test - public void testCommandLine_1Extra_FromCompoundProp() throws Exception + public void testCommandLine1ExtraFromCompoundProp() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -380,7 +380,7 @@ public class IncludeJettyDirTest } @Test - public void testRefCommonRefCorp_FromSimpleProps() throws Exception + public void testRefCommonRefCorpFromSimpleProps() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -423,7 +423,7 @@ public class IncludeJettyDirTest } @Test - public void testRefCommonRefCorp_CmdLineRef() throws Exception + public void testRefCommonRefCorpCmdLineRef() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -474,7 +474,7 @@ public class IncludeJettyDirTest } @Test - public void testRefCommonRefCorp_CmdLineProp() throws Exception + public void testRefCommonRefCorpCmdLineProp() throws Exception { // Create home Path home = testdir.getPathFile("home"); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java index 0b8aed93c0c..3ef4f5e766f 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java @@ -40,7 +40,7 @@ public class ModuleGraphWriterTest public WorkDir testdir; @Test - public void testGenerate_NothingEnabled() throws IOException + public void testGenerateNothingEnabled() throws IOException { // Test Env Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home"); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java index 1b6eeb6f701..bb6c8638214 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java @@ -141,7 +141,7 @@ public class ModulesTest } @Test - public void testResolve_ServerHttp() throws IOException + public void testResolveServerHttp() throws IOException { // Test Env File homeDir = MavenTestingUtils.getTestResourceDir("dist-home"); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java index 48e373e0447..f742b992231 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java @@ -83,7 +83,7 @@ public class ConfigSourcesTest } @Test - public void testOrder_BasicConfig() throws IOException + public void testOrderBasicConfig() throws IOException { // Create home Path home = testdir.getPathFile("home"); @@ -107,7 +107,7 @@ public class ConfigSourcesTest } @Test - public void testOrder_With1ExtraConfig() throws IOException + public void testOrderWith1ExtraConfig() throws IOException { // Create home Path home = testdir.getPathFile("home"); @@ -137,7 +137,7 @@ public class ConfigSourcesTest } @Test - public void testCommandLine_1Extra_FromSimpleProp() throws Exception + public void testCommandLine1ExtraFromSimpleProp() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -179,7 +179,7 @@ public class ConfigSourcesTest } @Test - public void testCommandLine_1Extra_FromPropPrefix() throws Exception + public void testCommandLine1ExtraFromPropPrefix() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -226,7 +226,7 @@ public class ConfigSourcesTest } @Test - public void testCommandLine_1Extra_FromCompoundProp() throws Exception + public void testCommandLine1ExtraFromCompoundProp() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -400,7 +400,7 @@ public class ConfigSourcesTest } @Test - public void testRefCommonRefCorp_FromSimpleProps() throws Exception + public void testRefCommonRefCorpFromSimpleProps() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -449,7 +449,7 @@ public class ConfigSourcesTest } @Test - public void testRefCommonRefCorp_CmdLineRef() throws Exception + public void testRefCommonRefCorpCmdLineRef() throws Exception { // Create home Path home = testdir.getPathFile("home"); @@ -507,7 +507,7 @@ public class ConfigSourcesTest } @Test - public void testRefCommonRefCorp_CmdLineProp() throws Exception + public void testRefCommonRefCorpCmdLineProp() throws Exception { // Create home Path home = testdir.getPathFile("home"); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java index 85398b42cf4..06b59d38f0d 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java @@ -62,7 +62,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testGetCoordinate_NotMaven() + public void testGetCoordinateNotMaven() { MavenLocalRepoFileInitializer repo = new MavenLocalRepoFileInitializer(baseHome); String ref = "http://www.eclipse.org/jetty"; @@ -71,7 +71,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testGetCoordinate_InvalidMaven() + public void testGetCoordinateInvalidMaven() { MavenLocalRepoFileInitializer repo = new MavenLocalRepoFileInitializer(baseHome); String ref = "maven://www.eclipse.org/jetty"; @@ -80,7 +80,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testGetCoordinate_Normal() + public void testGetCoordinateNormal() { MavenLocalRepoFileInitializer repo = new MavenLocalRepoFileInitializer(baseHome); String ref = "maven://org.eclipse.jetty/jetty-start/9.3.x"; @@ -98,7 +98,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testGetCoordinate_Zip() + public void testGetCoordinateZip() { MavenLocalRepoFileInitializer repo = new MavenLocalRepoFileInitializer(baseHome); String ref = "maven://org.eclipse.jetty/jetty-distribution/9.3.x/zip"; @@ -116,7 +116,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testGetCoordinate_TestJar() + public void testGetCoordinateTestJar() { MavenLocalRepoFileInitializer repo = new MavenLocalRepoFileInitializer(baseHome); String ref = "maven://org.eclipse.jetty/jetty-http/9.3.x/jar/tests"; @@ -134,7 +134,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testGetCoordinate_Test_UnspecifiedType() + public void testGetCoordinateTestUnspecifiedType() { MavenLocalRepoFileInitializer repo = new MavenLocalRepoFileInitializer(baseHome); String ref = "maven://org.eclipse.jetty/jetty-http/9.3.x//tests"; @@ -152,7 +152,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testGetCoordinate_TestMavenBaseUri() + public void testGetCoordinateTestMavenBaseUri() { MavenLocalRepoFileInitializer repo = new MavenLocalRepoFileInitializer(baseHome, null, false, @@ -172,7 +172,7 @@ public class MavenLocalRepoFileInitializerTest } @Test - public void testDownload_default_repo() + public void testDownloaddefaultrepo() throws Exception { MavenLocalRepoFileInitializer repo = diff --git a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java b/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java index 1bc47726963..7708a6be94d 100644 --- a/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java +++ b/jetty-unixsocket/src/test/java/org/eclipse/jetty/unixsocket/UnixSocketClient.java @@ -37,17 +37,17 @@ public class UnixSocketClient java.io.File content = new java.io.File("/tmp/data.txt"); String method = "GET"; - int content_length = 0; + int contentLength = 0; String body = null; if (content.exists()) { method = "POST"; body = IO.readToString(content); - content_length = body.length(); + contentLength = body.length(); } String data = method + " / HTTP/1.1\r\n" + "Host: unixsock\r\n" + - "Content-Length: " + content_length + "\r\n" + + "Content-Length: " + contentLength + "\r\n" + "Connection: close\r\n" + "\r\n"; if (body != null) diff --git a/jetty-util-ajax/src/test/java/org/eclipse/jetty/util/ajax/JSONTest.java b/jetty-util-ajax/src/test/java/org/eclipse/jetty/util/ajax/JSONTest.java index 7e951deefa1..18adc8d38a3 100644 --- a/jetty-util-ajax/src/test/java/org/eclipse/jetty/util/ajax/JSONTest.java +++ b/jetty-util-ajax/src/test/java/org/eclipse/jetty/util/ajax/JSONTest.java @@ -42,6 +42,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class JSONTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck + String test = "\n\n\n\t\t " + "// ignore this ,a [ \" \n" + "/* and this \n" + @@ -142,7 +144,7 @@ public class JSONTest } @Test - public void testToString_LineFeed() + public void testToStringLineFeed() { Map map = new HashMap<>(); map.put("str", "line\nfeed"); @@ -151,7 +153,7 @@ public class JSONTest } @Test - public void testToString_Tab() + public void testToStringTab() { Map map = new HashMap<>(); map.put("str", "tab\tchar"); @@ -160,7 +162,7 @@ public class JSONTest } @Test - public void testToString_Bel() + public void testToStringBel() { Map map = new HashMap<>(); map.put("str", "ascii\u0007bel"); @@ -169,7 +171,7 @@ public class JSONTest } @Test - public void testToString_Utf8() + public void testToStringUtf8() { Map map = new HashMap<>(); map.put("str", "japanese: 桟橋"); @@ -178,7 +180,7 @@ public class JSONTest } @Test - public void testToJson_Utf8_Encoded() + public void testToJsonUtf8Encoded() { JSON jsonUnicode = new JSON() { @@ -196,7 +198,7 @@ public class JSONTest } @Test - public void testParse_Utf8_JsonEncoded() + public void testParseUtf8JsonEncoded() { String jsonStr = "{\"str\": \"japanese: \\u685f\\u6a4b\"}"; Map map = (Map)JSON.parse(jsonStr); @@ -204,7 +206,7 @@ public class JSONTest } @Test - public void testParse_Utf8_JavaEncoded() + public void testParseUtf8JavaEncoded() { String jsonStr = "{\"str\": \"japanese: \u685f\u6a4b\"}"; Map map = (Map)JSON.parse(jsonStr); @@ -212,7 +214,7 @@ public class JSONTest } @Test - public void testParse_Utf8_Raw() + public void testParseUtf8Raw() { String jsonStr = "{\"str\": \"japanese: 桟橋\"}"; Map map = (Map)JSON.parse(jsonStr); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/B64CodeTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/B64CodeTest.java index dae9964c8dd..d9e2a0931d3 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/B64CodeTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/B64CodeTest.java @@ -34,7 +34,7 @@ public class B64CodeTest "of any carnal pleasure."; @Test - public void testEncode_RFC1421() + public void testEncodeRFC1421() { String expected = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz" + "IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg" + @@ -58,7 +58,7 @@ public class B64CodeTest } @Test - public void testEncode_RFC2045() + public void testEncodeRFC2045() { byte[] rawInputBytes = text.getBytes(ISO_8859_1); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java index 79fcc4525ed..790100408a6 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java @@ -192,7 +192,7 @@ public class BufferUtilTest } @Test - public void testToBuffer_Array() + public void testToBufferArray() { byte[] arr = new byte[128]; Arrays.fill(arr, (byte)0x44); @@ -210,7 +210,7 @@ public class BufferUtilTest } @Test - public void testToBuffer_ArrayOffsetLength() + public void testToBufferArrayOffsetLength() { byte[] arr = new byte[128]; Arrays.fill(arr, (byte)0xFF); // fill whole thing with FF @@ -319,7 +319,7 @@ public class BufferUtilTest } @Test - public void testToDetail_WithDEL() + public void testToDetailWithDEL() { ByteBuffer b = ByteBuffer.allocate(40); b.putChar('a').putChar('b').putChar('c'); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java index a4466d4acd8..26ee66b71dd 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/DateCacheTest.java @@ -71,7 +71,7 @@ public class DateCacheTest } @Test - public void test_all_methods() + public void testAllMethods() { // we simply check we do not have any exception DateCache dateCache = new DateCache(); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java index 4ac3a5791a7..990227c28dd 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java @@ -48,7 +48,7 @@ public class LazyListTest * Tests for {@link LazyList#add(Object, Object)} */ @Test - public void testAddObjectObject_NullInput_NullItem() + public void testAddObjectObjectNullInputNullItem() { Object list = LazyList.add(null, null); assertNotNull(list); @@ -60,7 +60,7 @@ public class LazyListTest * Tests for {@link LazyList#add(Object, Object)} */ @Test - public void testAddObjectObject_NullInput_NonListItem() + public void testAddObjectObjectNullInputNonListItem() { String item = "a"; Object list = LazyList.add(null, item); @@ -76,7 +76,7 @@ public class LazyListTest * Tests for {@link LazyList#add(Object, Object)} */ @Test - public void testAddObjectObject_NullInput_LazyListItem() + public void testAddObjectObjectNullInputLazyListItem() { Object item = LazyList.add(null, "x"); item = LazyList.add(item, "y"); @@ -95,7 +95,7 @@ public class LazyListTest * Tests for {@link LazyList#add(Object, Object)} */ @Test - public void testAddObjectObject_NonListInput() + public void testAddObjectObjectNonListInput() { String input = "a"; @@ -109,7 +109,7 @@ public class LazyListTest * Tests for {@link LazyList#add(Object, Object)} */ @Test - public void testAddObjectObject_LazyListInput() + public void testAddObjectObjectLazyListInput() { Object input = LazyList.add(null, "a"); @@ -128,7 +128,7 @@ public class LazyListTest * Tests for {@link LazyList#add(Object, Object)} */ @Test - public void testAddObjectObject_GenericListInput() + public void testAddObjectObjectGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -148,7 +148,7 @@ public class LazyListTest * Tests for {@link LazyList#add(Object, Object)} */ @Test - public void testAddObjectObject_AddNull() + public void testAddObjectObjectAddNull() { Object list = null; list = LazyList.add(list, null); @@ -172,7 +172,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_NullInput_NullItem() + public void testAddObjectIntObjectNullInputNullItem() { Object list = LazyList.add(null, 0, null); assertNotNull(list); @@ -184,7 +184,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_NullInput_NonListItem() + public void testAddObjectIntObjectNullInputNonListItem() { String item = "a"; Object list = LazyList.add(null, 0, item); @@ -200,7 +200,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_NullInput_NonListItem2() + public void testAddObjectIntObjectNullInputNonListItem2() { assumeTrue(STRICT); // Only run in STRICT mode. @@ -216,7 +216,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_NullInput_LazyListItem() + public void testAddObjectIntObjectNullInputLazyListItem() { Object item = LazyList.add(null, "x"); item = LazyList.add(item, "y"); @@ -234,7 +234,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_NullInput_GenericListItem() + public void testAddObjectIntObjectNullInputGenericListItem() { List item = new ArrayList(); item.add("a"); @@ -249,7 +249,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_NonListInput_NullItem() + public void testAddObjectIntObjectNonListInputNullItem() { String input = "a"; @@ -264,7 +264,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_NonListInput_NonListItem() + public void testAddObjectIntObjectNonListInputNonListItem() { String input = "a"; String item = "b"; @@ -280,7 +280,7 @@ public class LazyListTest * Test for {@link LazyList#add(Object, int, Object)} */ @Test - public void testAddObjectIntObject_LazyListInput() + public void testAddObjectIntObjectLazyListInput() { Object list = LazyList.add(null, "c"); // [c] list = LazyList.add(list, 0, "a"); // [a, c] @@ -298,7 +298,7 @@ public class LazyListTest * Test for {@link LazyList#addCollection(Object, java.util.Collection)} */ @Test - public void testAddCollection_NullInput() + public void testAddCollectionNullInput() { Collection coll = Arrays.asList("a", "b", "c"); @@ -314,7 +314,7 @@ public class LazyListTest * Test for {@link LazyList#addCollection(Object, java.util.Collection)} */ @Test - public void testAddCollection_NonListInput() + public void testAddCollectionNonListInput() { Collection coll = Arrays.asList("a", "b", "c"); String input = "z"; @@ -332,7 +332,7 @@ public class LazyListTest * Test for {@link LazyList#addCollection(Object, java.util.Collection)} */ @Test - public void testAddCollection_LazyListInput() + public void testAddCollectionLazyListInput() { Collection coll = Arrays.asList("a", "b", "c"); @@ -355,7 +355,7 @@ public class LazyListTest * Test for {@link LazyList#addCollection(Object, java.util.Collection)} */ @Test - public void testAddCollection_GenricListInput() + public void testAddCollectionGenericListInput() { Collection coll = Arrays.asList("a", "b", "c"); @@ -379,7 +379,7 @@ public class LazyListTest * Test for {@link LazyList#addCollection(Object, java.util.Collection)} */ @Test - public void testAddCollection_Sequential() + public void testAddCollectionSequential() { Collection coll = Arrays.asList("a", "b"); @@ -398,7 +398,7 @@ public class LazyListTest * Test for {@link LazyList#addCollection(Object, java.util.Collection)} */ @Test - public void testAddCollection_GenericListInput() + public void testAddCollectionGenericListInput2() { List l = new ArrayList(); l.add("a"); @@ -419,7 +419,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NullInput_NullArray() + public void testAddArrayNullInputNullArray() { String[] arr = null; Object list = LazyList.addArray(null, arr); @@ -430,7 +430,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NullInput_EmptyArray() + public void testAddArrayNullInputEmptyArray() { String[] arr = new String[0]; Object list = LazyList.addArray(null, arr); @@ -445,7 +445,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NullInput_SingleArray() + public void testAddArrayNullInputSingleArray() { String[] arr = new String[]{"a"}; Object list = LazyList.addArray(null, arr); @@ -462,7 +462,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NullInput_Array() + public void testAddArrayNullInputArray() { String[] arr = new String[]{"a", "b", "c"}; Object list = LazyList.addArray(null, arr); @@ -478,7 +478,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NonListInput_NullArray() + public void testAddArrayNonListInputNullArray() { String input = "z"; String[] arr = null; @@ -496,7 +496,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NonListInput_EmptyArray() + public void testAddArrayNonListInputEmptyArray() { String input = "z"; String[] arr = new String[0]; @@ -514,7 +514,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NonListInput_SingleArray() + public void testAddArrayNonListInputSingleArray() { String input = "z"; String[] arr = new String[]{"a"}; @@ -530,7 +530,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_NonListInput_Array() + public void testAddArrayNonListInputArray() { String input = "z"; String[] arr = new String[]{"a", "b", "c"}; @@ -548,7 +548,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_LazyListInput_NullArray() + public void testAddArrayLazyListInputNullArray() { Object input = LazyList.add(null, "x"); input = LazyList.add(input, "y"); @@ -568,7 +568,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_LazyListInput_EmptyArray() + public void testAddArrayLazyListInputEmptyArray() { Object input = LazyList.add(null, "x"); input = LazyList.add(input, "y"); @@ -588,7 +588,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_LazyListInput_SingleArray() + public void testAddArrayLazyListInputSingleArray() { Object input = LazyList.add(null, "x"); input = LazyList.add(input, "y"); @@ -609,7 +609,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_LazyListInput_Array() + public void testAddArrayLazyListInputArray() { Object input = LazyList.add(null, "x"); input = LazyList.add(input, "y"); @@ -632,7 +632,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_GenericListInput_NullArray() + public void testAddArrayGenericListInputNullArray() { List input = new ArrayList(); input.add("x"); @@ -653,7 +653,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_GenericListInput_EmptyArray() + public void testAddArrayGenericListInputEmptyArray() { List input = new ArrayList(); input.add("x"); @@ -674,7 +674,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_GenericListInput_SingleArray() + public void testAddArrayGenericListInputSingleArray() { List input = new ArrayList(); input.add("x"); @@ -696,7 +696,7 @@ public class LazyListTest * Tests for {@link LazyList#addArray(Object, Object[])} */ @Test - public void testAddArray_GenericListInput_Array() + public void testAddArrayGenericListInputArray() { List input = new ArrayList(); input.add("x"); @@ -720,7 +720,7 @@ public class LazyListTest * Tests for {@link LazyList#ensureSize(Object, int)} */ @Test - public void testEnsureSize_NullInput() + public void testEnsureSizeNullInput() { Object list = LazyList.ensureSize(null, 10); assertNotNull(list); @@ -732,7 +732,7 @@ public class LazyListTest * Tests for {@link LazyList#ensureSize(Object, int)} */ @Test - public void testEnsureSize_NonListInput() + public void testEnsureSizeNonListInput() { String input = "a"; Object list = LazyList.ensureSize(input, 10); @@ -747,7 +747,7 @@ public class LazyListTest * Tests for {@link LazyList#ensureSize(Object, int)} */ @Test - public void testEnsureSize_LazyListInput() + public void testEnsureSizeLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -765,7 +765,7 @@ public class LazyListTest * Tests for {@link LazyList#ensureSize(Object, int)} */ @Test - public void testEnsureSize_GenericListInput() + public void testEnsureSizeGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -784,7 +784,7 @@ public class LazyListTest * Tests for {@link LazyList#ensureSize(Object, int)} */ @Test - public void testEnsureSize_GenericListInput_LinkedList() + public void testEnsureSizeGenericListInputLinkedList() { assumeTrue(STRICT); // Only run in STRICT mode. @@ -807,7 +807,7 @@ public class LazyListTest * Tests for {@link LazyList#ensureSize(Object, int)} */ @Test - public void testEnsureSize_Growth() + public void testEnsureSizeGrowth() { List l = new ArrayList(); l.add("a"); @@ -833,7 +833,7 @@ public class LazyListTest * Tests for {@link LazyList#ensureSize(Object, int)} */ @Test - public void testEnsureSize_Growth_LinkedList() + public void testEnsureSizeGrowthLinkedList() { assumeTrue(STRICT); // Only run in STRICT mode. @@ -864,7 +864,7 @@ public class LazyListTest * Test for {@link LazyList#remove(Object, Object)} */ @Test - public void testRemoveObjectObject_NullInput() + public void testRemoveObjectObjectNullInput() { Object input = null; @@ -878,7 +878,7 @@ public class LazyListTest * Test for {@link LazyList#remove(Object, Object)} */ @Test - public void testRemoveObjectObject_NonListInput() + public void testRemoveObjectObjectNonListInput() { String input = "a"; @@ -911,7 +911,7 @@ public class LazyListTest * Test for {@link LazyList#remove(Object, Object)} */ @Test - public void testRemoveObjectObject_LazyListInput() + public void testRemoveObjectObjectLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -942,7 +942,7 @@ public class LazyListTest * Test for {@link LazyList#remove(Object, Object)} */ @Test - public void testRemoveObjectObject_GenericListInput() + public void testRemoveObjectObjectGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -982,7 +982,7 @@ public class LazyListTest * Test for {@link LazyList#remove(Object, Object)} */ @Test - public void testRemoveObjectObject_LinkedListInput() + public void testRemoveObjectObjectLinkedListInput() { // Should be able to use any collection object. List input = new LinkedList(); @@ -1018,7 +1018,7 @@ public class LazyListTest * Tests for {@link LazyList#remove(Object, int)} */ @Test - public void testRemoveObjectInt_NullInput() + public void testRemoveObjectIntNullInput() { Object input = null; @@ -1031,7 +1031,7 @@ public class LazyListTest * Tests for {@link LazyList#remove(Object, int)} */ @Test - public void testRemoveObjectInt_NonListInput() + public void testRemoveObjectIntNonListInput() { String input = "a"; @@ -1055,7 +1055,7 @@ public class LazyListTest * Tests for {@link LazyList#remove(Object, int)} */ @Test - public void testRemoveObjectInt_LazyListInput() + public void testRemoveObjectIntLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1088,7 +1088,7 @@ public class LazyListTest * Tests for {@link LazyList#remove(Object, int)} */ @Test - public void testRemoveObjectInt_GenericListInput() + public void testRemoveObjectIntGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1127,7 +1127,7 @@ public class LazyListTest * Test for {@link LazyList#getList(Object)} */ @Test - public void testGetListObject_NullInput() + public void testGetListObjectNullInput() { Object input = null; @@ -1141,7 +1141,7 @@ public class LazyListTest * Test for {@link LazyList#getList(Object)} */ @Test - public void testGetListObject_NonListInput() + public void testGetListObjectNonListInput() { String input = "a"; @@ -1155,7 +1155,7 @@ public class LazyListTest * Test for {@link LazyList#getList(Object)} */ @Test - public void testGetListObject_LazyListInput() + public void testGetListObjectLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1174,7 +1174,7 @@ public class LazyListTest * Test for {@link LazyList#getList(Object)} */ @Test - public void testGetListObject_GenericListInput() + public void testGetListObjectGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1194,7 +1194,7 @@ public class LazyListTest * Test for {@link LazyList#getList(Object)} */ @Test - public void testGetListObject_LinkedListInput() + public void testGetListObjectLinkedListInput() { List input = new LinkedList(); input.add("a"); @@ -1214,7 +1214,7 @@ public class LazyListTest * Test for {@link LazyList#getList(Object)} */ @Test - public void testGetListObject_NullForEmpty() + public void testGetListObjectNullForEmpty() { assertNull(LazyList.getList(null, true)); assertNotNull(LazyList.getList(null, false)); @@ -1249,7 +1249,7 @@ public class LazyListTest * Tests for {@link LazyList#toArray(Object, Class)} */ @Test - public void testToArray_NullInput_Object() + public void testToArrayNullInputObject() { Object input = null; @@ -1262,7 +1262,7 @@ public class LazyListTest * Tests for {@link LazyList#toArray(Object, Class)} */ @Test - public void testToArray_NullInput_String() + public void testToArrayNullInputString() { String input = null; @@ -1276,7 +1276,7 @@ public class LazyListTest * Tests for {@link LazyList#toArray(Object, Class)} */ @Test - public void testToArray_NonListInput() + public void testToArrayNonListInput() { String input = "a"; @@ -1294,7 +1294,7 @@ public class LazyListTest * Tests for {@link LazyList#toArray(Object, Class)} */ @Test - public void testToArray_LazyListInput() + public void testToArrayLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1316,7 +1316,7 @@ public class LazyListTest * Tests for {@link LazyList#toArray(Object, Class)} */ @Test - public void testToArray_LazyListInput_Primitives() + public void testToArrayLazyListInputPrimitives() { Object input = LazyList.add(null, 22); input = LazyList.add(input, 333); @@ -1340,7 +1340,7 @@ public class LazyListTest * Tests for {@link LazyList#toArray(Object, Class)} */ @Test - public void testToArray_GenericListInput() + public void testToArrayGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1363,7 +1363,7 @@ public class LazyListTest * Tests for {@link LazyList#size(Object)} */ @Test - public void testSize_NullInput() + public void testSizeNullInput() { assertEquals(0, LazyList.size(null)); } @@ -1372,7 +1372,7 @@ public class LazyListTest * Tests for {@link LazyList#size(Object)} */ @Test - public void testSize_NonListInput() + public void testSizeNonListInput() { String input = "a"; assertEquals(1, LazyList.size(input)); @@ -1382,7 +1382,7 @@ public class LazyListTest * Tests for {@link LazyList#size(Object)} */ @Test - public void testSize_LazyListInput() + public void testSizeLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1398,7 +1398,7 @@ public class LazyListTest * Tests for {@link LazyList#size(Object)} */ @Test - public void testSize_GenericListInput() + public void testSizeGenericListInput() { List input = new ArrayList(); @@ -1418,7 +1418,7 @@ public class LazyListTest * Tests for bad input on {@link LazyList#get(Object, int)} */ @Test - public void testGet_OutOfBounds_NullInput() + public void testGetOutOfBoundsNullInput() { assertThrows(IndexOutOfBoundsException.class, () -> { @@ -1431,7 +1431,7 @@ public class LazyListTest * Tests for bad input on {@link LazyList#get(Object, int)} */ @Test - public void testGet_OutOfBounds_NonListInput() + public void testGetOutOfBoundsNonListInput() { assertThrows(IndexOutOfBoundsException.class, () -> { @@ -1444,7 +1444,7 @@ public class LazyListTest * Tests for bad input on {@link LazyList#get(Object, int)} */ @Test - public void testGet_OutOfBounds_LazyListInput() + public void testGetOutOfBoundsLazyListInput() { assertThrows(IndexOutOfBoundsException.class, () -> { @@ -1457,7 +1457,7 @@ public class LazyListTest * Tests for bad input on {@link LazyList#get(Object, int)} */ @Test - public void testGet_OutOfBounds_GenericListInput() + public void testGetOutOfBoundsGenericListInput() { assertThrows(IndexOutOfBoundsException.class, () -> { @@ -1471,7 +1471,7 @@ public class LazyListTest * Tests for non-list input on {@link LazyList#get(Object, int)} */ @Test - public void testGet_NonListInput() + public void testGetNonListInput() { String input = "a"; assertEquals(LazyList.get(input, 0), "a"); @@ -1481,7 +1481,7 @@ public class LazyListTest * Tests for list input on {@link LazyList#get(Object, int)} */ @Test - public void testGet_LazyListInput() + public void testGetLazyListInput() { Object input = LazyList.add(null, "a"); assertEquals(LazyList.get(input, 0), "a"); @@ -1491,7 +1491,7 @@ public class LazyListTest * Tests for list input on {@link LazyList#get(Object, int)} */ @Test - public void testGet_GenericListInput() + public void testGetGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1513,7 +1513,7 @@ public class LazyListTest * Tests for {@link LazyList#contains(Object, Object)} */ @Test - public void testContains_NullInput() + public void testContainsNullInput() { assertFalse(LazyList.contains(null, "z")); } @@ -1522,7 +1522,7 @@ public class LazyListTest * Tests for {@link LazyList#contains(Object, Object)} */ @Test - public void testContains_NonListInput() + public void testContainsNonListInput() { String input = "a"; assertFalse(LazyList.contains(input, "z")); @@ -1533,7 +1533,7 @@ public class LazyListTest * Tests for {@link LazyList#contains(Object, Object)} */ @Test - public void testContains_LazyListInput() + public void testContainsLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1548,7 +1548,7 @@ public class LazyListTest * Tests for {@link LazyList#contains(Object, Object)} */ @Test - public void testContains_GenericListInput() + public void testContainsGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1564,7 +1564,7 @@ public class LazyListTest * Tests for {@link LazyList#clone(Object)} */ @Test - public void testClone_NullInput() + public void testCloneNullInput() { Object input = null; @@ -1576,7 +1576,7 @@ public class LazyListTest * Tests for {@link LazyList#clone(Object)} */ @Test - public void testClone_NonListInput() + public void testCloneNonListInput() { String input = "a"; @@ -1589,7 +1589,7 @@ public class LazyListTest * Tests for {@link LazyList#clone(Object)} */ @Test - public void testClone_LazyListInput() + public void testCloneLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1609,7 +1609,7 @@ public class LazyListTest * Tests for {@link LazyList#clone(Object)} */ @Test - public void testClone_GenericListInput() + public void testCloneGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1632,7 +1632,7 @@ public class LazyListTest * Tests for {@link LazyList#toString(Object)} */ @Test - public void testToString_NullInput() + public void testToStringNullInput() { Object input = null; assertEquals("[]", LazyList.toString(input)); @@ -1642,7 +1642,7 @@ public class LazyListTest * Tests for {@link LazyList#toString(Object)} */ @Test - public void testToString_NonListInput() + public void testToStringNonListInput() { String input = "a"; assertEquals("[a]", LazyList.toString(input)); @@ -1652,7 +1652,7 @@ public class LazyListTest * Tests for {@link LazyList#toString(Object)} */ @Test - public void testToString_LazyListInput() + public void testToStringLazyListInput() { Object input = LazyList.add(null, "a"); @@ -1668,7 +1668,7 @@ public class LazyListTest * Tests for {@link LazyList#toString(Object)} */ @Test - public void testToString_GenericListInput() + public void testToStringGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1685,7 +1685,7 @@ public class LazyListTest * Tests for {@link LazyList#iterator(Object)} */ @Test - public void testIterator_NullInput() + public void testIteratorNullInput() { Iterator iter = LazyList.iterator(null); assertNotNull(iter); @@ -1696,7 +1696,7 @@ public class LazyListTest * Tests for {@link LazyList#iterator(Object)} */ @Test - public void testIterator_NonListInput() + public void testIteratorNonListInput() { String input = "a"; @@ -1711,7 +1711,7 @@ public class LazyListTest * Tests for {@link LazyList#iterator(Object)} */ @Test - public void testIterator_LazyListInput() + public void testIteratorLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1730,7 +1730,7 @@ public class LazyListTest * Tests for {@link LazyList#iterator(Object)} */ @Test - public void testIterator_GenericListInput() + public void testIteratorGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1750,7 +1750,7 @@ public class LazyListTest * Tests for {@link LazyList#listIterator(Object)} */ @Test - public void testListIterator_NullInput() + public void testListIteratorNullInput() { ListIterator iter = LazyList.listIterator(null); assertNotNull(iter); @@ -1762,7 +1762,7 @@ public class LazyListTest * Tests for {@link LazyList#listIterator(Object)} */ @Test - public void testListIterator_NonListInput() + public void testListIteratorNonListInput() { String input = "a"; @@ -1779,7 +1779,7 @@ public class LazyListTest * Tests for {@link LazyList#listIterator(Object)} */ @Test - public void testListIterator_LazyListInput() + public void testListIteratorLazyListInput() { Object input = LazyList.add(null, "a"); input = LazyList.add(input, "b"); @@ -1804,7 +1804,7 @@ public class LazyListTest * Tests for {@link LazyList#listIterator(Object)} */ @Test - public void testListIterator_GenericListInput() + public void testListIteratorGenericListInput() { List input = new ArrayList(); input.add("a"); @@ -1830,7 +1830,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#asMutableList(Object[])} */ @Test - public void testArray2List_NullInput() + public void testArray2ListNullInput() { Object[] input = null; @@ -1844,7 +1844,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#asMutableList(Object[])} */ @Test - public void testArray2List_EmptyInput() + public void testArray2ListEmptyInput() { String[] input = new String[0]; @@ -1858,7 +1858,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#asMutableList(Object[])} */ @Test - public void testArray2List_SingleInput() + public void testArray2ListSingleInput() { String[] input = new String[]{"a"}; @@ -1873,7 +1873,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#asMutableList(Object[])} */ @Test - public void testArray2List_MultiInput() + public void testArray2ListMultiInput() { String[] input = new String[]{"a", "b", "c"}; @@ -1890,7 +1890,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#asMutableList(Object[])} */ @Test - public void testArray2List_GenericsInput() + public void testArray2ListGenericsInput() { String[] input = new String[]{"a", "b", "c"}; @@ -1908,7 +1908,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#addToArray(Object[], Object, Class)} */ @Test - public void testAddToArray_NullInput_NullItem() + public void testAddToArrayNullInputNullItem() { Object[] input = null; @@ -1929,7 +1929,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#addToArray(Object[], Object, Class)} */ @Test - public void testAddToArray_NullNullNull() + public void testAddToArrayNullNullNull() { // NPE if item && type are both null. assumeTrue(STRICT); @@ -1954,7 +1954,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#addToArray(Object[], Object, Class)} */ @Test - public void testAddToArray_NullInput_SimpleItem() + public void testAddToArrayNullInputSimpleItem() { Object[] input = null; @@ -1974,7 +1974,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#addToArray(Object[], Object, Class)} */ @Test - public void testAddToArray_EmptyInput_NullItem() + public void testAddToArrayEmptyInputNullItem() { String[] input = new String[0]; @@ -1995,7 +1995,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#addToArray(Object[], Object, Class)} */ @Test - public void testAddToArray_EmptyInput_SimpleItem() + public void testAddToArrayEmptyInputSimpleItem() { String[] input = new String[0]; @@ -2009,7 +2009,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#addToArray(Object[], Object, Class)} */ @Test - public void testAddToArray_SingleInput_NullItem() + public void testAddToArraySingleInputNullItem() { String[] input = new String[]{"z"}; @@ -2032,7 +2032,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#addToArray(Object[], Object, Class)} */ @Test - public void testAddToArray_SingleInput_SimpleItem() + public void testAddToArraySingleInputSimpleItem() { String[] input = new String[]{"z"}; @@ -2047,7 +2047,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#removeFromArray(Object[], Object)} */ @Test - public void testRemoveFromArray_NullInput_NullItem() + public void testRemoveFromArrayNullInputNullItem() { Object[] input = null; @@ -2059,7 +2059,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#removeFromArray(Object[], Object)} */ @Test - public void testRemoveFromArray_NullInput_SimpleItem() + public void testRemoveFromArrayNullInputSimpleItem() { Object[] input = null; @@ -2071,7 +2071,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#removeFromArray(Object[], Object)} */ @Test - public void testRemoveFromArray_EmptyInput_NullItem() + public void testRemoveFromArrayEmptyInputNullItem() { String[] input = new String[0]; @@ -2084,7 +2084,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#removeFromArray(Object[], Object)} */ @Test - public void testRemoveFromArray_EmptyInput_SimpleItem() + public void testRemoveFromArrayEmptyInputSimpleItem() { String[] input = new String[0]; @@ -2097,7 +2097,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#removeFromArray(Object[], Object)} */ @Test - public void testRemoveFromArray_SingleInput() + public void testRemoveFromArraySingleInput() { String[] input = new String[]{"a"}; @@ -2116,7 +2116,7 @@ public class LazyListTest * Tests for {@link ArrayUtil#removeFromArray(Object[], Object)} */ @Test - public void testRemoveFromArray_MultiInput() + public void testRemoveFromArrayMultiInput() { String[] input = new String[]{"a", "b", "c"}; diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java index 258605ef101..b32f8a35941 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java @@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class MultiMapTest { /** - * Tests {@link MultiMap#put(Object, Object)} + * Tests {@link MultiMap#put(String, Object)} */ @Test public void testPut() @@ -51,10 +51,10 @@ public class MultiMapTest } /** - * Tests {@link MultiMap#put(Object, Object)} + * Tests {@link MultiMap#put(String, Object)} */ @Test - public void testPut_Null_String() + public void testPutNullString() { MultiMap mm = new MultiMap<>(); @@ -67,10 +67,10 @@ public class MultiMapTest } /** - * Tests {@link MultiMap#put(Object, Object)} + * Tests {@link MultiMap#put(String, Object)} */ @Test - public void testPut_Null_List() + public void testPutNullList() { MultiMap mm = new MultiMap<>(); @@ -83,10 +83,10 @@ public class MultiMapTest } /** - * Tests {@link MultiMap#put(Object, Object)} + * Tests {@link MultiMap#put(String, Object)} */ @Test - public void testPut_Replace() + public void testPutReplace() { MultiMap mm = new MultiMap<>(); @@ -110,7 +110,7 @@ public class MultiMapTest * Tests {@link MultiMap#putValues(String, List)} */ @Test - public void testPutValues_List() + public void testPutValuesList() { MultiMap mm = new MultiMap<>(); @@ -130,7 +130,7 @@ public class MultiMapTest * Tests {@link MultiMap#putValues(String, Object[])} */ @Test - public void testPutValues_StringArray() + public void testPutValuesStringArray() { MultiMap mm = new MultiMap<>(); @@ -146,7 +146,7 @@ public class MultiMapTest * Tests {@link MultiMap#putValues(String, List)} */ @Test - public void testPutValues_VarArgs() + public void testPutValuesVarArgs() { MultiMap mm = new MultiMap<>(); @@ -184,7 +184,7 @@ public class MultiMapTest * Tests {@link MultiMap#addValues(String, List)} */ @Test - public void testAddValues_List() + public void testAddValuesList() { MultiMap mm = new MultiMap<>(); @@ -210,7 +210,7 @@ public class MultiMapTest * Tests {@link MultiMap#addValues(String, List)} */ @Test - public void testAddValues_List_Empty() + public void testAddValuesListEmpty() { MultiMap mm = new MultiMap<>(); @@ -233,7 +233,7 @@ public class MultiMapTest * Tests {@link MultiMap#addValues(String, Object[])} */ @Test - public void testAddValues_StringArray() + public void testAddValuesStringArray() { MultiMap mm = new MultiMap<>(); @@ -256,7 +256,7 @@ public class MultiMapTest * Tests {@link MultiMap#addValues(String, Object[])} */ @Test - public void testAddValues_StringArray_Empty() + public void testAddValuesStringArrayEmpty() { MultiMap mm = new MultiMap<>(); @@ -300,7 +300,7 @@ public class MultiMapTest * Tests {@link MultiMap#removeValue(String, Object)} */ @Test - public void testRemoveValue_InvalidItem() + public void testRemoveValueInvalidItem() { MultiMap mm = new MultiMap<>(); @@ -321,7 +321,7 @@ public class MultiMapTest * Tests {@link MultiMap#removeValue(String, Object)} */ @Test - public void testRemoveValue_AllItems() + public void testRemoveValueAllItems() { MultiMap mm = new MultiMap<>(); @@ -351,7 +351,7 @@ public class MultiMapTest * Tests {@link MultiMap#removeValue(String, Object)} */ @Test - public void testRemoveValue_FromEmpty() + public void testRemoveValueFromEmpty() { MultiMap mm = new MultiMap<>(); @@ -372,7 +372,7 @@ public class MultiMapTest * Tests {@link MultiMap#putAll(java.util.Map)} */ @Test - public void testPutAll_Map() + public void testPutAllMap() { MultiMap mm = new MultiMap<>(); @@ -395,7 +395,7 @@ public class MultiMapTest * Tests {@link MultiMap#putAll(java.util.Map)} */ @Test - public void testPutAll_MultiMap_Simple() + public void testPutAllMultiMapSimple() { MultiMap mm = new MultiMap<>(); @@ -418,7 +418,7 @@ public class MultiMapTest * Tests {@link MultiMap#putAll(java.util.Map)} */ @Test - public void testPutAll_MultiMapComplex() + public void testPutAllMultiMapComplex() { MultiMap mm = new MultiMap<>(); @@ -548,7 +548,7 @@ public class MultiMapTest * Tests {@link MultiMap#containsValue(Object)} */ @Test - public void testContainsValue_LazyList() + public void testContainsValueLazyList() { MultiMap mm = new MultiMap<>(); mm.putValues("food", "apple", "cherry", "raspberry"); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java index b2a2811b46b..64c5315ae6d 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java @@ -504,12 +504,12 @@ public class PathWatcherTest // Files we don't care about Files.createFile(dir.resolve("foo.war.backup")); - String hidden_war = ".hidden.war"; + String hiddenWar = ".hidden.war"; if (org.junit.jupiter.api.condition.OS.WINDOWS.isCurrentOs()) - hidden_war = "hidden.war"; - Files.createFile(dir.resolve(hidden_war)); + hiddenWar = "hidden.war"; + Files.createFile(dir.resolve(hiddenWar)); if (org.junit.jupiter.api.condition.OS.WINDOWS.isCurrentOs()) - Files.setAttribute(dir.resolve(hidden_war), "dos:hidden", Boolean.TRUE); + Files.setAttribute(dir.resolve(hiddenWar), "dos:hidden", Boolean.TRUE); Files.createDirectories(dir.resolve(".wat/WEB-INF")); Files.createFile(dir.resolve(".wat/huh.war")); Files.createFile(dir.resolve(".wat/WEB-INF/web.xml")); @@ -603,7 +603,7 @@ public class PathWatcherTest } @Test - public void testDeployFiles_Update_Delete() throws Exception + public void testDeployFilesUpdateDelete() throws Exception { Path dir = testdir.getEmptyPathDir(); @@ -667,7 +667,7 @@ public class PathWatcherTest } @Test - public void testDeployFiles_NewWar() throws Exception + public void testDeployFilesNewWar() throws Exception { Path dir = testdir.getEmptyPathDir(); @@ -730,7 +730,7 @@ public class PathWatcherTest } @Test - public void testDeployFiles_NewDir() throws Exception + public void testDeployFilesNewDir() throws Exception { Path dir = testdir.getEmptyPathDir(); @@ -922,7 +922,7 @@ public class PathWatcherTest * @throws Exception on test failure */ @Test - public void testDeployFiles_ModifyWar_LargeSlowCopy() throws Exception + public void testDeployFilesModifyWarLargeSlowCopy() throws Exception { Path dir = testdir.getEmptyPathDir(); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/QuotedStringTokenizerTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/QuotedStringTokenizerTest.java index 47fdd1939f2..8445993110c 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/QuotedStringTokenizerTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/QuotedStringTokenizerTest.java @@ -24,9 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -/** - * - */ +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class QuotedStringTokenizerTest { /* @@ -191,9 +189,9 @@ public class QuotedStringTokenizerTest @Test public void testNextTokenOnContentDisposition() { - String content_disposition = "form-data; name=\"fileup\"; filename=\"Taken on Aug 22 \\ 2012.jpg\""; + String contentDisposition = "form-data; name=\"fileup\"; filename=\"Taken on Aug 22 \\ 2012.jpg\""; - QuotedStringTokenizer tok = new QuotedStringTokenizer(content_disposition, ";", false, true); + QuotedStringTokenizer tok = new QuotedStringTokenizer(contentDisposition, ";", false, true); assertEquals("form-data", tok.nextToken().trim()); assertEquals("name=\"fileup\"", tok.nextToken().trim()); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java index 4ab0584f413..75c494fa37a 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java @@ -86,7 +86,7 @@ public class RolloverFileOutputStreamTest * https://github.com/eclipse/jetty.project/issues/1507 */ @Test - public void testMidnightRolloverCalc_PDT_Issue1507() + public void testMidnightRolloverCalcPDTIssue1507() { ZoneId zone = toZoneId("PST"); ZonedDateTime initialDate = toDateTime("2017.04.26-08:00:00.0 PM PDT", zone); @@ -107,7 +107,7 @@ public class RolloverFileOutputStreamTest } @Test - public void testMidnightRolloverCalc_PST_DST_Start() + public void testMidnightRolloverCalcPSTDSTStart() { ZoneId zone = toZoneId("PST"); ZonedDateTime initialDate = toDateTime("2016.03.10-01:23:45.0 PM PST", zone); @@ -127,7 +127,7 @@ public class RolloverFileOutputStreamTest } @Test - public void testMidnightRolloverCalc_PST_DST_End() + public void testMidnightRolloverCalcPSTDSTEnd() { ZoneId zone = toZoneId("PST"); ZonedDateTime initialDate = toDateTime("2016.11.03-11:22:33.0 AM PDT", zone); @@ -147,7 +147,7 @@ public class RolloverFileOutputStreamTest } @Test - public void testMidnightRolloverCalc_Sydney_DST_Start() + public void testMidnightRolloverCalcSydneyDSTStart() { ZoneId zone = toZoneId("Australia/Sydney"); ZonedDateTime initialDate = toDateTime("2016.09.31-01:23:45.0 PM AEST", zone); @@ -167,7 +167,7 @@ public class RolloverFileOutputStreamTest } @Test - public void testMidnightRolloverCalc_Sydney_DST_End() + public void testMidnightRolloverCalcSydneyDSTEnd() { ZoneId zone = toZoneId("Australia/Sydney"); ZonedDateTime initialDate = toDateTime("2016.04.01-11:22:33.0 AM AEDT", zone); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/ScannerTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/ScannerTest.java index 87cb7006871..ced10f27ba9 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/ScannerTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/ScannerTest.java @@ -95,7 +95,7 @@ public class ScannerTest _bulk.add(filenames); } }); - + _scanner.start(); _scanner.scan(); @@ -121,11 +121,11 @@ public class ScannerTest _notification = notification; } } - + @Test public void testDepth() throws Exception { - File root = new File (_directory, "root"); + File root = new File(_directory, "root"); FS.ensureDirExists(root); FS.touch(new File(root, "foo.foo")); FS.touch(new File(root, "foo2.foo")); @@ -141,7 +141,7 @@ public class ScannerTest FS.touch(y1); File y2 = new File(dir2, "yyy2.foo"); FS.touch(y2); - + BlockingQueue queue = new LinkedBlockingQueue(); Scanner scanner = new Scanner(); scanner.setScanInterval(0); @@ -160,7 +160,7 @@ public class ScannerTest @Override public void fileChanged(String filename) throws Exception { - queue.add(new Event(filename, Notification.CHANGED)); + queue.add(new Event(filename, Notification.CHANGED)); } @Override @@ -178,7 +178,7 @@ public class ScannerTest queue.clear(); scanner.stop(); scanner.reset(); - + //Depth one should report the dir itself and its file and dir direct children scanner.setScanDepth(1); scanner.addDirectory(root.toPath()); @@ -187,7 +187,7 @@ public class ScannerTest queue.clear(); scanner.stop(); scanner.reset(); - + //Depth 2 should report the dir itself, all file children, xxx and xxx's children scanner.setScanDepth(2); scanner.addDirectory(root.toPath()); @@ -203,25 +203,25 @@ public class ScannerTest //test include and exclude patterns File root = new File(_directory, "proot"); FS.ensureDirExists(root); - + File ttt = new File(root, "ttt.txt"); FS.touch(ttt); FS.touch(new File(root, "ttt.foo")); File dir = new File(root, "xxx"); FS.ensureDirExists(dir); - + File x1 = new File(dir, "ttt.xxx"); FS.touch(x1); File x2 = new File(dir, "xxx.txt"); FS.touch(x2); - + File dir2 = new File(dir, "yyy"); FS.ensureDirExists(dir2); File y1 = new File(dir2, "ttt.yyy"); FS.touch(y1); File y2 = new File(dir2, "yyy.txt"); FS.touch(y2); - + BlockingQueue queue = new LinkedBlockingQueue(); //only scan the *.txt files for changes Scanner scanner = new Scanner(); @@ -252,7 +252,7 @@ public class ScannerTest queue.add(new Event(filename, Notification.ADDED)); } }); - + scanner.start(); assertTrue(queue.isEmpty()); @@ -281,7 +281,7 @@ public class ScannerTest // takes 2 scans to notice a0 and check that it is stable _scanner.scan(); _scanner.scan(); - + Event event = _queue.poll(); assertNotNull(event, "Event should not be null"); assertEquals(_directory + "/a0", event._filename); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java index a209d05dc64..2e54837b7d3 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/StringUtilTest.java @@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class StringUtilTest { @Test diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java index 09d39fb24cd..cfc2574f851 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java @@ -162,7 +162,7 @@ public class TypeUtilTest } @Test - public void testGetLocationOfClass_FromMavenRepo() throws Exception + public void testGetLocationOfClassFromMavenRepo() throws Exception { String mavenRepoPathProperty = System.getProperty("mavenRepoPath"); assumeTrue(mavenRepoPathProperty != null); @@ -174,7 +174,7 @@ public class TypeUtilTest } @Test - public void getLocationOfClass_ClassDirectory() + public void getLocationOfClassClassDirectory() { // Class from project dependencies assertThat(TypeUtil.getLocationOfClass(TypeUtil.class).toASCIIString(), containsString("/classes/")); @@ -182,7 +182,7 @@ public class TypeUtilTest @Test @DisabledOnJre(JRE.JAVA_8) - public void testGetLocation_JvmCore_JPMS() + public void testGetLocationJvmCoreJPMS() { // Class from JVM core String expectedJavaBase = "/java.base"; @@ -191,7 +191,7 @@ public class TypeUtilTest @Test @DisabledOnJre(JRE.JAVA_8) - public void testGetLocation_JavaLangThreadDeath_JPMS() + public void testGetLocationJavaLangThreadDeathJPMS() { // Class from JVM core String expectedJavaBase = "/java.base"; @@ -200,7 +200,7 @@ public class TypeUtilTest @Test @EnabledOnJre(JRE.JAVA_8) - public void testGetLocation_JvmCore_Java8RT() + public void testGetLocationJvmCoreJava8RT() { // Class from JVM core String expectedJavaBase = "/rt.jar"; @@ -209,7 +209,7 @@ public class TypeUtilTest @Test @EnabledOnJre(JRE.JAVA_8) - public void testGetLocation_JavaLangThreadDeath_Java8RT() + public void testGetLocationJavaLangThreadDeathJava8RT() { // Class from JVM core String expectedJavaBase = "/rt.jar"; diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java index c77f45a8f24..8e40744fa96 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java @@ -66,6 +66,7 @@ public class URIUtilTest public static Stream encodePathSource() { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck return Stream.of( Arguments.of("/foo%23+;,:=/b a r/?info ", "/foo%2523+%3B,:=/b%20a%20r/%3Finfo%20"), Arguments.of("/context/'list'/\"me\"/;", @@ -100,6 +101,7 @@ public class URIUtilTest List arguments = new ArrayList<>(); arguments.add(Arguments.of("/foo/bar", "/foo/bar")); + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck arguments.add(Arguments.of("/f%20o/b%20r", "/f o/b r")); arguments.add(Arguments.of("fää%2523%3b%2c:%3db%20a%20r%3D", "f\u00e4\u00e4%23;,:=b a r=")); arguments.add(Arguments.of("f%d8%a9%d8%a9%2523%3b%2c:%3db%20a%20r", "f\u0629\u0629%23;,:=b a r")); @@ -616,6 +618,7 @@ public class URIUtilTest public static Stream resourceUriLastSegmentSource() { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck return Stream.of( Arguments.of("test.war", "test.war"), Arguments.of("a/b/c/test.war", "test.war"), diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java index 33f4ed5b257..c80fd411275 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/URLEncodedTest.java @@ -39,6 +39,7 @@ import static org.junit.jupiter.api.DynamicTest.dynamicTest; /** * URL Encoding / Decoding Tests */ +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class URLEncodedTest { @TestFactory @@ -48,111 +49,111 @@ public class URLEncodedTest tests.add(dynamicTest("Initially not empty", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - assertEquals(0, url_encoded.size()); + UrlEncoded urlEncoded = new UrlEncoded(); + assertEquals(0, urlEncoded.size()); })); tests.add(dynamicTest("Not empty after decode(\"\")", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode(""); - assertEquals(0, url_encoded.size()); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode(""); + assertEquals(0, urlEncoded.size()); })); tests.add(dynamicTest("Simple encode", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name1=Value1"); - assertEquals(1, url_encoded.size(), "simple param size"); - assertEquals("Name1=Value1", url_encoded.encode(), "simple encode"); - assertEquals("Value1", url_encoded.getString("Name1"), "simple get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name1=Value1"); + assertEquals(1, urlEncoded.size(), "simple param size"); + assertEquals("Name1=Value1", urlEncoded.encode(), "simple encode"); + assertEquals("Value1", urlEncoded.getString("Name1"), "simple get"); })); tests.add(dynamicTest("Dangling param", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name2="); - assertEquals(1, url_encoded.size(), "dangling param size"); - assertEquals("Name2", url_encoded.encode(), "dangling encode"); - assertEquals("", url_encoded.getString("Name2"), "dangling get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name2="); + assertEquals(1, urlEncoded.size(), "dangling param size"); + assertEquals("Name2", urlEncoded.encode(), "dangling encode"); + assertEquals("", urlEncoded.getString("Name2"), "dangling get"); })); tests.add(dynamicTest("noValue param", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name3"); - assertEquals(1, url_encoded.size(), "noValue param size"); - assertEquals("Name3", url_encoded.encode(), "noValue encode"); - assertEquals("", url_encoded.getString("Name3"), "noValue get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name3"); + assertEquals(1, urlEncoded.size(), "noValue param size"); + assertEquals("Name3", urlEncoded.encode(), "noValue encode"); + assertEquals("", urlEncoded.getString("Name3"), "noValue get"); })); tests.add(dynamicTest("badly encoded param", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name4=V\u0629lue+4%21"); - assertEquals(1, url_encoded.size(), "encoded param size"); - assertEquals("Name4=V%D8%A9lue+4%21", url_encoded.encode(), "encoded encode"); - assertEquals("V\u0629lue 4!", url_encoded.getString("Name4"), "encoded get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name4=V\u0629lue+4%21"); + assertEquals(1, urlEncoded.size(), "encoded param size"); + assertEquals("Name4=V%D8%A9lue+4%21", urlEncoded.encode(), "encoded encode"); + assertEquals("V\u0629lue 4!", urlEncoded.getString("Name4"), "encoded get"); })); tests.add(dynamicTest("encoded param 1", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name4=Value%2B4%21"); - assertEquals(1, url_encoded.size(), "encoded param size"); - assertEquals("Name4=Value%2B4%21", url_encoded.encode(), "encoded encode"); - assertEquals("Value+4!", url_encoded.getString("Name4"), "encoded get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name4=Value%2B4%21"); + assertEquals(1, urlEncoded.size(), "encoded param size"); + assertEquals("Name4=Value%2B4%21", urlEncoded.encode(), "encoded encode"); + assertEquals("Value+4!", urlEncoded.getString("Name4"), "encoded get"); })); tests.add(dynamicTest("encoded param 2", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name4=Value+4%21%20%214"); - assertEquals(1, url_encoded.size(), "encoded param size"); - assertEquals("Name4=Value+4%21+%214", url_encoded.encode(), "encoded encode"); - assertEquals("Value 4! !4", url_encoded.getString("Name4"), "encoded get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name4=Value+4%21%20%214"); + assertEquals(1, urlEncoded.size(), "encoded param size"); + assertEquals("Name4=Value+4%21+%214", urlEncoded.encode(), "encoded encode"); + assertEquals("Value 4! !4", urlEncoded.getString("Name4"), "encoded get"); })); tests.add(dynamicTest("multi param", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name5=aaa&Name6=bbb"); - assertEquals(2, url_encoded.size(), "multi param size"); - assertTrue(url_encoded.encode().equals("Name5=aaa&Name6=bbb") || - url_encoded.encode().equals("Name6=bbb&Name5=aaa"), - "multi encode " + url_encoded.encode()); - assertEquals("aaa", url_encoded.getString("Name5"), "multi get"); - assertEquals("bbb", url_encoded.getString("Name6"), "multi get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name5=aaa&Name6=bbb"); + assertEquals(2, urlEncoded.size(), "multi param size"); + assertTrue(urlEncoded.encode().equals("Name5=aaa&Name6=bbb") || + urlEncoded.encode().equals("Name6=bbb&Name5=aaa"), + "multi encode " + urlEncoded.encode()); + assertEquals("aaa", urlEncoded.getString("Name5"), "multi get"); + assertEquals("bbb", urlEncoded.getString("Name6"), "multi get"); })); tests.add(dynamicTest("multiple value encoded", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name7=aaa&Name7=b%2Cb&Name7=ccc"); - assertEquals("Name7=aaa&Name7=b%2Cb&Name7=ccc", url_encoded.encode(), "multi encode"); - assertEquals("aaa,b,b,ccc", url_encoded.getString("Name7"), "list get all"); - assertEquals("aaa", url_encoded.getValues("Name7").get(0), "list get"); - assertEquals("b,b", url_encoded.getValues("Name7").get(1), "list get"); - assertEquals("ccc", url_encoded.getValues("Name7").get(2), "list get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name7=aaa&Name7=b%2Cb&Name7=ccc"); + assertEquals("Name7=aaa&Name7=b%2Cb&Name7=ccc", urlEncoded.encode(), "multi encode"); + assertEquals("aaa,b,b,ccc", urlEncoded.getString("Name7"), "list get all"); + assertEquals("aaa", urlEncoded.getValues("Name7").get(0), "list get"); + assertEquals("b,b", urlEncoded.getValues("Name7").get(1), "list get"); + assertEquals("ccc", urlEncoded.getValues("Name7").get(2), "list get"); })); tests.add(dynamicTest("encoded param", () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.clear(); - url_encoded.decode("Name8=xx%2C++yy++%2Czz"); - assertEquals(1, url_encoded.size(), "encoded param size"); - assertEquals("Name8=xx%2C++yy++%2Czz", url_encoded.encode(), "encoded encode"); - assertEquals("xx, yy ,zz", url_encoded.getString("Name8"), "encoded get"); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.clear(); + urlEncoded.decode("Name8=xx%2C++yy++%2Czz"); + assertEquals(1, urlEncoded.size(), "encoded param size"); + assertEquals("Name8=xx%2C++yy++%2Czz", urlEncoded.encode(), "encoded encode"); + assertEquals("xx, yy ,zz", urlEncoded.getString("Name8"), "encoded get"); })); return tests.iterator(); @@ -229,29 +230,29 @@ public class URLEncodedTest public void testUtf8() throws Exception { - UrlEncoded url_encoded = new UrlEncoded(); - assertEquals(0, url_encoded.size(), "Empty"); + UrlEncoded urlEncoded = new UrlEncoded(); + assertEquals(0, urlEncoded.size(), "Empty"); - url_encoded.clear(); - url_encoded.decode("text=%E0%B8%9F%E0%B8%AB%E0%B8%81%E0%B8%A7%E0%B8%94%E0%B8%B2%E0%B9%88%E0%B8%81%E0%B8%9F%E0%B8%A7%E0%B8%AB%E0%B8%AA%E0%B8%94%E0%B8%B2%E0%B9%88%E0%B8%AB%E0%B8%9F%E0%B8%81%E0%B8%A7%E0%B8%94%E0%B8%AA%E0%B8%B2%E0%B8%9F%E0%B8%81%E0%B8%AB%E0%B8%A3%E0%B8%94%E0%B9%89%E0%B8%9F%E0%B8%AB%E0%B8%99%E0%B8%81%E0%B8%A3%E0%B8%94%E0%B8%B5&Action=Submit"); + urlEncoded.clear(); + urlEncoded.decode("text=%E0%B8%9F%E0%B8%AB%E0%B8%81%E0%B8%A7%E0%B8%94%E0%B8%B2%E0%B9%88%E0%B8%81%E0%B8%9F%E0%B8%A7%E0%B8%AB%E0%B8%AA%E0%B8%94%E0%B8%B2%E0%B9%88%E0%B8%AB%E0%B8%9F%E0%B8%81%E0%B8%A7%E0%B8%94%E0%B8%AA%E0%B8%B2%E0%B8%9F%E0%B8%81%E0%B8%AB%E0%B8%A3%E0%B8%94%E0%B9%89%E0%B8%9F%E0%B8%AB%E0%B8%99%E0%B8%81%E0%B8%A3%E0%B8%94%E0%B8%B5&Action=Submit"); String hex = "E0B89FE0B8ABE0B881E0B8A7E0B894E0B8B2E0B988E0B881E0B89FE0B8A7E0B8ABE0B8AAE0B894E0B8B2E0B988E0B8ABE0B89FE0B881E0B8A7E0B894E0B8AAE0B8B2E0B89FE0B881E0B8ABE0B8A3E0B894E0B989E0B89FE0B8ABE0B899E0B881E0B8A3E0B894E0B8B5"; String expected = new String(TypeUtil.fromHexString(hex), "utf-8"); - assertEquals(expected, url_encoded.getString("text")); + assertEquals(expected, urlEncoded.getString("text")); } @Test - public void testUtf8_MultiByteCodePoint() + public void testUtf8MultiByteCodePoint() { String input = "text=test%C3%A4"; - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.decode(input); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.decode(input); // http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=00e4&mode=hex // Should be "testä" // "test" followed by a LATIN SMALL LETTER A WITH DIAERESIS String expected = "test\u00e4"; - assertThat(url_encoded.getString("text"), is(expected)); + assertThat(urlEncoded.getString("text"), is(expected)); } } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/UrlEncodedInvalidEncodingTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/UrlEncodedInvalidEncodingTest.java index 181a4450859..9a1db2f57ad 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/UrlEncodedInvalidEncodingTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/UrlEncodedInvalidEncodingTest.java @@ -51,8 +51,8 @@ public class UrlEncodedInvalidEncodingTest { assertThrows(expectedThrowable, () -> { - UrlEncoded url_encoded = new UrlEncoded(); - url_encoded.decode(inputString, charset); + UrlEncoded urlEncoded = new UrlEncoded(); + urlEncoded.decode(inputString, charset); }); } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java index a2ec489ac9a..b0c75e39ab9 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java @@ -39,6 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.DynamicTest.dynamicTest; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class Utf8AppendableTest { public static final List> APPENDABLE_IMPLS; @@ -157,7 +158,7 @@ public class Utf8AppendableTest @ParameterizedTest @MethodSource("implementations") - public void testFastFail_1(Class impl) throws Exception + public void testFastFail1(Class impl) throws Exception { byte[] part1 = TypeUtil.fromHexString("cebae1bdb9cf83cebcceb5"); byte[] part2 = TypeUtil.fromHexString("f4908080"); // INVALID @@ -177,7 +178,7 @@ public class Utf8AppendableTest @ParameterizedTest @MethodSource("implementations") - public void testFastFail_2(Class impl) throws Exception + public void testFastFail2(Class impl) throws Exception { byte[] part1 = TypeUtil.fromHexString("cebae1bdb9cf83cebcceb5f4"); byte[] part2 = TypeUtil.fromHexString("90"); // INVALID @@ -197,7 +198,7 @@ public class Utf8AppendableTest @ParameterizedTest @MethodSource("implementations") - public void testPartial_UnsplitCodepoint(Class impl) throws Exception + public void testPartialUnsplitCodepoint(Class impl) throws Exception { Utf8Appendable utf8 = impl.getDeclaredConstructor().newInstance(); @@ -216,7 +217,7 @@ public class Utf8AppendableTest @ParameterizedTest @MethodSource("implementations") - public void testPartial_SplitCodepoint(Class impl) throws Exception + public void testPartialSplitCodepoint(Class impl) throws Exception { Utf8Appendable utf8 = impl.getDeclaredConstructor().newInstance(); @@ -235,7 +236,7 @@ public class Utf8AppendableTest @ParameterizedTest @MethodSource("implementations") - public void testPartial_SplitCodepoint_WithNoBuf(Class impl) throws Exception + public void testPartialSplitCodepointWithNoBuf(Class impl) throws Exception { Utf8Appendable utf8 = impl.getDeclaredConstructor().newInstance(); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerNestedTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerNestedTest.java index 16c0f4158fb..bad8ee1c56a 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerNestedTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/component/LifeCycleListenerNestedTest.java @@ -176,7 +176,7 @@ public class LifeCycleListenerNestedTest } @Test - public void testAddBean_AddListener_Start() throws Exception + public void testAddBeanAddListenerStart() throws Exception { Foo foo = new Foo(); Bar bara = new Bar("a"); @@ -211,7 +211,7 @@ public class LifeCycleListenerNestedTest } @Test - public void testAddListener_AddBean_Start() throws Exception + public void testAddListenerAddBeanStart() throws Exception { Foo foo = new Foo(); @@ -247,7 +247,7 @@ public class LifeCycleListenerNestedTest } @Test - public void testAddListener_Start_AddBean() throws Exception + public void testAddListenerStartAddBean() throws Exception { Foo foo = new Foo(); Bar bara = new Bar("a"); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java index b93f93ec2f2..4a7cc49bcbb 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/LogTest.java @@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class LogTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck private static Logger originalLogger; private static Map originalLoggers; @@ -62,7 +63,7 @@ public class LogTest } @Test - public void testNamedLogNamed_StdErrLog() + public void testNamedLogNamedStdErrLog() { Log.setLog(new StdErrLog()); @@ -72,7 +73,7 @@ public class LogTest } @Test - public void testNamedLogNamed_JUL() + public void testNamedLogNamedJUL() { Log.setLog(new JavaUtilLog()); @@ -82,7 +83,7 @@ public class LogTest } @Test - public void testNamedLogNamed_Slf4J() throws Exception + public void testNamedLogNamedSlf4J() throws Exception { Log.setLog(new Slf4jLog()); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java index aa007c7404b..38dc6a9d88d 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java @@ -168,7 +168,7 @@ public class StdErrLogTest * @throws Exception failed test */ @Test - public void testParameterizedMessage_NullValues() throws Exception + public void testParameterizedMessageNullValues() throws Exception { StdErrLog log = new StdErrLog(StdErrLogTest.class.getName(), new Properties()); log.setLevel(StdErrLog.LEVEL_DEBUG); @@ -204,7 +204,7 @@ public class StdErrLogTest } @Test - public void testGetLoggingLevel_Default() + public void testGetLoggingLevelDefault() { Properties props = new Properties(); @@ -216,7 +216,7 @@ public class StdErrLogTest } @Test - public void testGetLoggingLevel_Bad() + public void testGetLoggingLevelBad() { Properties props = new Properties(); props.setProperty("log.LEVEL", "WARN"); @@ -227,7 +227,7 @@ public class StdErrLogTest } @Test - public void testGetLoggingLevel_Lowercase() + public void testGetLoggingLevelLowercase() { Properties props = new Properties(); props.setProperty("log.LEVEL", "warn"); @@ -240,7 +240,7 @@ public class StdErrLogTest } @Test - public void testGetLoggingLevel_Root() + public void testGetLoggingLevelRoot() { Properties props = new Properties(); props.setProperty("log.LEVEL", "DEBUG"); @@ -253,7 +253,7 @@ public class StdErrLogTest } @Test - public void testGetLoggingLevel_FQCN() + public void testGetLoggingLevelFQCN() { String name = StdErrLogTest.class.getName(); Properties props = new Properties(); @@ -269,7 +269,7 @@ public class StdErrLogTest } @Test - public void testGetLoggingLevel_UtilLevel() + public void testGetLoggingLevelUtilLevel() { Properties props = new Properties(); props.setProperty("org.eclipse.jetty.util.LEVEL", "DEBUG"); @@ -288,7 +288,7 @@ public class StdErrLogTest } @Test - public void testGetLoggingLevel_MixedLevels() + public void testGetLoggingLevelMixedLevels() { Properties props = new Properties(); props.setProperty("log.LEVEL", "DEBUG"); @@ -562,7 +562,7 @@ public class StdErrLogTest } @Test - public void testGetChildLogger_Simple() + public void testGetChildLoggerSimple() { String baseName = "jetty"; StdErrLog log = new StdErrLog(baseName, new Properties()); @@ -576,7 +576,7 @@ public class StdErrLogTest } @Test - public void testGetChildLogger_Deep() + public void testGetChildLoggerDeep() { String baseName = "jetty"; StdErrLog log = new StdErrLog(baseName, new Properties()); @@ -590,7 +590,7 @@ public class StdErrLogTest } @Test - public void testGetChildLogger_Null() + public void testGetChildLoggerNull() { String baseName = "jetty"; StdErrLog log = new StdErrLog(baseName, new Properties()); @@ -606,7 +606,7 @@ public class StdErrLogTest } @Test - public void testGetChildLogger_EmptyName() + public void testGetChildLoggerEmptyName() { String baseName = "jetty"; StdErrLog log = new StdErrLog(baseName, new Properties()); @@ -622,7 +622,7 @@ public class StdErrLogTest } @Test - public void testGetChildLogger_EmptyNameSpaces() + public void testGetChildLoggerEmptyNameSpaces() { String baseName = "jetty"; StdErrLog log = new StdErrLog(baseName, new Properties()); @@ -638,7 +638,7 @@ public class StdErrLogTest } @Test - public void testGetChildLogger_NullParent() + public void testGetChildLoggerNullParent() { AbstractLogger log = new StdErrLog(null, new Properties()); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java index 97a44a7825d..05e86a686b9 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java @@ -229,7 +229,7 @@ public class FileSystemResourceTest @ParameterizedTest @EnabledOnOs(WINDOWS) @MethodSource("fsResourceProvider") - public void testBogusFilename_Windows(Class resourceClass) + public void testBogusFilenameWindows(Class resourceClass) { // "CON" is a reserved name under windows assertThrows(IllegalArgumentException.class, @@ -239,7 +239,7 @@ public class FileSystemResourceTest @ParameterizedTest @EnabledOnOs({LINUX, MAC}) @MethodSource("fsResourceProvider") - public void testBogusFilename_Unix(Class resourceClass) + public void testBogusFilenameUnix(Class resourceClass) { // A windows path is invalid under unix assertThrows(IllegalArgumentException.class, @@ -248,7 +248,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testNewResource_WithSpace(Class resourceClass) throws Exception + public void testNewResourceWithSpace(Class resourceClass) throws Exception { Path dir = workDir.getPath().normalize().toRealPath(); @@ -437,7 +437,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testLastModified_NotExists(Class resourceClass) throws Exception + public void testLastModifiedNotExists(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); @@ -469,7 +469,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testLength_NotExists(Class resourceClass) throws Exception + public void testLengthNotExists(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); Files.createDirectories(dir); @@ -504,7 +504,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testDelete_NotExists(Class resourceClass) throws Exception + public void testDeleteNotExists(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); Files.createDirectories(dir); @@ -1158,7 +1158,7 @@ public class FileSystemResourceTest */ @ParameterizedTest @MethodSource("fsResourceProvider") - public void testExist_Normal(Class resourceClass) throws Exception + public void testExistNormal(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); Files.createDirectories(dir); @@ -1239,7 +1239,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testExist_BadURINull(Class resourceClass) throws Exception + public void testExistBadURINull(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); Files.createDirectories(dir); @@ -1266,7 +1266,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testExist_BadURINullX(Class resourceClass) throws Exception + public void testExistBadURINullX(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); Files.createDirectories(dir); @@ -1293,7 +1293,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testAddPath_WindowsSlash(Class resourceClass) throws Exception + public void testAddPathWindowsSlash(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); Files.createDirectories(dir); @@ -1334,7 +1334,7 @@ public class FileSystemResourceTest @ParameterizedTest @MethodSource("fsResourceProvider") - public void testAddPath_WindowsExtensionLess(Class resourceClass) throws Exception + public void testAddPathWindowsExtensionLess(Class resourceClass) throws Exception { Path dir = workDir.getEmptyPathDir(); Files.createDirectories(dir); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JarResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JarResourceTest.java index b587b7a9c44..db944868ea5 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JarResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JarResourceTest.java @@ -219,7 +219,7 @@ public class JarResourceTest * Where the JAR entries contain names that are URI encoded / escaped */ @Test - public void testJarFileResourceList_PreEncodedEntries() throws Exception + public void testJarFileResourceListPreEncodedEntries() throws Exception { Path testJar = MavenTestingUtils.getTestResourcePathFile("jar-file-resource.jar"); String uri = "jar:" + testJar.toUri().toASCIIString() + "!/"; @@ -243,7 +243,7 @@ public class JarResourceTest } @Test - public void testJarFileResourceList_DirWithSpace() throws Exception + public void testJarFileResourceListDirWithSpace() throws Exception { Path testJar = MavenTestingUtils.getTestResourcePathFile("jar-file-resource.jar"); String uri = "jar:" + testJar.toUri().toASCIIString() + "!/"; diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java index 052fb5ed27c..c755fddfcb7 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java @@ -41,8 +41,8 @@ public class JrtResourceTest public void testResourceFromUriForString() throws Exception { - URI string_loc = TypeUtil.getLocationOfClass(String.class); - Resource resource = Resource.newResource(string_loc); + URI stringLoc = TypeUtil.getLocationOfClass(String.class); + Resource resource = Resource.newResource(stringLoc); assertThat(resource.exists(), is(true)); assertThat(resource.isDirectory(), is(false)); @@ -58,8 +58,8 @@ public class JrtResourceTest public void testResourceFromStringForString() throws Exception { - URI string_loc = TypeUtil.getLocationOfClass(String.class); - Resource resource = Resource.newResource(string_loc.toASCIIString()); + URI stringLoc = TypeUtil.getLocationOfClass(String.class); + Resource resource = Resource.newResource(stringLoc.toASCIIString()); assertThat(resource.exists(), is(true)); assertThat(resource.isDirectory(), is(false)); @@ -75,8 +75,8 @@ public class JrtResourceTest public void testResourceFromURLForString() throws Exception { - URI string_loc = TypeUtil.getLocationOfClass(String.class); - Resource resource = Resource.newResource(string_loc.toURL()); + URI stringLoc = TypeUtil.getLocationOfClass(String.class); + Resource resource = Resource.newResource(stringLoc.toURL()); assertThat(resource.exists(), is(true)); assertThat(resource.isDirectory(), is(false)); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/PathResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/PathResourceTest.java index cf6acf581fb..e570669f532 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/PathResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/PathResourceTest.java @@ -43,7 +43,7 @@ import static org.hamcrest.Matchers.nullValue; public class PathResourceTest { @Test - public void testNonDefaultFileSystem_GetInputStream() throws URISyntaxException, IOException + public void testNonDefaultFileSystemGetInputStream() throws URISyntaxException, IOException { Path exampleJar = MavenTestingUtils.getTestResourcePathFile("example.jar"); @@ -67,7 +67,7 @@ public class PathResourceTest } @Test - public void testNonDefaultFileSystem_GetReadableByteChannel() throws URISyntaxException, IOException + public void testNonDefaultFileSystemGetReadableByteChannel() throws URISyntaxException, IOException { Path exampleJar = MavenTestingUtils.getTestResourcePathFile("example.jar"); @@ -91,7 +91,7 @@ public class PathResourceTest } @Test - public void testNonDefaultFileSystem_GetFile() throws URISyntaxException, IOException + public void testNonDefaultFileSystemGetFile() throws URISyntaxException, IOException { Path exampleJar = MavenTestingUtils.getTestResourcePathFile("example.jar"); @@ -112,7 +112,7 @@ public class PathResourceTest } @Test - public void testNonDefaultFileSystem_WriteTo() throws URISyntaxException, IOException + public void testNonDefaultFileSystemWriteTo() throws URISyntaxException, IOException { Path exampleJar = MavenTestingUtils.getTestResourcePathFile("example.jar"); @@ -138,7 +138,7 @@ public class PathResourceTest } @Test - public void testDefaultFileSystem_GetFile() throws Exception + public void testDefaultFileSystemGetFile() throws Exception { Path exampleJar = MavenTestingUtils.getTestResourcePathFile("example.jar"); PathResource resource = new PathResource(exampleJar); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java index cd9a6b906ea..76df9ef6190 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceCollectionTest.java @@ -43,7 +43,7 @@ public class ResourceCollectionTest public WorkDir workdir; @Test - public void testUnsetCollection_ThrowsISE() + public void testUnsetCollectionThrowsISE() { ResourceCollection coll = new ResourceCollection(); @@ -51,7 +51,7 @@ public class ResourceCollectionTest } @Test - public void testEmptyResourceArray_ThrowsISE() + public void testEmptyResourceArrayThrowsISE() { ResourceCollection coll = new ResourceCollection(new Resource[0]); @@ -59,7 +59,7 @@ public class ResourceCollectionTest } @Test - public void testResourceArrayWithNull_ThrowsISE() + public void testResourceArrayWithNullThrowsISE() { ResourceCollection coll = new ResourceCollection(new Resource[]{null}); @@ -67,7 +67,7 @@ public class ResourceCollectionTest } @Test - public void testEmptyStringArray_ThrowsISE() + public void testEmptyStringArrayThrowsISE() { ResourceCollection coll = new ResourceCollection(new String[0]); @@ -75,14 +75,14 @@ public class ResourceCollectionTest } @Test - public void testStringArrayWithNull_ThrowsIAE() + public void testStringArrayWithNullThrowsIAE() { assertThrows(IllegalArgumentException.class, () -> new ResourceCollection(new String[]{null})); } @Test - public void testNullCsv_ThrowsIAE() + public void testNullCsvThrowsIAE() { assertThrows(IllegalArgumentException.class, () -> { @@ -92,7 +92,7 @@ public class ResourceCollectionTest } @Test - public void testEmptyCsv_ThrowsIAE() + public void testEmptyCsvThrowsIAE() { assertThrows(IllegalArgumentException.class, () -> { @@ -102,7 +102,7 @@ public class ResourceCollectionTest } @Test - public void testBlankCsv_ThrowsIAE() + public void testBlankCsvThrowsIAE() { assertThrows(IllegalArgumentException.class, () -> { @@ -112,7 +112,7 @@ public class ResourceCollectionTest } @Test - public void testSetResourceNull_ThrowsISE() + public void testSetResourceNullThrowsISE() { // Create a ResourceCollection with one valid entry Path path = MavenTestingUtils.getTargetPath(); @@ -126,7 +126,7 @@ public class ResourceCollectionTest } @Test - public void testSetResourceEmpty_ThrowsISE() + public void testSetResourceEmptyThrowsISE() { // Create a ResourceCollection with one valid entry Path path = MavenTestingUtils.getTargetPath(); @@ -140,7 +140,7 @@ public class ResourceCollectionTest } @Test - public void testSetResourceAllNulls_ThrowsISE() + public void testSetResourceAllNullsThrowsISE() { // Create a ResourceCollection with one valid entry Path path = MavenTestingUtils.getTargetPath(); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/security/PasswordTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/security/PasswordTest.java index 4c0bf457c7a..65f1ea29445 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/security/PasswordTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/security/PasswordTest.java @@ -44,6 +44,7 @@ public class PasswordTest @Test public void testObfuscateUnicode() { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck String password = "secret password !#\u20ac "; String obfuscate = Password.obfuscate(password); assertEquals(password, Password.deobfuscate(obfuscate)); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java index e2ea299b0ad..d676dcbb77e 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/SslContextFactoryTest.java @@ -90,7 +90,7 @@ public class SslContextFactoryTest } @Test - public void testDump_IncludeTlsRsa() throws Exception + public void testDumpIncludeTlsRsa() throws Exception { cf.setKeyStorePassword("storepwd"); cf.setKeyManagerPassword("keypwd"); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/X509Test.java b/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/X509Test.java index 7258361acb6..9e97d652463 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/X509Test.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/ssl/X509Test.java @@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; public class X509Test { @Test - public void testIsCertSign_Normal() + public void testIsCertSignNormal() { X509Certificate bogusX509 = new X509CertificateAdapter() { @@ -51,7 +51,7 @@ public class X509Test } @Test - public void testIsCertSign_Normal_NoSupported() + public void testIsCertSignNormalNoSupported() { X509Certificate bogusX509 = new X509CertificateAdapter() { @@ -68,7 +68,7 @@ public class X509Test } @Test - public void testIsCertSign_NonStandard_Short() + public void testIsCertSignNonStandardShort() { X509Certificate bogusX509 = new X509CertificateAdapter() { @@ -85,7 +85,7 @@ public class X509Test } @Test - public void testIsCertSign_NonStandard_Shorter() + public void testIsCertSignNonStandardShorter() { X509Certificate bogusX509 = new X509CertificateAdapter() { @@ -101,7 +101,7 @@ public class X509Test } @Test - public void testIsCertSign_Normal_Null() + public void testIsCertSignNormalNull() { X509Certificate bogusX509 = new X509CertificateAdapter() { @@ -116,7 +116,7 @@ public class X509Test } @Test - public void testIsCertSign_Normal_Empty() + public void testIsCertSignNormalEmpty() { X509Certificate bogusX509 = new X509CertificateAdapter() { @@ -131,7 +131,7 @@ public class X509Test } @Test - public void testBaseClass_WithSni() + public void testBaseClassWithSni() { SslContextFactory baseSsl = new SslContextFactory(); Path keystorePath = MavenTestingUtils.getTestResourcePathFile("keystore_sni.p12"); @@ -143,7 +143,7 @@ public class X509Test } @Test - public void testServerClass_WithSni() throws Exception + public void testServerClassWithSni() throws Exception { SslContextFactory serverSsl = new SslContextFactory.Server(); Path keystorePath = MavenTestingUtils.getTestResourcePathFile("keystore_sni.p12"); @@ -154,7 +154,7 @@ public class X509Test } @Test - public void testClientClass_WithSni() throws Exception + public void testClientClassWithSni() throws Exception { SslContextFactory clientSsl = new SslContextFactory.Client(); Path keystorePath = MavenTestingUtils.getTestResourcePathFile("keystore_sni.p12"); @@ -165,7 +165,7 @@ public class X509Test } @Test - public void testBaseClass_WithoutSni() throws Exception + public void testBaseClassWithoutSni() throws Exception { SslContextFactory baseSsl = new SslContextFactory(); Resource keystoreResource = Resource.newSystemResource("keystore"); @@ -176,7 +176,7 @@ public class X509Test } @Test - public void testServerClass_WithoutSni() throws Exception + public void testServerClassWithoutSni() throws Exception { SslContextFactory serverSsl = new SslContextFactory.Server(); Resource keystoreResource = Resource.newSystemResource("keystore"); @@ -187,7 +187,7 @@ public class X509Test } @Test - public void testClientClass_WithoutSni() throws Exception + public void testClientClassWithoutSni() throws Exception { SslContextFactory clientSsl = new SslContextFactory.Client(); Resource keystoreResource = Resource.newSystemResource("keystore"); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/AbstractThreadPoolTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/AbstractThreadPoolTest.java index a79e15a3103..cfdd556f063 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/AbstractThreadPoolTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/AbstractThreadPoolTest.java @@ -47,7 +47,7 @@ public abstract class AbstractThreadPoolTest protected abstract SizedThreadPool newPool(int max); @Test - public void testBudget_constructMaxThenLease() + public void testBudgetConstructMaxThenLease() { SizedThreadPool pool = newPool(4); @@ -67,7 +67,7 @@ public abstract class AbstractThreadPoolTest } @Test - public void testBudget_LeaseThenSetMax() + public void testBudgetLeaseThenSetMax() { SizedThreadPool pool = newPool(4); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java index 6c771ffdb12..d3e5c5170ef 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java @@ -516,7 +516,7 @@ public class QueuedThreadPoolTest extends AbstractThreadPoolTest { latch.await(); } - catch(InterruptedException e) + catch (InterruptedException e) { e.printStackTrace(); } @@ -534,7 +534,9 @@ public class QueuedThreadPoolTest extends AbstractThreadPoolTest waitForThreads(tp, 2); for (int i = 0; i < 10; i++) + { tp.execute(job); + } waitForThreads(tp, 10); int threads = tp.getThreads(); diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java index 534a6ac108c..eabdf4eeb05 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java @@ -133,13 +133,13 @@ public class ClasspathPatternTest public void testIncludedLocations() throws Exception { // jar from JVM classloader - URI loc_string = TypeUtil.getLocationOfClass(String.class); + URI locString = TypeUtil.getLocationOfClass(String.class); // a jar from maven repo jar - URI loc_junit = TypeUtil.getLocationOfClass(Test.class); + URI locJunit = TypeUtil.getLocationOfClass(Test.class); // class file - URI loc_test = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); + URI locTest = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); ClasspathPattern pattern = new ClasspathPattern(); pattern.include("something"); @@ -148,10 +148,10 @@ public class ClasspathPatternTest assertThat(pattern.match(ClasspathPatternTest.class), Matchers.is(false)); // Add directory for both JVM classes - pattern.include(loc_string.toASCIIString()); + pattern.include(locString.toASCIIString()); // Add jar for individual class and classes directory - pattern.include(loc_junit.toString(), loc_test.toString()); + pattern.include(locJunit.toString(), locTest.toString()); assertThat(pattern.match(String.class), Matchers.is(true)); assertThat(pattern.match(Test.class), Matchers.is(true)); @@ -166,18 +166,18 @@ public class ClasspathPatternTest @SuppressWarnings("restriction") @Test @DisabledOnJre(JRE.JAVA_8) - public void testIncludedLocationsOrModule() throws Exception + public void testIncludedLocationsOrModule() { // jar from JVM classloader - URI mod_string = TypeUtil.getLocationOfClass(String.class); + URI modString = TypeUtil.getLocationOfClass(String.class); // System.err.println(mod_string); // a jar from maven repo jar - URI loc_junit = TypeUtil.getLocationOfClass(Test.class); + URI locJunit = TypeUtil.getLocationOfClass(Test.class); // System.err.println(loc_junit); // class file - URI loc_test = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); + URI locTest = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); // System.err.println(loc_test); ClasspathPattern pattern = new ClasspathPattern(); @@ -190,7 +190,7 @@ public class ClasspathPatternTest pattern.include("jrt:/java.base"); // Add jar for individual class and classes directory - pattern.include(loc_junit.toString(), loc_test.toString()); + pattern.include(locJunit.toString(), locTest.toString()); assertThat(pattern.match(String.class), Matchers.is(true)); assertThat(pattern.match(Test.class), Matchers.is(true)); @@ -205,19 +205,19 @@ public class ClasspathPatternTest @SuppressWarnings("restriction") @Test @EnabledOnJre(JRE.JAVA_8) - public void testExcludeLocations() throws Exception + public void testExcludeLocations() { // jar from JVM classloader - URI loc_string = TypeUtil.getLocationOfClass(String.class); - // System.err.println(loc_string); + URI locString = TypeUtil.getLocationOfClass(String.class); + // System.err.println(locString); // a jar from maven repo jar - URI loc_junit = TypeUtil.getLocationOfClass(Test.class); - // System.err.println(loc_junit); + URI locJunit = TypeUtil.getLocationOfClass(Test.class); + // System.err.println(locJunit); // class file - URI loc_test = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); - // System.err.println(loc_test); + URI locTest = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); + // System.err.println(locTest); ClasspathPattern pattern = new ClasspathPattern(); @@ -229,10 +229,10 @@ public class ClasspathPatternTest assertThat(pattern.match(ClasspathPatternTest.class), Matchers.is(true)); // Add directory for both JVM classes - pattern.exclude(loc_string.toString()); + pattern.exclude(locString.toString()); // Add jar for individual class and classes directory - pattern.exclude(loc_junit.toString(), loc_test.toString()); + pattern.exclude(locJunit.toString(), locTest.toString()); assertThat(pattern.match(String.class), Matchers.is(false)); assertThat(pattern.match(Test.class), Matchers.is(false)); @@ -245,16 +245,16 @@ public class ClasspathPatternTest public void testExcludeLocationsOrModule() throws Exception { // jar from JVM classloader - URI mod_string = TypeUtil.getLocationOfClass(String.class); - // System.err.println(mod_string); + URI modString = TypeUtil.getLocationOfClass(String.class); + // System.err.println(modString); // a jar from maven repo jar - URI loc_junit = TypeUtil.getLocationOfClass(Test.class); - // System.err.println(loc_junit); + URI locJunit = TypeUtil.getLocationOfClass(Test.class); + // System.err.println(locJunit); // class file - URI loc_test = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); - // System.err.println(loc_test); + URI locTest = TypeUtil.getLocationOfClass(ClasspathPatternTest.class); + // System.err.println(locTest); ClasspathPattern pattern = new ClasspathPattern(); @@ -269,7 +269,7 @@ public class ClasspathPatternTest pattern.exclude("jrt:/java.base/"); // Add jar for individual class and classes directory - pattern.exclude(loc_junit.toString(), loc_test.toString()); + pattern.exclude(locJunit.toString(), locTest.toString()); assertThat(pattern.match(String.class), Matchers.is(false)); assertThat(pattern.match(Test.class), Matchers.is(false)); diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/HugeResourceTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/HugeResourceTest.java index 56467b70951..4c75b95bd17 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/HugeResourceTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/HugeResourceTest.java @@ -263,7 +263,7 @@ public class HugeResourceTest @ParameterizedTest @MethodSource("staticFiles") - public void testUpload_Multipart(String filename, long expectedSize) throws Exception + public void testUploadMultipart(String filename, long expectedSize) throws Exception { MultiPartContentProvider multipart = new MultiPartContentProvider(); Path inputFile = staticBase.resolve(filename); diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebInfConfigurationTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebInfConfigurationTest.java index 4267b68b7e1..d5a3c20a738 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebInfConfigurationTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebInfConfigurationTest.java @@ -151,6 +151,7 @@ public class WebInfConfigurationTest Arguments.of("another one/bites the dust/", "bites the dust"), Arguments.of("another+one/bites+the+dust/", "bites+the+dust"), Arguments.of("another%20one/bites%20the%20dust/", "bites%20the%20dust"), + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck Arguments.of("spanish/n\u00FAmero.war", "n\u00FAmero.war"), Arguments.of("spanish/n%C3%BAmero.war", "n%C3%BAmero.war"), Arguments.of("a/b!/", "b!"), diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java index 396f41ab9ae..14b81798dce 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java @@ -78,7 +78,7 @@ public class LargeMessageTest @SuppressWarnings("Duplicates") @Test - public void testLargeEcho_AsEndpointInstance() throws Exception + public void testLargeEchoAsEndpointInstance() throws Exception { WebSocketContainer container = ContainerProvider.getWebSocketContainer(); server.addBean(container); // allow to shutdown with server diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_GoodSignaturesTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScannerGoodSignaturesTest.java similarity index 98% rename from jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_GoodSignaturesTest.java rename to jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScannerGoodSignaturesTest.java index f4b839cb013..3163dfb26ce 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_GoodSignaturesTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScannerGoodSignaturesTest.java @@ -62,7 +62,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * Test {@link AnnotatedEndpointScanner} against various valid, simple, 1 method {@link ClientEndpoint} annotated classes with valid signatures. */ -public class ClientAnnotatedEndpointScanner_GoodSignaturesTest +public class ClientAnnotatedEndpointScannerGoodSignaturesTest { private static ClientContainer container = new ClientContainer(); @@ -115,7 +115,7 @@ public class ClientAnnotatedEndpointScanner_GoodSignaturesTest @ParameterizedTest @MethodSource("scenarios") - public void testScan_Basic(Scenario scenario) throws Exception + public void testScanBasic(Scenario scenario) throws Exception { AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container, scenario.pojo); AnnotatedEndpointScanner scanner = new AnnotatedEndpointScanner<>(metadata); diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScannerInvalidSignaturesTest.java similarity index 96% rename from jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java rename to jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScannerInvalidSignaturesTest.java index 8af4fbf28ca..41d4ec1485e 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScannerInvalidSignaturesTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; /** * Test {@link AnnotatedEndpointScanner} against various simple, 1 method, {@link ClientEndpoint} annotated classes with invalid signatures. */ -public class ClientAnnotatedEndpointScanner_InvalidSignaturesTest +public class ClientAnnotatedEndpointScannerInvalidSignaturesTest { private static ClientContainer container = new ClientContainer(); @@ -76,7 +76,7 @@ public class ClientAnnotatedEndpointScanner_InvalidSignaturesTest @ParameterizedTest @MethodSource("scenarios") - public void testScan_InvalidSignature(Class pojo, Class expectedAnnoClass) + public void testScanInvalidSignature(Class pojo, Class expectedAnnoClass) { AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container, pojo); AnnotatedEndpointScanner scanner = new AnnotatedEndpointScanner<>(metadata); diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/metadata/EncoderMetadataSetTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/metadata/EncoderMetadataSetTest.java index a1a915483fe..92ea614d28b 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/metadata/EncoderMetadataSetTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/metadata/EncoderMetadataSetTest.java @@ -115,9 +115,9 @@ public class EncoderMetadataSetTest coders.add(ValidDualEncoder.class); - List> EncodersList = coders.getList(); - assertThat("Encoder List", EncodersList, notNullValue()); - assertThat("Encoder List count", EncodersList.size(), is(2)); + List> encodersList = coders.getList(); + assertThat("Encoder List", encodersList, notNullValue()); + assertThat("Encoder List count", encodersList.size(), is(2)); EncoderMetadata metadata; metadata = coders.getMetadataByType(Integer.class); diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/ReflectUtilsTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/ReflectUtilsTest.java index 74571a169b4..a0db6915aa0 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/ReflectUtilsTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/ReflectUtilsTest.java @@ -80,49 +80,49 @@ public class ReflectUtilsTest } @Test - public void testFindGeneric_PearFruit() + public void testFindGenericPearFruit() { assertFindGenericClass(Pear.class, Fruit.class, String.class); } @Test - public void testFindGeneric_PizzaFruit() + public void testFindGenericPizzaFruit() { assertFindGenericClass(Pizza.class, Fruit.class, Integer.class); } @Test - public void testFindGeneric_KiwiFruit() + public void testFindGenericKiwiFruit() { assertFindGenericClass(Kiwi.class, Fruit.class, Character.class); } @Test - public void testFindGeneric_PearColor() + public void testFindGenericPearColor() { assertFindGenericClass(Pear.class, Color.class, Double.class); } @Test - public void testFindGeneric_GrannySmithFruit() + public void testFindGenericGrannySmithFruit() { assertFindGenericClass(GrannySmith.class, Fruit.class, Long.class); } @Test - public void testFindGeneric_CavendishFruit() + public void testFindGenericCavendishFruit() { assertFindGenericClass(Cavendish.class, Fruit.class, String.class); } @Test - public void testFindGeneric_RainierFruit() + public void testFindGenericRainierFruit() { assertFindGenericClass(Rainier.class, Fruit.class, Short.class); } @Test - public void testFindGeneric_WashingtonFruit() + public void testFindGenericWashingtonFruit() { // Washington does not have a concrete implementation // of the Fruit interface, this should return null diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java index 03ac86f8a5c..e0f2ea9f805 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java @@ -600,7 +600,7 @@ public class ConfiguratorTest * @throws Exception on test failure */ @Test - public void testProtocol_Single() throws Exception + public void testProtocolSingle() throws Exception { URI uri = baseServerUri.resolve("/protocols"); ProtocolsConfigurator.seenProtocols.set(null); @@ -624,7 +624,7 @@ public class ConfiguratorTest * @throws Exception on test failure */ @Test - public void testProtocol_Triple() throws Exception + public void testProtocolTriple() throws Exception { URI uri = baseServerUri.resolve("/protocols"); ProtocolsConfigurator.seenProtocols.set(null); @@ -648,7 +648,7 @@ public class ConfiguratorTest * @throws Exception on test failure */ @Test - public void testProtocol_LowercaseHeader() throws Exception + public void testProtocolLowercaseHeader() throws Exception { URI uri = baseServerUri.resolve("/protocols"); ProtocolsConfigurator.seenProtocols.set(null); @@ -672,7 +672,7 @@ public class ConfiguratorTest * @throws Exception on test failure */ @Test - public void testProtocol_AltHeaderCase() throws Exception + public void testProtocolAltHeaderCase() throws Exception { URI uri = baseServerUri.resolve("/protocols"); ProtocolsConfigurator.seenProtocols.set(null); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DelayedStartClientOnServerTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DelayedStartClientOnServerTest.java index 515d2ac0a51..d10138817e2 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DelayedStartClientOnServerTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DelayedStartClientOnServerTest.java @@ -232,7 +232,7 @@ public class DelayedStartClientOnServerTest } @Test - public void testHttpClientThreads_AfterClientConnectTo() throws Exception + public void testHttpClientThreadsAfterClientConnectTo() throws Exception { Server server = new Server(0); ServletContextHandler contextHandler = new ServletContextHandler(); @@ -244,7 +244,7 @@ public class DelayedStartClientOnServerTest try { server.start(); - String response = GET(server.getURI().resolve("/connect")); + String response = doHttpGET(server.getURI().resolve("/connect")); assertThat("Response", response, startsWith("Connected to ws://")); List threadNames = getThreadNames(server); assertNoHttpClientPoolThreads(threadNames); @@ -257,7 +257,7 @@ public class DelayedStartClientOnServerTest } @Test - public void testHttpClientThreads_AfterServerConnectTo() throws Exception + public void testHttpClientThreadsAfterServerConnectTo() throws Exception { assertTimeoutPreemptively(ofSeconds(5), () -> { @@ -271,7 +271,7 @@ public class DelayedStartClientOnServerTest try { server.start(); - String response = GET(server.getURI().resolve("/connect")); + String response = doHttpGET(server.getURI().resolve("/connect")); assertThat("Response", response, startsWith("Connected to ws://")); List threadNames = getThreadNames((ContainerLifeCycle)container, server); assertNoHttpClientPoolThreads(threadNames); @@ -285,7 +285,7 @@ public class DelayedStartClientOnServerTest } @Test - public void testHttpClientThreads_AfterClientConfigure() throws Exception + public void testHttpClientThreadsAfterClientConfigure() throws Exception { Server server = new Server(0); ServletContextHandler contextHandler = new ServletContextHandler(); @@ -297,7 +297,7 @@ public class DelayedStartClientOnServerTest try { server.start(); - String response = GET(server.getURI().resolve("/configure")); + String response = doHttpGET(server.getURI().resolve("/configure")); assertThat("Response", response, startsWith("Configured " + ClientContainer.class.getName())); List threadNames = getThreadNames((ContainerLifeCycle)container, server); assertNoHttpClientPoolThreads(threadNames); @@ -311,7 +311,7 @@ public class DelayedStartClientOnServerTest } @Test - public void testHttpClientThreads_AfterServerConfigure() throws Exception + public void testHttpClientThreadsAfterServerConfigure() throws Exception { Server server = new Server(0); ServletContextHandler contextHandler = new ServletContextHandler(); @@ -323,7 +323,7 @@ public class DelayedStartClientOnServerTest try { server.start(); - String response = GET(server.getURI().resolve("/configure")); + String response = doHttpGET(server.getURI().resolve("/configure")); assertThat("Response", response, startsWith("Configured " + ServerContainer.class.getName())); List threadNames = getThreadNames((ContainerLifeCycle)container, server); assertNoHttpClientPoolThreads(threadNames); @@ -335,7 +335,7 @@ public class DelayedStartClientOnServerTest } } - private String GET(URI destURI) throws IOException + private String doHttpGET(URI destURI) throws IOException { HttpURLConnection http = (HttpURLConnection)destURI.toURL().openConnection(); assertThat("HTTP GET (" + destURI + ") Response Code", http.getResponseCode(), is(200)); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/RestartContextTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/RestartContextTest.java index a206cb7d173..6cce64b70c3 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/RestartContextTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/RestartContextTest.java @@ -74,7 +74,7 @@ public class RestartContextTest } @Test - public void testStartStopStart_ServletContextListener() throws Exception + public void testStartStopStartServletContextListener() throws Exception { server = new Server(); @@ -114,7 +114,7 @@ public class RestartContextTest } @Test - public void testStartStopStart_Configurator() throws Exception + public void testStartStopStartConfigurator() throws Exception { server = new Server(); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_GoodSignaturesTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScannerGoodSignaturesTest.java similarity index 98% rename from jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_GoodSignaturesTest.java rename to jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScannerGoodSignaturesTest.java index 3179831a608..34074a5adf6 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_GoodSignaturesTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScannerGoodSignaturesTest.java @@ -79,7 +79,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * Test {@link AnnotatedEndpointScanner} against various simple, 1 method {@link ServerEndpoint} annotated classes with valid signatures. */ -public class ServerAnnotatedEndpointScanner_GoodSignaturesTest +public class ServerAnnotatedEndpointScannerGoodSignaturesTest { public static Stream scenarios() throws Exception { @@ -150,7 +150,7 @@ public class ServerAnnotatedEndpointScanner_GoodSignaturesTest @ParameterizedTest @MethodSource("scenarios") - public void testScan_Basic(Scenario scenario) throws Exception + public void testScanBasic(Scenario scenario) throws Exception { WebSocketContainerScope container = new SimpleContainerScope(WebSocketPolicy.newClientPolicy()); AnnotatedServerEndpointMetadata metadata = new AnnotatedServerEndpointMetadata(container, scenario.pojo, null); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScannerInvalidSignaturesTest.java similarity index 95% rename from jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java rename to jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScannerInvalidSignaturesTest.java index c189939c438..16fb48b0992 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScannerInvalidSignaturesTest.java @@ -52,7 +52,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; /** * Test {@link AnnotatedEndpointScanner} against various simple, 1 method {@link ServerEndpoint} annotated classes with invalid signatures. */ -public class ServerAnnotatedEndpointScanner_InvalidSignaturesTest +public class ServerAnnotatedEndpointScannerInvalidSignaturesTest { public static Stream scenarios() { @@ -76,7 +76,7 @@ public class ServerAnnotatedEndpointScanner_InvalidSignaturesTest @ParameterizedTest @MethodSource("scenarios") - public void testScan_InvalidSignature(Class pojo, Class expectedAnnoClass) throws DeploymentException + public void testScanInvalidSignature(Class pojo, Class expectedAnnoClass) throws DeploymentException { WebSocketContainerScope container = new SimpleContainerScope(WebSocketPolicy.newClientPolicy()); AnnotatedServerEndpointMetadata metadata = new AnnotatedServerEndpointMetadata(container, pojo, null); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/SessionTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/SessionTest.java index ceea69979a1..02987be67d2 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/SessionTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/SessionTest.java @@ -116,7 +116,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Annotated_Empty(Scenario scenario) throws Exception + public void testPathParamsAnnotatedEmpty(Scenario scenario) throws Exception { startServer(scenario); assertResponse("info/", "pathParams", "pathParams[0]"); @@ -124,7 +124,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Annotated_Single(Scenario scenario) throws Exception + public void testPathParamsAnnotatedSingle(Scenario scenario) throws Exception { startServer(scenario); assertResponse("info/apple/", "pathParams", "pathParams[1]: 'a'=apple"); @@ -132,7 +132,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Annotated_Double(Scenario scenario) throws Exception + public void testPathParamsAnnotatedDouble(Scenario scenario) throws Exception { startServer(scenario); assertResponse("info/apple/pear/", "pathParams", "pathParams[2]: 'a'=apple: 'b'=pear"); @@ -140,7 +140,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Annotated_Triple(Scenario scenario) throws Exception + public void testPathParamsAnnotatedTriple(Scenario scenario) throws Exception { startServer(scenario); assertResponse("info/apple/pear/cherry/", "pathParams", "pathParams[3]: 'a'=apple: 'b'=pear: 'c'=cherry"); @@ -148,7 +148,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Endpoint_Empty(Scenario scenario) throws Exception + public void testPathParamsEndpointEmpty(Scenario scenario) throws Exception { startServer(scenario); assertResponse("einfo/", "pathParams", "pathParams[0]"); @@ -156,7 +156,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Endpoint_Single(Scenario scenario) throws Exception + public void testPathParamsEndpointSingle(Scenario scenario) throws Exception { startServer(scenario); assertResponse("einfo/apple/", "pathParams", "pathParams[1]: 'a'=apple"); @@ -164,7 +164,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Endpoint_Double(Scenario scenario) throws Exception + public void testPathParamsEndpointDouble(Scenario scenario) throws Exception { startServer(scenario); assertResponse("einfo/apple/pear/", "pathParams", "pathParams[2]: 'a'=apple: 'b'=pear"); @@ -172,7 +172,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testPathParams_Endpoint_Triple(Scenario scenario) throws Exception + public void testPathParamsEndpointTriple(Scenario scenario) throws Exception { startServer(scenario); assertResponse("einfo/apple/pear/cherry/", "pathParams", "pathParams[3]: 'a'=apple: 'b'=pear: 'c'=cherry"); @@ -180,7 +180,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testRequestUri_Annotated_Basic(Scenario scenario) throws Exception + public void testRequestUriAnnotatedBasic(Scenario scenario) throws Exception { startServer(scenario); URI expectedUri = serverUri.resolve("info/"); @@ -189,7 +189,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testRequestUri_Annotated_WithPathParam(Scenario scenario) throws Exception + public void testRequestUriAnnotatedWithPathParam(Scenario scenario) throws Exception { startServer(scenario); URI expectedUri = serverUri.resolve("info/apple/banana/"); @@ -198,7 +198,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testRequestUri_Annotated_WithPathParam_WithQuery(Scenario scenario) throws Exception + public void testRequestUriAnnotatedWithPathParamWithQuery(Scenario scenario) throws Exception { startServer(scenario); URI expectedUri = serverUri.resolve("info/apple/banana/?fruit=fresh&store=grandmasfarm"); @@ -207,7 +207,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testRequestUri_Endpoint_Basic(Scenario scenario) throws Exception + public void testRequestUriEndpointBasic(Scenario scenario) throws Exception { startServer(scenario); URI expectedUri = serverUri.resolve("einfo/"); @@ -216,7 +216,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testRequestUri_Endpoint_WithPathParam(Scenario scenario) throws Exception + public void testRequestUriEndpointWithPathParam(Scenario scenario) throws Exception { startServer(scenario); URI expectedUri = serverUri.resolve("einfo/apple/banana/"); @@ -225,7 +225,7 @@ public class SessionTest @ParameterizedTest @MethodSource("scenarios") - public void testRequestUri_Endpoint_WithPathParam_WithQuery(Scenario scenario) throws Exception + public void testRequestUriEndpointWithPathParamWithQuery(Scenario scenario) throws Exception { startServer(scenario); URI expectedUri = serverUri.resolve("einfo/apple/banana/?fruit=fresh&store=grandmasfarm"); diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java index 3e7e19b1110..5ff5cefbbf2 100644 --- a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/ErrorCloseTest.java @@ -70,7 +70,8 @@ public class ErrorCloseTest NativeWebSocketServletContainerInitializer.configure(contextHandler, (context, container) -> { container.addMapping("/", (req, resp) -> serverSocket); - container.getFactory().addSessionListener(new WebSocketSessionListener() { + container.getFactory().addSessionListener(new WebSocketSessionListener() + { @Override public void onSessionClosed(WebSocketSession session) { @@ -165,9 +166,8 @@ public class ErrorCloseTest assertTrue(((WebSocketSession)serverSocket.session).isStopped()); } - @ParameterizedTest - @ValueSource(strings={"onError","onClose"}) + @ValueSource(strings = {"onError", "onClose"}) public void testWebSocketThrowsAfterOnOpenError(String methodToThrow) throws Exception { serverSocket.methodsToThrow.add("onOpen"); @@ -188,7 +188,7 @@ public class ErrorCloseTest } @ParameterizedTest - @ValueSource(strings={"onError","onClose"}) + @ValueSource(strings = {"onError", "onClose"}) public void testWebSocketThrowsAfterOnMessageError(String methodToThrow) throws Exception { serverSocket.methodsToThrow.add("onMessage"); @@ -210,7 +210,7 @@ public class ErrorCloseTest } @ParameterizedTest - @ValueSource(strings={"onError","onClose"}) + @ValueSource(strings = {"onError", "onClose"}) public void testWebSocketThrowsOnTimeout(String methodToThrow) throws Exception { serverSocket.methodsToThrow.add(methodToThrow); @@ -235,7 +235,7 @@ public class ErrorCloseTest } @ParameterizedTest - @ValueSource(strings={"onError","onClose"}) + @ValueSource(strings = {"onError", "onClose"}) public void testWebSocketThrowsOnRemoteDisconnect(String methodToThrow) throws Exception { serverSocket.methodsToThrow.add(methodToThrow); @@ -256,7 +256,7 @@ public class ErrorCloseTest } @ParameterizedTest - @ValueSource(strings={"onError","onClose"}) + @ValueSource(strings = {"onError", "onClose"}) public void testWebSocketThrowsOnLocalDisconnect(String methodToThrow) throws Exception { serverSocket.methodsToThrow.add(methodToThrow); diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java index 9b2031703b8..2dbb932d39c 100644 --- a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java @@ -177,7 +177,7 @@ public class ClientConnectTest } @Test - public void testUpgradeRequest_PercentEncodedQuery() throws Exception + public void testUpgradeRequestPercentEncodedQuery() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); client.getPolicy().setIdleTimeout(10000); @@ -269,7 +269,7 @@ public class ClientConnectTest } @Test - public void testBadHandshake_GetOK() throws Exception + public void testBadHandshakeGetOK() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -287,7 +287,7 @@ public class ClientConnectTest } @Test - public void testBadHandshake_GetOK_WithSecWebSocketAccept() throws Exception + public void testBadHandshakeGetOKWithSecWebSocketAccept() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -305,7 +305,7 @@ public class ClientConnectTest } @Test - public void testBadHandshake_SwitchingProtocols_InvalidConnectionHeader() throws Exception + public void testBadHandshakeSwitchingProtocolsInvalidConnectionHeader() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -323,7 +323,7 @@ public class ClientConnectTest } @Test - public void testBadHandshake_SwitchingProtocols_NoConnectionHeader() throws Exception + public void testBadHandshakeSwitchingProtocolsNoConnectionHeader() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -423,7 +423,7 @@ public class ClientConnectTest } @Test - public void testConnectionTimeout_Concurrent() throws Exception + public void testConnectionTimeoutConcurrent() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientSessionsTest.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientSessionsTest.java index 209ac03509c..11386b79566 100644 --- a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientSessionsTest.java +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientSessionsTest.java @@ -94,7 +94,7 @@ public class ClientSessionsTest } @Test - public void testBasicEcho_FromClient() throws Exception + public void testBasicEchoFromClient() throws Exception { WebSocketClient client = new WebSocketClient(); diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java index 4e0ff9fbb1b..96f044ab9a8 100644 --- a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java @@ -124,7 +124,7 @@ public class WebSocketClientTest } @Test - public void testAddExtension_NotInstalled() throws Exception + public void testAddExtensionNotInstalled() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -143,7 +143,7 @@ public class WebSocketClientTest } @Test - public void testBasicEcho_FromClient() throws Exception + public void testBasicEchoFromClient() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -174,7 +174,7 @@ public class WebSocketClientTest } @Test - public void testBasicEcho_PartialUsage_FromClient() throws Exception + public void testBasicEchoPartialUsageFromClient() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -207,7 +207,7 @@ public class WebSocketClientTest } @Test - public void testBasicEcho_PartialText_WithPartialBinary_FromClient() throws Exception + public void testBasicEchoPartialTextWithPartialBinaryFromClient() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -254,7 +254,7 @@ public class WebSocketClientTest } @Test - public void testBasicEcho_UsingCallback() throws Exception + public void testBasicEchoUsingCallback() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); @@ -287,7 +287,7 @@ public class WebSocketClientTest } @Test - public void testBasicEcho_FromServer() throws Exception + public void testBasicEchoFromServer() throws Exception { CloseTrackingEndpoint cliSock = new CloseTrackingEndpoint(); diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/PartialListenerTest.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/PartialListenerTest.java index ae1c9a9673c..7a4e93370fb 100644 --- a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/PartialListenerTest.java +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/PartialListenerTest.java @@ -191,7 +191,7 @@ public class PartialListenerTest * Test to ensure that the internal state tracking the partial messages is reset after each complete message. */ @Test - public void testPartial_TextBinaryText() throws Exception + public void testPartialTextBinaryText() throws Exception { ClientUpgradeRequest request = new ClientUpgradeRequest(); CloseTrackingEndpoint clientEndpoint = new CloseTrackingEndpoint(); diff --git a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfigTest.java b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfigTest.java index b771c33e0ea..8f4fc516921 100644 --- a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfigTest.java +++ b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/extensions/ExtensionConfigTest.java @@ -106,7 +106,7 @@ public class ExtensionConfigTest } @Test - public void testParseSimple_BasicParameters() + public void testParseSimpleBasicParameters() { ExtensionConfig cfg = ExtensionConfig.parse("bar; baz=2"); Map expectedParams = new HashMap<>(); @@ -115,7 +115,7 @@ public class ExtensionConfigTest } @Test - public void testParseSimple_NoParameters() + public void testParseSimpleNoParameters() { ExtensionConfig cfg = ExtensionConfig.parse("foo"); Map expectedParams = new HashMap<>(); diff --git a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtil_QuoteTest.java b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilQuoteTest.java similarity index 98% rename from jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtil_QuoteTest.java rename to jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilQuoteTest.java index 610e68c10cb..5bf9ede142e 100644 --- a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtil_QuoteTest.java +++ b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilQuoteTest.java @@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.is; /** * Test QuoteUtil.quote(), and QuoteUtil.dequote() */ -public class QuoteUtil_QuoteTest +public class QuoteUtilQuoteTest { public static Stream data() { diff --git a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java index cdc8996deea..a484ea472e6 100644 --- a/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java +++ b/jetty-websocket/websocket-api/src/test/java/org/eclipse/jetty/websocket/api/util/QuoteUtilTest.java @@ -44,14 +44,14 @@ public class QuoteUtilTest } @Test - public void testSplitAt_PreserveQuoting() + public void testSplitAtPreserveQuoting() { Iterator iter = QuoteUtil.splitAt("permessage-compress; method=\"foo, bar\"", ";"); assertSplitAt(iter, "permessage-compress", "method=\"foo, bar\""); } @Test - public void testSplitAt_PreserveQuotingWithNestedDelim() + public void testSplitAtPreserveQuotingWithNestedDelim() { Iterator iter = QuoteUtil.splitAt("permessage-compress; method=\"foo; x=10\"", ";"); assertSplitAt(iter, "permessage-compress", "method=\"foo; x=10\""); @@ -81,7 +81,7 @@ public class QuoteUtilTest } @Test - public void testSplitAtKeyValue_Message() + public void testSplitAtKeyValueMessage() { Iterator iter = QuoteUtil.splitAt("method=\"foo, bar\"", "="); assertSplitAt(iter, "method", "foo, bar"); @@ -104,35 +104,35 @@ public class QuoteUtilTest } @Test - public void testSplitKeyValue_Quoted() + public void testSplitKeyValueQuoted() { Iterator iter = QuoteUtil.splitAt("Key = \"Value\"", "="); assertSplitAt(iter, "Key", "Value"); } @Test - public void testSplitKeyValue_QuotedValueList() + public void testSplitKeyValueQuotedValueList() { Iterator iter = QuoteUtil.splitAt("Fruit = \"Apple, Banana, Cherry\"", "="); assertSplitAt(iter, "Fruit", "Apple, Banana, Cherry"); } @Test - public void testSplitKeyValue_QuotedWithDelim() + public void testSplitKeyValueQuotedWithDelim() { Iterator iter = QuoteUtil.splitAt("Key = \"Option=Value\"", "="); assertSplitAt(iter, "Key", "Option=Value"); } @Test - public void testSplitKeyValue_Simple() + public void testSplitKeyValueSimple() { Iterator iter = QuoteUtil.splitAt("Key=Value", "="); assertSplitAt(iter, "Key", "Value"); } @Test - public void testSplitKeyValue_WithWhitespace() + public void testSplitKeyValueWithWhitespace() { Iterator iter = QuoteUtil.splitAt("Key = Value", "="); assertSplitAt(iter, "Key", "Value"); @@ -147,7 +147,7 @@ public class QuoteUtilTest } @Test - public void testQuoteIfNeeded_null() + public void testQuoteIfNeedednull() { StringBuilder buf = new StringBuilder(); QuoteUtil.quoteIfNeeded(buf, null, ";="); diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ConnectionManagerTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ConnectionManagerTest.java index 099e932a5ec..0c66aa28a0e 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ConnectionManagerTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/ConnectionManagerTest.java @@ -40,37 +40,37 @@ public class ConnectionManagerTest } @Test - public void testToSocketAddress_AltWsPort() throws Exception + public void testToSocketAddressAltWsPort() throws Exception { assertToSocketAddress("ws://localhost:8099", "localhost", 8099); } @Test - public void testToSocketAddress_AltWssPort() throws Exception + public void testToSocketAddressAltWssPort() throws Exception { assertToSocketAddress("wss://localhost", "localhost", 443); } @Test - public void testToSocketAddress_DefaultWsPort() throws Exception + public void testToSocketAddressDefaultWsPort() throws Exception { assertToSocketAddress("ws://localhost", "localhost", 80); } @Test - public void testToSocketAddress_DefaultWsPort_Path() throws Exception + public void testToSocketAddressDefaultWsPortPath() throws Exception { assertToSocketAddress("ws://localhost/sockets/chat", "localhost", 80); } @Test - public void testToSocketAddress_DefaultWssPort() throws Exception + public void testToSocketAddressDefaultWssPort() throws Exception { assertToSocketAddress("wss://localhost:9443", "localhost", 9443); } @Test - public void testToSocketAddress_DefaultWssPort_Path() throws Exception + public void testToSocketAddressDefaultWssPortPath() throws Exception { assertToSocketAddress("wss://localhost/sockets/chat", "localhost", 443); } diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java index 8a52274c9f5..c1ffd380d2d 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java @@ -89,7 +89,7 @@ public class TomcatServerQuirksTest * @throws Exception on test failure */ @Test - public void testTomcat7_0_32_WithTransferEncoding() throws Exception + public void testTomcat7032WithTransferEncoding() throws Exception { WebSocketClient client = new WebSocketClient(); diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/WebSocketClientInitTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/WebSocketClientInitTest.java index 8cfcc036e31..3d26d8f908d 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/WebSocketClientInitTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/WebSocketClientInitTest.java @@ -38,7 +38,7 @@ public class WebSocketClientInitTest * @throws Exception on test failure */ @Test - public void testInit_HttpClient_StartedOutside() throws Exception + public void testInitHttpClientStartedOutside() throws Exception { HttpClient http = new HttpClient(); http.start(); @@ -80,7 +80,7 @@ public class WebSocketClientInitTest * @throws Exception on test failure */ @Test - public void testInit_HttpClient_SyntheticStart() throws Exception + public void testInitHttpClientSyntheticStart() throws Exception { HttpClient http = null; WebSocketClient ws = new WebSocketClient(); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java index 5c6511d6d19..c1fa2e04b11 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java @@ -130,14 +130,14 @@ public class GeneratorTest } @Test - public void testClose_Empty() + public void testCloseEmpty() { // 0 byte payload (no status code) assertGeneratedBytes("8800", new CloseFrame()); } @Test - public void testClose_CodeNoReason() + public void testCloseCodeNoReason() { CloseInfo close = new CloseInfo(StatusCode.NORMAL); // 2 byte payload (2 bytes for status code) @@ -145,7 +145,7 @@ public class GeneratorTest } @Test - public void testClose_CodeOkReason() + public void testCloseCodeOkReason() { CloseInfo close = new CloseInfo(StatusCode.NORMAL, "OK"); // 4 byte payload (2 bytes for status code, 2 more for "OK") @@ -153,7 +153,7 @@ public class GeneratorTest } @Test - public void testText_Hello() + public void testTextHello() { WebSocketFrame frame = new TextFrame().setPayload("Hello"); byte[] utf = StringUtil.getUtf8Bytes("Hello"); @@ -161,7 +161,7 @@ public class GeneratorTest } @Test - public void testText_Masked() + public void testTextMasked() { WebSocketFrame frame = new TextFrame().setPayload("Hello"); byte[] maskingKey = Hex.asByteArray("11223344"); @@ -177,7 +177,7 @@ public class GeneratorTest } @Test - public void testText_Masked_OffsetSourceByteBuffer() + public void testTextMaskedOffsetSourceByteBuffer() { ByteBuffer payload = ByteBuffer.allocate(100); payload.position(5); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java index 566694c7fc3..a276d0c912c 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java @@ -44,13 +44,14 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertThrows; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class ParserTest { /** * Similar to the server side 5.15 testcase. A normal 2 fragment text text message, followed by another continuation. */ @Test - public void testParseCase5_15() + public void testParseCase515() { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("fragment1").setFin(false)); @@ -72,7 +73,7 @@ public class ParserTest * Similar to the server side 5.18 testcase. Text message fragmented as 2 frames, both as opcode=TEXT */ @Test - public void testParseCase5_18() + public void testParseCase518() { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("fragment1").setFin(false)); @@ -92,7 +93,7 @@ public class ParserTest * Similar to the server side 5.19 testcase. text message, send in 5 frames/fragments, with 2 pings in the mix. */ @Test - public void testParseCase5_19() + public void testParseCase519() { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("f1").setFin(false)); @@ -120,7 +121,7 @@ public class ParserTest * Similar to the server side 5.6 testcase. pong, then text, then close frames. */ @Test - public void testParseCase5_6() + public void testParseCase56() { List send = new ArrayList<>(); send.add(new PongFrame().setPayload("ping")); @@ -142,7 +143,7 @@ public class ParserTest * Similar to the server side 6.2.3 testcase. Lots of small 1 byte UTF8 Text frames, representing 1 overall text message. */ @Test - public void testParseCase6_2_3() + public void testParseCase623() { String utf8 = "Hello-\uC2B5@\uC39F\uC3A4\uC3BC\uC3A0\uC3A1-UTF-8!!"; byte[] msg = StringUtil.getUtf8Bytes(utf8); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java index ebf3b875e5f..7ddb0530b65 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java @@ -37,6 +37,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThan; import static org.junit.jupiter.api.Assertions.assertThrows; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class TextPayloadParserTest { @Test diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_1.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase11.java similarity index 95% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_1.java rename to jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase11.java index 7eef71e8855..568535221da 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_1.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase11.java @@ -42,12 +42,12 @@ import static org.hamcrest.Matchers.is; /** * Text Message Spec testing the {@link Generator} and {@link Parser} */ -public class TestABCase1_1 +public class TestABCase11 { private WebSocketPolicy policy = WebSocketPolicy.newClientPolicy(); @Test - public void testGenerate125ByteTextCase1_1_2() + public void testGenerate125ByteTextCase112() { int length = 125; byte[] buf = new byte[length]; @@ -78,7 +78,7 @@ public class TestABCase1_1 } @Test - public void testGenerate126ByteTextCase1_1_3() + public void testGenerate126ByteTextCase113() { int length = 126; @@ -117,7 +117,7 @@ public class TestABCase1_1 } @Test - public void testGenerate127ByteTextCase1_1_4() + public void testGenerate127ByteTextCase114() { int length = 127; @@ -156,7 +156,7 @@ public class TestABCase1_1 } @Test - public void testGenerate128ByteTextCase1_1_5() + public void testGenerate128ByteTextCase115() { int length = 128; @@ -195,7 +195,7 @@ public class TestABCase1_1 } @Test - public void testGenerate65535ByteTextCase1_1_6() + public void testGenerate65535ByteTextCase116() { int length = 65535; @@ -232,7 +232,7 @@ public class TestABCase1_1 } @Test - public void testGenerate65536ByteTextCase1_1_7() + public void testGenerate65536ByteTextCase117() { int length = 65536; @@ -269,7 +269,7 @@ public class TestABCase1_1 } @Test - public void testGenerateEmptyTextCase1_1_1() + public void testGenerateEmptyTextCase111() { WebSocketFrame textFrame = new TextFrame().setPayload(""); @@ -286,7 +286,7 @@ public class TestABCase1_1 } @Test - public void testParse125ByteTextCase1_1_2() + public void testParse125ByteTextCase112() { int length = 125; @@ -318,7 +318,7 @@ public class TestABCase1_1 } @Test - public void testParse126ByteTextCase1_1_3() + public void testParse126ByteTextCase113() { int length = 126; @@ -351,7 +351,7 @@ public class TestABCase1_1 } @Test - public void testParse127ByteTextCase1_1_4() + public void testParse127ByteTextCase114() { int length = 127; @@ -384,7 +384,7 @@ public class TestABCase1_1 } @Test - public void testParse128ByteTextCase1_1_5() + public void testParse128ByteTextCase115() { int length = 128; @@ -417,7 +417,7 @@ public class TestABCase1_1 } @Test - public void testParse65535ByteTextCase1_1_6() + public void testParse65535ByteTextCase116() { int length = 65535; @@ -452,7 +452,7 @@ public class TestABCase1_1 } @Test - public void testParse65536ByteTextCase1_1_7() + public void testParse65536ByteTextCase117() { int length = 65536; @@ -488,7 +488,7 @@ public class TestABCase1_1 } @Test - public void testParseEmptyTextCase1_1_1() + public void testParseEmptyTextCase111() { ByteBuffer expected = ByteBuffer.allocate(5); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_2.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase12.java similarity index 94% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_2.java rename to jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase12.java index db29667bb29..a16e38bd165 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_2.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase12.java @@ -41,12 +41,12 @@ import static org.hamcrest.Matchers.is; /** * Binary Message Spec testing the {@link Generator} and {@link Parser} */ -public class TestABCase1_2 +public class TestABCase12 { private WebSocketPolicy policy = WebSocketPolicy.newClientPolicy(); @Test - public void testGenerate125ByteBinaryCase1_2_2() + public void testGenerate125ByteBinaryCase122() { int length = 125; @@ -83,7 +83,7 @@ public class TestABCase1_2 } @Test - public void testGenerate126ByteBinaryCase1_2_3() + public void testGenerate126ByteBinaryCase123() { int length = 126; @@ -124,7 +124,7 @@ public class TestABCase1_2 } @Test - public void testGenerate127ByteBinaryCase1_2_4() + public void testGenerate127ByteBinaryCase124() { int length = 127; @@ -165,7 +165,7 @@ public class TestABCase1_2 } @Test - public void testGenerate128ByteBinaryCase1_2_5() + public void testGenerate128ByteBinaryCase125() { int length = 128; @@ -205,7 +205,7 @@ public class TestABCase1_2 } @Test - public void testGenerate65535ByteBinaryCase1_2_6() + public void testGenerate65535ByteBinaryCase126() { int length = 65535; @@ -243,7 +243,7 @@ public class TestABCase1_2 } @Test - public void testGenerate65536ByteBinaryCase1_2_7() + public void testGenerate65536ByteBinaryCase127() { int length = 65536; @@ -281,7 +281,7 @@ public class TestABCase1_2 } @Test - public void testGenerateEmptyBinaryCase1_2_1() + public void testGenerateEmptyBinaryCase121() { WebSocketFrame binaryFrame = new BinaryFrame().setPayload(new byte[]{}); @@ -298,7 +298,7 @@ public class TestABCase1_2 } @Test - public void testParse125ByteBinaryCase1_2_2() + public void testParse125ByteBinaryCase122() { int length = 125; @@ -330,7 +330,7 @@ public class TestABCase1_2 } @Test - public void testParse126ByteBinaryCase1_2_3() + public void testParse126ByteBinaryCase123() { int length = 126; @@ -363,7 +363,7 @@ public class TestABCase1_2 } @Test - public void testParse127ByteBinaryCase1_2_4() + public void testParse127ByteBinaryCase124() { int length = 127; @@ -396,7 +396,7 @@ public class TestABCase1_2 } @Test - public void testParse128ByteBinaryCase1_2_5() + public void testParse128ByteBinaryCase125() { int length = 128; @@ -429,7 +429,7 @@ public class TestABCase1_2 } @Test - public void testParse65535ByteBinaryCase1_2_6() + public void testParse65535ByteBinaryCase126() { int length = 65535; @@ -463,7 +463,7 @@ public class TestABCase1_2 } @Test - public void testParse65536ByteBinaryCase1_2_7() + public void testParse65536ByteBinaryCase127() { int length = 65536; @@ -498,7 +498,7 @@ public class TestABCase1_2 } @Test - public void testParseEmptyBinaryCase1_2_1() + public void testParseEmptyBinaryCase121() { ByteBuffer expected = ByteBuffer.allocate(5); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java index 61d0cf4b862..82c9f0b0d73 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase2.java @@ -49,7 +49,7 @@ public class TestABCase2 private WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.CLIENT); @Test - public void testGenerate125OctetPingCase2_4() + public void testGenerate125OctetPingCase24() { byte[] bytes = new byte[125]; @@ -78,7 +78,7 @@ public class TestABCase2 } @Test - public void testGenerateBinaryPingCase2_3() + public void testGenerateBinaryPingCase23() { byte[] bytes = new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; @@ -102,7 +102,7 @@ public class TestABCase2 } @Test - public void testGenerateEmptyPingCase2_1() + public void testGenerateEmptyPingCase21() { WebSocketFrame pingFrame = new PingFrame(); @@ -119,7 +119,7 @@ public class TestABCase2 } @Test - public void testGenerateHelloPingCase2_2() + public void testGenerateHelloPingCase22() { String message = "Hello, world!"; byte[] messageBytes = StringUtil.getUtf8Bytes(message); @@ -144,7 +144,7 @@ public class TestABCase2 } @Test - public void testGenerateOversizedBinaryPingCase2_5_A() + public void testGenerateOversizedBinaryPingCase25A() { byte[] bytes = new byte[126]; Arrays.fill(bytes, (byte)0x00); @@ -154,7 +154,7 @@ public class TestABCase2 } @Test - public void testGenerateOversizedBinaryPingCase2_5_B() + public void testGenerateOversizedBinaryPingCase25B() { byte[] bytes = new byte[126]; Arrays.fill(bytes, (byte)0x00); @@ -165,7 +165,7 @@ public class TestABCase2 } @Test - public void testParse125OctetPingCase2_4() + public void testParse125OctetPingCase24() { byte[] bytes = new byte[125]; @@ -199,7 +199,7 @@ public class TestABCase2 } @Test - public void testParseBinaryPingCase2_3() + public void testParseBinaryPingCase23() { byte[] bytes = new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; @@ -228,7 +228,7 @@ public class TestABCase2 } @Test - public void testParseEmptyPingCase2_1() + public void testParseEmptyPingCase21() { ByteBuffer expected = ByteBuffer.allocate(5); @@ -250,7 +250,7 @@ public class TestABCase2 } @Test - public void testParseHelloPingCase2_2() + public void testParseHelloPingCase22() { String message = "Hello, world!"; byte[] messageBytes = message.getBytes(); @@ -280,7 +280,7 @@ public class TestABCase2 } @Test - public void testParseOversizedBinaryPingCase2_5() + public void testParseOversizedBinaryPingCase25() { byte[] bytes = new byte[126]; Arrays.fill(bytes, (byte)0x00); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase4.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase4.java index 075cddea2af..d1a6cd37c1d 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase4.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase4.java @@ -36,7 +36,7 @@ public class TestABCase4 private WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.CLIENT); @Test - public void testParserControlOpCode11Case4_2_1() throws Exception + public void testParserControlOpCode11Case421() throws Exception { ByteBuffer expected = ByteBuffer.allocate(32); @@ -55,7 +55,7 @@ public class TestABCase4 } @Test - public void testParserControlOpCode12WithPayloadCase4_2_2() throws Exception + public void testParserControlOpCode12WithPayloadCase422() throws Exception { ByteBuffer expected = ByteBuffer.allocate(32); @@ -74,7 +74,7 @@ public class TestABCase4 } @Test - public void testParserNonControlOpCode3Case4_1_1() throws Exception + public void testParserNonControlOpCode3Case411() throws Exception { ByteBuffer expected = ByteBuffer.allocate(32); @@ -93,7 +93,7 @@ public class TestABCase4 } @Test - public void testParserNonControlOpCode4WithPayloadCase4_1_2() throws Exception + public void testParserNonControlOpCode4WithPayloadCase412() throws Exception { ByteBuffer expected = ByteBuffer.allocate(32); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase73.java similarity index 92% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java rename to jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase73.java index 9ff7d7ef0ee..67fe432105e 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase73.java @@ -42,12 +42,12 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertThrows; -public class TestABCase7_3 +public class TestABCase73 { private WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.CLIENT); @Test - public void testCase7_3_1GenerateEmptyClose() + public void testCase731GenerateEmptyClose() { CloseInfo close = new CloseInfo(); @@ -64,7 +64,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_1ParseEmptyClose() + public void testCase731ParseEmptyClose() { ByteBuffer expected = ByteBuffer.allocate(5); @@ -85,7 +85,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_2Generate1BytePayloadClose() + public void testCase732Generate1BytePayloadClose() { CloseFrame closeFrame = new CloseFrame(); closeFrame.setPayload(Hex.asByteBuffer("00")); @@ -94,7 +94,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_2Parse1BytePayloadClose() + public void testCase732Parse1BytePayloadClose() { ByteBuffer expected = Hex.asByteBuffer("880100"); @@ -105,7 +105,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_3GenerateCloseWithStatus() + public void testCase733GenerateCloseWithStatus() { CloseInfo close = new CloseInfo(1000); @@ -122,7 +122,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_3ParseCloseWithStatus() + public void testCase733ParseCloseWithStatus() { ByteBuffer expected = ByteBuffer.allocate(5); @@ -143,7 +143,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_4GenerateCloseWithStatusReason() + public void testCase734GenerateCloseWithStatusReason() { String message = "bad cough"; byte[] messageBytes = message.getBytes(); @@ -169,7 +169,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_4ParseCloseWithStatusReason() + public void testCase734ParseCloseWithStatusReason() { String message = "bad cough"; byte[] messageBytes = message.getBytes(); @@ -197,7 +197,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_5GenerateCloseWithStatusMaxReason() + public void testCase735GenerateCloseWithStatusMaxReason() { StringBuilder message = new StringBuilder(); for (int i = 0; i < 123; ++i) @@ -228,7 +228,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_5ParseCloseWithStatusMaxReason() + public void testCase735ParseCloseWithStatusMaxReason() { StringBuilder message = new StringBuilder(); for (int i = 0; i < 123; ++i) @@ -263,7 +263,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_6GenerateCloseWithInvalidStatusReason() + public void testCase736GenerateCloseWithInvalidStatusReason() { StringBuilder message = new StringBuilder(); for (int i = 0; i < 124; ++i) @@ -290,7 +290,7 @@ public class TestABCase7_3 } @Test - public void testCase7_3_6ParseCloseWithInvalidStatusReason() + public void testCase736ParseCloseWithInvalidStatusReason() { byte[] messageBytes = new byte[124]; Arrays.fill(messageBytes, (byte)'*'); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java index d6f9a9cb569..80c85244fe7 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverTest.java @@ -67,7 +67,7 @@ public class EventDriverTest } @Test - public void testAdapter_ConnectClose(TestInfo testInfo) throws Exception + public void testAdapterConnectClose(TestInfo testInfo) throws Exception { AdapterConnectCloseSocket socket = new AdapterConnectCloseSocket(); EventDriver driver = wrap(socket); @@ -83,7 +83,7 @@ public class EventDriverTest } @Test - public void testAnnotated_ByteArray(TestInfo testInfo) throws Exception + public void testAnnotatedByteArray(TestInfo testInfo) throws Exception { AnnotatedBinaryArraySocket socket = new AnnotatedBinaryArraySocket(); EventDriver driver = wrap(socket); @@ -101,7 +101,7 @@ public class EventDriverTest } @Test - public void testAnnotated_Error(TestInfo testInfo) throws Exception + public void testAnnotatedError(TestInfo testInfo) throws Exception { AnnotatedTextSocket socket = new AnnotatedTextSocket(); EventDriver driver = wrap(socket); @@ -119,7 +119,7 @@ public class EventDriverTest } @Test - public void testAnnotated_Frames(TestInfo testInfo) throws Exception + public void testAnnotatedFrames(TestInfo testInfo) throws Exception { AnnotatedFramesSocket socket = new AnnotatedFramesSocket(); EventDriver driver = wrap(socket); @@ -142,7 +142,7 @@ public class EventDriverTest } @Test - public void testAnnotated_InputStream(TestInfo testInfo) throws InterruptedException + public void testAnnotatedInputStream(TestInfo testInfo) throws InterruptedException { AnnotatedBinaryStreamSocket socket = new AnnotatedBinaryStreamSocket(); EventDriver driver = wrap(socket); @@ -160,7 +160,7 @@ public class EventDriverTest } @Test - public void testListenerBasic_Text(TestInfo testInfo) throws Exception + public void testListenerBasicText(TestInfo testInfo) throws Exception { ListenerBasicSocket socket = new ListenerBasicSocket(); EventDriver driver = wrap(socket); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScannerTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScannerTest.java index 18e8206f320..835e3722054 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScannerTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScannerTest.java @@ -95,7 +95,7 @@ public class JettyAnnotatedScannerTest * Test Case for bad declaration a method with a non-void return type */ @Test - public void testAnnotatedBadSignature_NonVoidReturn() + public void testAnnotatedBadSignatureNonVoidReturn() { JettyAnnotatedScanner impl = new JettyAnnotatedScanner(); InvalidWebSocketException e = assertThrows(InvalidWebSocketException.class, () -> @@ -111,7 +111,7 @@ public class JettyAnnotatedScannerTest * Test Case for bad declaration a method with a public static method */ @Test - public void testAnnotatedBadSignature_Static() + public void testAnnotatedBadSignatureStatic() { JettyAnnotatedScanner impl = new JettyAnnotatedScanner(); InvalidWebSocketException e = assertThrows(InvalidWebSocketException.class, () -> diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java index 26dd9059adf..5aa41765e07 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java @@ -54,7 +54,7 @@ public class ByteAccumulatorTest } @Test - public void testTransferTo_NotEnoughSpace() + public void testTransferToNotEnoughSpace() { ByteAccumulator accumulator = new ByteAccumulator(10_000); @@ -75,7 +75,7 @@ public class ByteAccumulatorTest } @Test - public void testCopyChunk_NotEnoughSpace() + public void testCopyChunkNotEnoughSpace() { byte[] hello = "Hello".getBytes(UTF_8); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java index fd7f25dac6a..8ee7ecded3d 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java @@ -146,7 +146,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testBlockheadClient_HelloThere() + public void testBlockheadClientHelloThere() { Tester tester = serverExtensions.newTester("deflate-frame"); @@ -161,7 +161,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testChrome20_Hello() + public void testChrome20Hello() { Tester tester = serverExtensions.newTester("deflate-frame"); @@ -175,7 +175,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testChrome20_HelloThere() + public void testChrome20HelloThere() { Tester tester = serverExtensions.newTester("deflate-frame"); @@ -190,7 +190,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testChrome20_Info() + public void testChrome20Info() { Tester tester = serverExtensions.newTester("deflate-frame"); @@ -204,7 +204,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testChrome20_TimeTime() + public void testChrome20TimeTime() { Tester tester = serverExtensions.newTester("deflate-frame"); @@ -219,7 +219,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_TimeTimeTime() + public void testPyWebSocketTimeTimeTime() { Tester tester = serverExtensions.newTester("deflate-frame"); @@ -235,7 +235,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testCompress_TimeTimeTime() + public void testCompressTimeTimeTime() { // What pywebsocket produces for "time:", "time:", "time:" String[] expected = new String[] @@ -265,7 +265,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testDeflateBasics() throws Exception + public void testDeflateBasics() { // Setup deflater basics Deflater compressor = new Deflater(Deflater.BEST_COMPRESSION, true); @@ -353,7 +353,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocketServer_Hello() + public void testPyWebSocketServerHello() { // Captured from PyWebSocket - "Hello" (echo from server) byte[] rawbuf = TypeUtil.fromHexString("c107f248cdc9c90700"); @@ -361,7 +361,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocketServer_Long() + public void testPyWebSocketServerLong() { // Captured from PyWebSocket - Long Text (echo from server) byte[] rawbuf = TypeUtil.fromHexString("c1421cca410a80300c44d1abccce9df7" + @@ -373,7 +373,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocketServer_Medium() + public void testPyWebSocketServerMedium() { // Captured from PyWebSocket - "stackoverflow" (echo from server) byte[] rawbuf = TypeUtil.fromHexString("c10f2a2e494ccece2f4b2d4acbc92f0700"); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java index 443d4fc08f3..f7b44cffc04 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java @@ -88,7 +88,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.1: A message compressed using 1 compressed DEFLATE block */ @Test - public void testDraft21_Hello_UnCompressedBlock() + public void testDraft21HelloUnCompressedBlock() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -109,7 +109,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.1: A message compressed using 1 compressed DEFLATE block (with fragmentation) */ @Test - public void testDraft21_Hello_UnCompressedBlock_Fragmented() + public void testDraft21HelloUnCompressedBlockFragmented() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -132,7 +132,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.2: Sharing LZ77 Sliding Window */ @Test - public void testDraft21_SharingL77SlidingWindow_ContextTakeover() + public void testDraft21SharingL77SlidingWindowContextTakeover() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -155,7 +155,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.2: Sharing LZ77 Sliding Window */ @Test - public void testDraft21_SharingL77SlidingWindow_NoContextTakeover() + public void testDraft21SharingL77SlidingWindowNoContextTakeover() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -179,7 +179,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.3: Using a DEFLATE Block with No Compression */ @Test - public void testDraft21_DeflateBlockWithNoCompression() + public void testDraft21DeflateBlockWithNoCompression() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -198,7 +198,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.4: Using a DEFLATE Block with BFINAL Set to 1 */ @Test - public void testDraft21_DeflateBlockWithBFinal1() + public void testDraft21DeflateBlockWithBFinal1() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -218,7 +218,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.5: Two DEFLATE Blocks in 1 Message */ @Test - public void testDraft21_TwoDeflateBlocksOneMessage() + public void testDraft21TwoDeflateBlocksOneMessage() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -236,7 +236,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Decode fragmented message (3 parts: TEXT, CONTINUATION, CONTINUATION) */ @Test - public void testParseFragmentedMessage_Good() + public void testParseFragmentedMessageGood() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -265,7 +265,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest *

*/ @Test - public void testParseFragmentedMessage_BadRsv1() + public void testParseFragmentedMessageBadRsv1() { Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -516,7 +516,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Client_NoContextTakeover_ThreeOra() + public void testPyWebSocketClientNoContextTakeoverThreeOra() { Tester tester = clientExtensions.newTester("permessage-deflate; client_max_window_bits; client_no_context_takeover"); @@ -534,7 +534,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Client_ToraToraTora() + public void testPyWebSocketClientToraToraTora() { Tester tester = clientExtensions.newTester("permessage-deflate; client_max_window_bits"); @@ -552,7 +552,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Server_NoContextTakeover_ThreeOra() + public void testPyWebSocketServerNoContextTakeoverThreeOra() { Tester tester = serverExtensions.newTester("permessage-deflate; client_max_window_bits; client_no_context_takeover"); @@ -570,7 +570,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Server_ToraToraTora() + public void testPyWebSocketServerToraToraTora() { Tester tester = serverExtensions.newTester("permessage-deflate; client_max_window_bits"); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/ConnectionStateTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/ConnectionStateTest.java index 9a9880bb410..583177a8c5a 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/ConnectionStateTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/ConnectionStateTest.java @@ -45,7 +45,7 @@ public class ConnectionStateTest } @Test - public void testOpened_Closing() + public void testOpenedClosing() { ConnectionState state = new ConnectionState(); assertTrue(state.opening(), "Opening"); @@ -62,7 +62,7 @@ public class ConnectionStateTest } @Test - public void testOpened_Closing_Disconnected() + public void testOpenedClosingDisconnected() { ConnectionState state = new ConnectionState(); assertTrue(state.opening(), "Opening"); @@ -75,7 +75,7 @@ public class ConnectionStateTest } @Test - public void testOpened_Harsh_Disconnected() + public void testOpenedHarshDisconnected() { ConnectionState state = new ConnectionState(); assertTrue(state.opening(), "Opening"); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java index 701683de962..61317b33e75 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java @@ -106,7 +106,7 @@ public class HttpResponseHeaderParserTest } @Test - public void testParseRealWorldResponse_SmallBuffers() + public void testParseRealWorldResponseSmallBuffers() { // Arbitrary Http Response Headers seen in the wild. // Request URI -> https://ssl.google-analytics.com/__utm.gif diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageDebug.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageDebug.java index 5e36e132292..3ccf9ba9f2e 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageDebug.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageDebug.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.websocket.common.message; import java.nio.ByteBuffer; +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class MessageDebug { public static String toDetailHint(byte[] data, int offset, int len) diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java index 59783150c0f..521ed14adb3 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java @@ -93,6 +93,7 @@ public class Utf8CharBufferTest ByteBuffer buf = ByteBuffer.allocate(64); Utf8CharBuffer utf = Utf8CharBuffer.wrap(buf); + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck byte[] bb = asUTF("Hello A\u00ea\u00f1\u00fcC"); utf.append(bb, 0, bb.length); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitGenerator.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitGenerator.java index 308a1ebe22c..c147aacc85d 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitGenerator.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitGenerator.java @@ -89,7 +89,7 @@ public class UnitGenerator extends Generator public static ByteBuffer generate(List frames) { // Create non-symmetrical mask (helps show mask bytes order issues) - byte[] MASK = + final byte[] MASK = {0x11, 0x22, 0x33, 0x44}; // the generator diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Utf8PartialBuilderTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Utf8PartialBuilderTest.java index 9fe5fb6a7bc..1fc239c9e89 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Utf8PartialBuilderTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Utf8PartialBuilderTest.java @@ -32,13 +32,14 @@ import static org.hamcrest.Matchers.is; */ public class Utf8PartialBuilderTest { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck private ByteBuffer toByteBuffer(String hexStr) { return ByteBuffer.wrap(Hex.asByteArray(hexStr)); } @Test - public void testPartial_UnsplitCodepoint() + public void testPartialUnsplitCodepoint() { Utf8PartialBuilder utf8 = new Utf8PartialBuilder(); @@ -53,7 +54,7 @@ public class Utf8PartialBuilderTest } @Test - public void testPartial_SplitCodepoint() + public void testPartialSplitCodepoint() { Utf8PartialBuilder utf8 = new Utf8PartialBuilder(); @@ -68,7 +69,7 @@ public class Utf8PartialBuilderTest } @Test - public void testPartial_SplitCodepoint_WithNoBuf() + public void testPartialSplitCodepointWithNoBuf() { Utf8PartialBuilder utf8 = new Utf8PartialBuilder(); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/RedirectWebSocketClientTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/RedirectWebSocketClientTest.java index 34a2f53ca5b..df3e72578e2 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/RedirectWebSocketClientTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/RedirectWebSocketClientTest.java @@ -59,23 +59,23 @@ public class RedirectWebSocketClientTest { server = new Server(); - HttpConfiguration http_config = new HttpConfiguration(); - http_config.setSecureScheme("https"); - http_config.setSecurePort(0); - http_config.setOutputBufferSize(32768); - http_config.setRequestHeaderSize(8192); - http_config.setResponseHeaderSize(8192); - http_config.setSendServerVersion(true); - http_config.setSendDateHeader(false); + HttpConfiguration httpConfig = new HttpConfiguration(); + httpConfig.setSecureScheme("https"); + httpConfig.setSecurePort(0); + httpConfig.setOutputBufferSize(32768); + httpConfig.setRequestHeaderSize(8192); + httpConfig.setResponseHeaderSize(8192); + httpConfig.setSendServerVersion(true); + httpConfig.setSendDateHeader(false); SslContextFactory sslContextFactory = newSslContextFactory(); // SSL HTTP Configuration - HttpConfiguration https_config = new HttpConfiguration(http_config); - https_config.addCustomizer(new SecureRequestCustomizer()); + HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); + httpsConfig.addCustomizer(new SecureRequestCustomizer()); // SSL Connector - ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(https_config)); + ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpsConfig)); sslConnector.setPort(0); server.addConnector(sslConnector); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/SimpleServletServer.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/SimpleServletServer.java index a648353835a..2ac2a846df7 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/SimpleServletServer.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/SimpleServletServer.java @@ -78,14 +78,14 @@ public class SimpleServletServer if (ssl) { // HTTP Configuration - HttpConfiguration http_config = new HttpConfiguration(); - http_config.setSecureScheme("https"); - http_config.setSecurePort(0); - http_config.setOutputBufferSize(32768); - http_config.setRequestHeaderSize(8192); - http_config.setResponseHeaderSize(8192); - http_config.setSendServerVersion(true); - http_config.setSendDateHeader(false); + HttpConfiguration httpConfig = new HttpConfiguration(); + httpConfig.setSecureScheme("https"); + httpConfig.setSecurePort(0); + httpConfig.setOutputBufferSize(32768); + httpConfig.setRequestHeaderSize(8192); + httpConfig.setResponseHeaderSize(8192); + httpConfig.setSendServerVersion(true); + httpConfig.setSendDateHeader(false); sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStorePath(MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath()); @@ -93,11 +93,11 @@ public class SimpleServletServer sslContextFactory.setKeyManagerPassword("keypwd"); // SSL HTTP Configuration - HttpConfiguration https_config = new HttpConfiguration(http_config); - https_config.addCustomizer(new SecureRequestCustomizer()); + HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); + httpsConfig.addCustomizer(new SecureRequestCustomizer()); // SSL Connector - connector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(https_config)); + connector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpsConfig)); connector.setPort(0); } else diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java index b64320f0760..335aa29694a 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java @@ -40,7 +40,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_1() throws Exception + public void testCase111() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame()); @@ -65,7 +65,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_2() throws Exception + public void testCase112() throws Exception { byte[] payload = new byte[125]; Arrays.fill(payload, (byte)'*'); @@ -94,7 +94,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_3() throws Exception + public void testCase113() throws Exception { byte[] payload = new byte[126]; Arrays.fill(payload, (byte)'*'); @@ -123,7 +123,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_4() throws Exception + public void testCase114() throws Exception { byte[] payload = new byte[127]; Arrays.fill(payload, (byte)'*'); @@ -152,7 +152,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_5() throws Exception + public void testCase115() throws Exception { byte[] payload = new byte[128]; Arrays.fill(payload, (byte)'*'); @@ -181,7 +181,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_6() throws Exception + public void testCase116() throws Exception { byte[] payload = new byte[65535]; Arrays.fill(payload, (byte)'*'); @@ -210,7 +210,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_7() throws Exception + public void testCase117() throws Exception { byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)'*'); @@ -243,7 +243,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_1_8() throws Exception + public void testCase118() throws Exception { byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)'*'); @@ -274,7 +274,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_1() throws Exception + public void testCase121() throws Exception { List send = new ArrayList<>(); send.add(new BinaryFrame()); @@ -299,7 +299,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_2() throws Exception + public void testCase122() throws Exception { byte[] payload = new byte[125]; Arrays.fill(payload, (byte)0xFE); @@ -328,7 +328,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_3() throws Exception + public void testCase123() throws Exception { byte[] payload = new byte[126]; Arrays.fill(payload, (byte)0xFE); @@ -357,7 +357,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_4() throws Exception + public void testCase124() throws Exception { byte[] payload = new byte[127]; Arrays.fill(payload, (byte)0xFE); @@ -386,7 +386,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_5() throws Exception + public void testCase125() throws Exception { byte[] payload = new byte[128]; Arrays.fill(payload, (byte)0xFE); @@ -415,7 +415,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_6() throws Exception + public void testCase126() throws Exception { byte[] payload = new byte[65535]; Arrays.fill(payload, (byte)0xFE); @@ -444,7 +444,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_7() throws Exception + public void testCase127() throws Exception { byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)0xFE); @@ -477,7 +477,7 @@ public class TestABCase1 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase1_2_8() throws Exception + public void testCase128() throws Exception { byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)0xFE); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java index 60f5ae412c0..e7f18180402 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java @@ -43,7 +43,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_1() throws Exception + public void testCase21() throws Exception { WebSocketFrame send = new PingFrame(); @@ -64,7 +64,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_10() throws Exception + public void testCase210() throws Exception { // send 10 pings each with unique payload // send close @@ -100,7 +100,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_11() throws Exception + public void testCase211() throws Exception { // send 10 pings (slowly) each with unique payload // send close @@ -137,7 +137,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_2() throws Exception + public void testCase22() throws Exception { byte[] payload = StringUtil.getUtf8Bytes("Hello world"); @@ -164,7 +164,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_3() throws Exception + public void testCase23() throws Exception { byte[] payload = new byte[]{0x00, (byte)0xFF, (byte)0xFE, (byte)0xFD, (byte)0xFC, (byte)0xFB, 0x00, (byte)0xFF}; @@ -191,7 +191,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_4() throws Exception + public void testCase24() throws Exception { byte[] payload = new byte[125]; Arrays.fill(payload, (byte)0xFE); @@ -219,7 +219,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_5() throws Exception + public void testCase25() throws Exception { try (StacklessLogging scope = new StacklessLogging(Parser.class)) { @@ -251,7 +251,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_6() throws Exception + public void testCase26() throws Exception { byte[] payload = new byte[125]; Arrays.fill(payload, (byte)'6'); @@ -280,7 +280,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_7() throws Exception + public void testCase27() throws Exception { List send = new ArrayList<>(); send.add(new PongFrame()); // unsolicited pong @@ -304,7 +304,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_8() throws Exception + public void testCase28() throws Exception { List send = new ArrayList<>(); send.add(new PongFrame().setPayload("unsolicited")); // unsolicited pong @@ -328,7 +328,7 @@ public class TestABCase2 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase2_9() throws Exception + public void testCase29() throws Exception { List send = new ArrayList<>(); send.add(new PongFrame().setPayload("unsolicited")); // unsolicited pong diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java index 3d061f30509..c0ee0fdef2a 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java @@ -44,7 +44,7 @@ public class TestABCase3 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase3_1() throws Exception + public void testCase31() throws Exception { WebSocketFrame send = new TextFrame().setPayload("small").setRsv1(true); // intentionally bad @@ -66,7 +66,7 @@ public class TestABCase3 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase3_2() throws Exception + public void testCase32() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("small")); @@ -93,7 +93,7 @@ public class TestABCase3 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase3_3() throws Exception + public void testCase33() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("small")); @@ -120,7 +120,7 @@ public class TestABCase3 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase3_4() throws Exception + public void testCase34() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("small")); @@ -148,7 +148,7 @@ public class TestABCase3 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase3_5() throws Exception + public void testCase35() throws Exception { byte[] payload = new byte[8]; Arrays.fill(payload, (byte)0xFF); @@ -175,7 +175,7 @@ public class TestABCase3 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase3_6() throws Exception + public void testCase36() throws Exception { byte[] payload = new byte[8]; Arrays.fill(payload, (byte)0xFF); @@ -202,7 +202,7 @@ public class TestABCase3 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase3_7() throws Exception + public void testCase37() throws Exception { byte[] payload = new byte[8]; Arrays.fill(payload, (byte)0xFF); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java index b78500c1cea..e1975830ebf 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java @@ -44,7 +44,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_1_1() throws Exception + public void testCase411() throws Exception { List send = new ArrayList<>(); send.add(new BadFrame((byte)3)); // intentionally bad @@ -68,7 +68,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_1_2() throws Exception + public void testCase412() throws Exception { byte[] payload = StringUtil.getUtf8Bytes("reserved payload"); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -95,7 +95,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_1_3() throws Exception + public void testCase413() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello")); @@ -122,7 +122,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_1_4() throws Exception + public void testCase414() throws Exception { ByteBuffer buf = ByteBuffer.wrap(StringUtil.getUtf8Bytes("bad")); @@ -151,7 +151,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_1_5() throws Exception + public void testCase415() throws Exception { ByteBuffer buf = ByteBuffer.wrap(StringUtil.getUtf8Bytes("bad")); @@ -180,7 +180,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_2_1() throws Exception + public void testCase421() throws Exception { List send = new ArrayList<>(); send.add(new BadFrame((byte)11)); // intentionally bad @@ -204,7 +204,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_2_2() throws Exception + public void testCase422() throws Exception { ByteBuffer buf = ByteBuffer.wrap(StringUtil.getUtf8Bytes("bad")); @@ -230,7 +230,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_2_3() throws Exception + public void testCase423() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello")); @@ -257,7 +257,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_2_4() throws Exception + public void testCase424() throws Exception { ByteBuffer buf = ByteBuffer.wrap(StringUtil.getUtf8Bytes("bad")); @@ -286,7 +286,7 @@ public class TestABCase4 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase4_2_5() throws Exception + public void testCase425() throws Exception { ByteBuffer buf = ByteBuffer.wrap(StringUtil.getUtf8Bytes("bad")); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java index 21d1748c9aa..185c607e53a 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase5.java @@ -45,7 +45,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_1() throws Exception + public void testCase51() throws Exception { List send = new ArrayList<>(); send.add(new PingFrame().setPayload("hello, ").setFin(false)); @@ -71,7 +71,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_10() throws Exception + public void testCase510() throws Exception { List send = new ArrayList<>(); send.add(new ContinuationFrame().setPayload("sorry").setFin(true)); @@ -97,7 +97,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_11() throws Exception + public void testCase511() throws Exception { List send = new ArrayList<>(); send.add(new ContinuationFrame().setPayload("sorry").setFin(true)); @@ -124,7 +124,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_12() throws Exception + public void testCase512() throws Exception { List send = new ArrayList<>(); send.add(new ContinuationFrame().setPayload("sorry").setFin(false)); @@ -150,7 +150,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_13() throws Exception + public void testCase513() throws Exception { List send = new ArrayList<>(); send.add(new ContinuationFrame().setPayload("sorry").setFin(false)); @@ -176,7 +176,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_14() throws Exception + public void testCase514() throws Exception { List send = new ArrayList<>(); send.add(new ContinuationFrame().setPayload("sorry").setFin(false)); @@ -203,7 +203,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_15() throws Exception + public void testCase515() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("fragment1").setFin(false)); @@ -232,7 +232,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_16() throws Exception + public void testCase516() throws Exception { List send = new ArrayList<>(); send.add(new ContinuationFrame().setPayload("fragment1").setFin(false)); // bad frame @@ -262,7 +262,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_17() throws Exception + public void testCase517() throws Exception { List send = new ArrayList<>(); send.add(new ContinuationFrame().setPayload("fragment1").setFin(true)); // nothing to continue @@ -292,7 +292,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_18() throws Exception + public void testCase518() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("fragment1").setFin(false)); @@ -318,7 +318,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_19() throws Exception + public void testCase519() throws Exception { // phase 1 List send1 = new ArrayList<>(); @@ -367,7 +367,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_2() throws Exception + public void testCase52() throws Exception { List send = new ArrayList<>(); send.add(new PongFrame().setPayload("hello, ").setFin(false)); @@ -393,7 +393,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_20() throws Exception + public void testCase520() throws Exception { List send1 = new ArrayList<>(); send1.add(new TextFrame().setPayload("f1").setFin(false)); @@ -437,7 +437,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_20_slow() throws Exception + public void testCase520Slow() throws Exception { List send1 = new ArrayList<>(); send1.add(new TextFrame().setPayload("f1").setFin(false)); @@ -482,7 +482,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_3() throws Exception + public void testCase53() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello, ").setFin(false)); @@ -509,7 +509,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_4() throws Exception + public void testCase54() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello, ").setFin(false)); @@ -536,7 +536,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_5() throws Exception + public void testCase55() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello, ").setFin(false)); @@ -564,7 +564,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_6() throws Exception + public void testCase56() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello, ").setFin(false)); @@ -593,7 +593,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_7() throws Exception + public void testCase57() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello, ").setFin(false)); @@ -622,7 +622,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_8() throws Exception + public void testCase58() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("hello, ").setFin(false)); @@ -652,7 +652,7 @@ public class TestABCase5 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase5_9() throws Exception + public void testCase59() throws Exception { List send = new ArrayList<>(); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java index 3ef1b5c39d3..57a01d04eb8 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java @@ -40,6 +40,7 @@ import org.junit.jupiter.api.Test; /** * UTF-8 Tests */ +// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck public class TestABCase6 extends AbstractABCase { /** @@ -80,7 +81,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_1_1() throws Exception + public void testCase611() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame()); @@ -105,7 +106,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_1_2() throws Exception + public void testCase612() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setFin(false)); @@ -132,7 +133,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_1_3() throws Exception + public void testCase613() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setFin(false)); @@ -159,7 +160,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_2_2() throws Exception + public void testCase622() throws Exception { String utf1 = "Hello-\uC2B5@\uC39F\uC3A4"; String utf2 = "\uC3BC\uC3A0\uC3A1-UTF-8!!"; @@ -195,7 +196,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_2_3() throws Exception + public void testCase623() throws Exception { String utf8 = "Hello-\uC2B5@\uC39F\uC3A4\uC3BC\uC3A0\uC3A1-UTF-8!!"; byte[] msg = StringUtil.getUtf8Bytes(utf8); @@ -223,7 +224,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_2_4() throws Exception + public void testCase624() throws Exception { byte[] msg = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5"); @@ -250,7 +251,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_3_2() throws Exception + public void testCase632() throws Exception { byte[] invalid = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5EDA080656469746564"); @@ -280,7 +281,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_4_1() throws Exception + public void testCase641() throws Exception { byte[] part1 = StringUtil.getUtf8Bytes("\u03BA\u1F79\u03C3\u03BC\u03B5"); byte[] part2 = Hex.asByteArray("F4908080"); // invalid @@ -320,7 +321,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_4_2() throws Exception + public void testCase642() throws Exception { byte[] part1 = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5F4"); // split code point byte[] part2 = Hex.asByteArray("90"); // continue code point & invalid @@ -354,7 +355,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_4_3() throws Exception + public void testCase643() throws Exception { // Disable Long Stacks from Parser (we know this test will throw an exception) try (StacklessLogging scope = new StacklessLogging(Parser.class)) @@ -405,7 +406,7 @@ public class TestABCase6 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase6_4_4() throws Exception + public void testCase644() throws Exception { byte[] invalid = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5F49080808080656469746564"); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6_BadUTF.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6BadUTF.java similarity index 99% rename from jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6_BadUTF.java rename to jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6BadUTF.java index 2ae8601dee5..fe9f91fa34c 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6_BadUTF.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6BadUTF.java @@ -38,7 +38,7 @@ import org.junit.jupiter.params.provider.MethodSource; /** * Tests of Known Bad UTF8 sequences that should trigger a {@link StatusCode#BAD_PAYLOAD} close and early connection termination */ -public class TestABCase6_BadUTF extends AbstractABCase +public class TestABCase6BadUTF extends AbstractABCase { public static Stream utfSequences() { diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6_GoodUTF.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6GoodUTF.java similarity index 97% rename from jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6_GoodUTF.java rename to jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6GoodUTF.java index ba308a6e0db..6092adc8046 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6_GoodUTF.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6GoodUTF.java @@ -40,9 +40,9 @@ import org.junit.jupiter.params.provider.MethodSource; *

* Should be preserved / echoed back, with normal close code. */ -public class TestABCase6_GoodUTF extends AbstractABCase +public class TestABCase6GoodUTF extends AbstractABCase { - private static final Logger LOG = Log.getLogger(TestABCase6_GoodUTF.class); + private static final Logger LOG = Log.getLogger(TestABCase6GoodUTF.class); public static Stream utfSequences() { diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java index b6a5fadf122..d2f693775fe 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java @@ -51,7 +51,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_1_1() throws Exception + public void testCase711() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("Hello World")); @@ -76,7 +76,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_1_2() throws Exception + public void testCase712() throws Exception { List send = new ArrayList<>(); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -101,7 +101,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_1_3() throws Exception + public void testCase713() throws Exception { List send = new ArrayList<>(); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -126,7 +126,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_1_4() throws Exception + public void testCase714() throws Exception { List send = new ArrayList<>(); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -151,7 +151,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_1_5() throws Exception + public void testCase715() throws Exception { List send = new ArrayList<>(); send.add(new TextFrame().setPayload("an").setFin(false)); @@ -177,7 +177,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_1_6() throws Exception + public void testCase716() throws Exception { byte[] msg = new byte[256 * 1024]; Arrays.fill(msg, (byte)'*'); @@ -208,7 +208,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_3_1() throws Exception + public void testCase731() throws Exception { List send = new ArrayList<>(); send.add(new CloseFrame()); @@ -232,7 +232,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_3_2() throws Exception + public void testCase732() throws Exception { byte[] payload = new byte[]{0x00}; ByteBuffer buf = ByteBuffer.wrap(payload); @@ -260,7 +260,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_3_3() throws Exception + public void testCase733() throws Exception { List send = new ArrayList<>(); send.add(new CloseInfo(StatusCode.NORMAL).asFrame()); @@ -284,7 +284,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_3_4() throws Exception + public void testCase734() throws Exception { List send = new ArrayList<>(); send.add(new CloseInfo(StatusCode.NORMAL, "Hic").asFrame()); @@ -308,7 +308,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_3_5() throws Exception + public void testCase735() throws Exception { byte[] utf = new byte[123]; Arrays.fill(utf, (byte)'!'); @@ -337,7 +337,7 @@ public class TestABCase7 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase7_5_1() throws Exception + public void testCase751() throws Exception { ByteBuffer payload = ByteBuffer.allocate(256); BufferUtil.clearToFill(payload); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7_BadStatusCodes.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7BadStatusCodes.java similarity index 96% rename from jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7_BadStatusCodes.java rename to jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7BadStatusCodes.java index 508d7dd864c..ed41cbd1617 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7_BadStatusCodes.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7BadStatusCodes.java @@ -39,9 +39,9 @@ import org.junit.jupiter.params.provider.MethodSource; /** * Test Bad Close Status Codes */ -public class TestABCase7_BadStatusCodes extends AbstractABCase +public class TestABCase7BadStatusCodes extends AbstractABCase { - private static final Logger LOG = Log.getLogger(TestABCase7_GoodStatusCodes.class); + private static final Logger LOG = Log.getLogger(TestABCase7GoodStatusCodes.class); public static Stream data() { diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7_GoodStatusCodes.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7GoodStatusCodes.java similarity index 96% rename from jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7_GoodStatusCodes.java rename to jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7GoodStatusCodes.java index f874f359094..312981882c7 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7_GoodStatusCodes.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7GoodStatusCodes.java @@ -37,9 +37,9 @@ import org.junit.jupiter.params.provider.MethodSource; /** * Test Good Close Status Codes */ -public class TestABCase7_GoodStatusCodes extends AbstractABCase +public class TestABCase7GoodStatusCodes extends AbstractABCase { - private static final Logger LOG = Log.getLogger(TestABCase7_GoodStatusCodes.class); + private static final Logger LOG = Log.getLogger(TestABCase7GoodStatusCodes.class); public static Stream statusCodes() { diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java index e2dca6a0e79..88c567c0b60 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java @@ -131,7 +131,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_1_1() throws Exception + public void testCase911() throws Exception { byte[] utf = new byte[64 * KBYTE]; Arrays.fill(utf, (byte)'y'); @@ -160,7 +160,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_1_2() throws Exception + public void testCase912() throws Exception { byte[] utf = new byte[256 * KBYTE]; Arrays.fill(utf, (byte)'y'); @@ -189,7 +189,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_1_3() throws Exception + public void testCase913() throws Exception { byte[] utf = new byte[1 * MBYTE]; Arrays.fill(utf, (byte)'y'); @@ -218,7 +218,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_1_4() throws Exception + public void testCase914() throws Exception { byte[] utf = new byte[4 * MBYTE]; Arrays.fill(utf, (byte)'y'); @@ -247,7 +247,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_1_5() throws Exception + public void testCase915() throws Exception { byte[] utf = new byte[8 * MBYTE]; Arrays.fill(utf, (byte)'y'); @@ -276,7 +276,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_1_6() throws Exception + public void testCase916() throws Exception { byte[] utf = new byte[16 * MBYTE]; Arrays.fill(utf, (byte)'y'); @@ -305,7 +305,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_2_1() throws Exception + public void testCase921() throws Exception { byte[] data = new byte[64 * KBYTE]; Arrays.fill(data, (byte)0x21); @@ -333,7 +333,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_2_2() throws Exception + public void testCase922() throws Exception { byte[] data = new byte[256 * KBYTE]; Arrays.fill(data, (byte)0x22); @@ -362,7 +362,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_2_3() throws Exception + public void testCase923() throws Exception { byte[] data = new byte[1 * MBYTE]; Arrays.fill(data, (byte)0x23); @@ -391,7 +391,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_2_4() throws Exception + public void testCase924() throws Exception { byte[] data = new byte[4 * MBYTE]; Arrays.fill(data, (byte)0x24); @@ -420,7 +420,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_2_5() throws Exception + public void testCase925() throws Exception { byte[] data = new byte[8 * MBYTE]; Arrays.fill(data, (byte)0x25); @@ -449,7 +449,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_2_6() throws Exception + public void testCase926() throws Exception { byte[] data = new byte[16 * MBYTE]; Arrays.fill(data, (byte)0x26); @@ -478,7 +478,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_1() throws Exception + public void testCase931() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 64); } @@ -489,7 +489,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_2() throws Exception + public void testCase932() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 256); } @@ -500,7 +500,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_3() throws Exception + public void testCase933() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 1 * KBYTE); } @@ -511,7 +511,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_4() throws Exception + public void testCase934() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 4 * KBYTE); } @@ -522,7 +522,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_5() throws Exception + public void testCase935() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 16 * KBYTE); } @@ -533,7 +533,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_6() throws Exception + public void testCase936() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 64 * KBYTE); } @@ -544,7 +544,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_7() throws Exception + public void testCase937() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 256 * KBYTE); } @@ -555,7 +555,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_8() throws Exception + public void testCase938() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 1 * MBYTE); } @@ -566,7 +566,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_3_9() throws Exception + public void testCase939() throws Exception { assertMultiFrameEcho(OpCode.TEXT, 4 * MBYTE, 4 * MBYTE); } @@ -577,7 +577,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_1() throws Exception + public void testCase941() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 64); } @@ -588,7 +588,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_2() throws Exception + public void testCase942() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 256); } @@ -599,7 +599,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_3() throws Exception + public void testCase943() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 1 * KBYTE); } @@ -610,7 +610,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_4() throws Exception + public void testCase944() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 4 * KBYTE); } @@ -621,7 +621,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_5() throws Exception + public void testCase945() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 16 * KBYTE); } @@ -632,7 +632,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_6() throws Exception + public void testCase946() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 64 * KBYTE); } @@ -643,7 +643,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_7() throws Exception + public void testCase947() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 256 * KBYTE); } @@ -654,7 +654,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_8() throws Exception + public void testCase948() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 1 * MBYTE); } @@ -665,7 +665,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_4_9() throws Exception + public void testCase949() throws Exception { assertMultiFrameEcho(OpCode.BINARY, 4 * MBYTE, 4 * MBYTE); } @@ -676,7 +676,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_5_1() throws Exception + public void testCase951() throws Exception { assertSlowFrameEcho(OpCode.TEXT, 1 * MBYTE, 64); } @@ -687,7 +687,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_5_2() throws Exception + public void testCase952() throws Exception { assertSlowFrameEcho(OpCode.TEXT, 1 * MBYTE, 128); } @@ -698,7 +698,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_5_3() throws Exception + public void testCase953() throws Exception { assertSlowFrameEcho(OpCode.TEXT, 1 * MBYTE, 256); } @@ -709,7 +709,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_5_4() throws Exception + public void testCase954() throws Exception { assertSlowFrameEcho(OpCode.TEXT, 1 * MBYTE, 512); } @@ -720,7 +720,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_5_5() throws Exception + public void testCase955() throws Exception { assertSlowFrameEcho(OpCode.TEXT, 1 * MBYTE, 1024); } @@ -731,7 +731,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_5_6() throws Exception + public void testCase956() throws Exception { assertSlowFrameEcho(OpCode.TEXT, 1 * MBYTE, 2048); } @@ -742,7 +742,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_6_1() throws Exception + public void testCase961() throws Exception { assertSlowFrameEcho(OpCode.BINARY, 1 * MBYTE, 64); } @@ -753,7 +753,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_6_2() throws Exception + public void testCase962() throws Exception { assertSlowFrameEcho(OpCode.BINARY, 1 * MBYTE, 128); } @@ -764,7 +764,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_6_3() throws Exception + public void testCase963() throws Exception { assertSlowFrameEcho(OpCode.BINARY, 1 * MBYTE, 256); } @@ -775,7 +775,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_6_4() throws Exception + public void testCase964() throws Exception { assertSlowFrameEcho(OpCode.BINARY, 1 * MBYTE, 512); } @@ -786,7 +786,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_6_5() throws Exception + public void testCase965() throws Exception { assertSlowFrameEcho(OpCode.BINARY, 1 * MBYTE, 1024); } @@ -797,7 +797,7 @@ public class TestABCase9 extends AbstractABCase * @throws Exception on test failure */ @Test - public void testCase9_6_6() throws Exception + public void testCase966() throws Exception { assertSlowFrameEcho(OpCode.BINARY, 1 * MBYTE, 2048); } diff --git a/tests/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationsTest.java b/tests/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationsTest.java index e6c9b0907b4..07d461177f8 100644 --- a/tests/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationsTest.java +++ b/tests/test-continuation/src/test/java/org/eclipse/jetty/continuation/ContinuationsTest.java @@ -408,44 +408,44 @@ public class ContinuationsTest history.add(continuation.getClass().getName()); - int read_before = 0; - long sleep_for = -1; - long suspend_for = -1; - long suspend2_for = -1; - long resume_after = -1; - long resume2_after = -1; - long complete_after = -1; - long complete2_after = -1; + int readBefore = 0; + long sleepFor = -1; + long suspendFor = -1; + long suspend2For = -1; + long resumeAfter = -1; + long resume2After = -1; + long completeAfter = -1; + long complete2After = -1; boolean undispatch = false; if (request.getParameter("read") != null) - read_before = Integer.parseInt(request.getParameter("read")); + readBefore = Integer.parseInt(request.getParameter("read")); if (request.getParameter("sleep") != null) - sleep_for = Integer.parseInt(request.getParameter("sleep")); + sleepFor = Integer.parseInt(request.getParameter("sleep")); if (request.getParameter("suspend") != null) - suspend_for = Integer.parseInt(request.getParameter("suspend")); + suspendFor = Integer.parseInt(request.getParameter("suspend")); if (request.getParameter("suspend2") != null) - suspend2_for = Integer.parseInt(request.getParameter("suspend2")); + suspend2For = Integer.parseInt(request.getParameter("suspend2")); if (request.getParameter("resume") != null) - resume_after = Integer.parseInt(request.getParameter("resume")); + resumeAfter = Integer.parseInt(request.getParameter("resume")); if (request.getParameter("resume2") != null) - resume2_after = Integer.parseInt(request.getParameter("resume2")); + resume2After = Integer.parseInt(request.getParameter("resume2")); if (request.getParameter("complete") != null) - complete_after = Integer.parseInt(request.getParameter("complete")); + completeAfter = Integer.parseInt(request.getParameter("complete")); if (request.getParameter("complete2") != null) - complete2_after = Integer.parseInt(request.getParameter("complete2")); + complete2After = Integer.parseInt(request.getParameter("complete2")); if (request.getParameter("undispatch") != null) undispatch = Boolean.parseBoolean(request.getParameter("undispatch")); if (continuation.isInitial()) { history.add("initial"); - if (read_before > 0) + if (readBefore > 0) { - byte[] buf = new byte[read_before]; + byte[] buf = new byte[readBefore]; request.getInputStream().read(buf); } - else if (read_before < 0) + else if (readBefore < 0) { InputStream in = request.getInputStream(); int b = in.read(); @@ -455,15 +455,15 @@ public class ContinuationsTest } } - if (suspend_for >= 0) + if (suspendFor >= 0) { - if (suspend_for > 0) - continuation.setTimeout(suspend_for); + if (suspendFor > 0) + continuation.setTimeout(suspendFor); continuation.addContinuationListener(listener); history.add("suspend"); continuation.suspend(response); - if (complete_after > 0) + if (completeAfter > 0) { TimerTask complete = new TimerTask() { @@ -482,15 +482,15 @@ public class ContinuationsTest } } }; - _timer.schedule(complete, complete_after); + _timer.schedule(complete, completeAfter); } - else if (complete_after == 0) + else if (completeAfter == 0) { response.setStatus(200); response.getOutputStream().println("COMPLETED"); continuation.complete(); } - else if (resume_after > 0) + else if (resumeAfter > 0) { TimerTask resume = new TimerTask() { @@ -501,9 +501,9 @@ public class ContinuationsTest continuation.resume(); } }; - _timer.schedule(resume, resume_after); + _timer.schedule(resume, resumeAfter); } - else if (resume_after == 0) + else if (resumeAfter == 0) { history.add("resume"); continuation.resume(); @@ -514,11 +514,11 @@ public class ContinuationsTest continuation.undispatch(); } } - else if (sleep_for >= 0) + else if (sleepFor >= 0) { try { - Thread.sleep(sleep_for); + Thread.sleep(sleepFor); } catch (InterruptedException e) { @@ -536,17 +536,17 @@ public class ContinuationsTest else { history.add("!initial"); - if (suspend2_for >= 0 && request.getAttribute("2nd") == null) + if (suspend2For >= 0 && request.getAttribute("2nd") == null) { request.setAttribute("2nd", "cycle"); - if (suspend2_for > 0) - continuation.setTimeout(suspend2_for); + if (suspend2For > 0) + continuation.setTimeout(suspend2For); history.add("suspend"); continuation.suspend(response); - if (complete2_after > 0) + if (complete2After > 0) { TimerTask complete = new TimerTask() { @@ -565,15 +565,15 @@ public class ContinuationsTest } } }; - _timer.schedule(complete, complete2_after); + _timer.schedule(complete, complete2After); } - else if (complete2_after == 0) + else if (complete2After == 0) { response.setStatus(200); response.getOutputStream().println("COMPLETED"); continuation.complete(); } - else if (resume2_after > 0) + else if (resume2After > 0) { TimerTask resume = new TimerTask() { @@ -584,9 +584,9 @@ public class ContinuationsTest continuation.resume(); } }; - _timer.schedule(resume, resume2_after); + _timer.schedule(resume, resume2After); } - else if (resume2_after == 0) + else if (resume2After == 0) { history.add("resume"); continuation.resume(); diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/BadAppTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/BadAppTests.java index bd4d0a0d7ae..90f6c2f1296 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/BadAppTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/BadAppTests.java @@ -44,7 +44,7 @@ public class BadAppTests extends AbstractDistributionTest * It is expected that the server does not start and exits with an error code */ @Test - public void testXml_ThrowOnUnavailable_True() throws Exception + public void testXmlThrowOnUnavailableTrue() throws Exception { String jettyVersion = System.getProperty("jettyVersion"); DistributionTester distribution = DistributionTester.Builder.newInstance() @@ -81,7 +81,7 @@ public class BadAppTests extends AbstractDistributionTest * that it is unavailable. */ @Test - public void testXml_ThrowOnUnavailable_False() throws Exception + public void testXmlThrowOnUnavailableFalse() throws Exception { String jettyVersion = System.getProperty("jettyVersion"); DistributionTester distribution = DistributionTester.Builder.newInstance() @@ -123,7 +123,7 @@ public class BadAppTests extends AbstractDistributionTest * that it is unavailable. */ @Test - public void testNoXml_ThrowOnUnavailable_Default() throws Exception + public void testNoXmlThrowOnUnavailableDefault() throws Exception { String jettyVersion = System.getProperty("jettyVersion"); DistributionTester distribution = DistributionTester.Builder.newInstance() diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientContinueTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientContinueTest.java index 75e80477975..ec752ecac38 100644 --- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientContinueTest.java +++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientContinueTest.java @@ -76,19 +76,19 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithOneContent_Respond100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithOneContentRespond100Continue(Transport transport) throws Exception { - test_Expect100Continue_Respond100Continue(transport, "data1".getBytes(StandardCharsets.UTF_8)); + testExpect100ContinueRespond100Continue(transport, "data1".getBytes(StandardCharsets.UTF_8)); } @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithMultipleContents_Respond100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithMultipleContentsRespond100Continue(Transport transport) throws Exception { - test_Expect100Continue_Respond100Continue(transport, "data1".getBytes(StandardCharsets.UTF_8), "data2".getBytes(StandardCharsets.UTF_8), "data3".getBytes(StandardCharsets.UTF_8)); + testExpect100ContinueRespond100Continue(transport, "data1".getBytes(StandardCharsets.UTF_8), "data2".getBytes(StandardCharsets.UTF_8), "data3".getBytes(StandardCharsets.UTF_8)); } - private void test_Expect100Continue_Respond100Continue(Transport transport, byte[]... contents) throws Exception + private void testExpect100ContinueRespond100Continue(Transport transport, byte[]... contents) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -124,7 +124,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithChunkedContent_Respond100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithChunkedContentRespond100Continue(Transport transport) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -173,19 +173,19 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithContent_Respond417ExpectationFailed(Transport transport) throws Exception + public void testExpect100ContinueWithContentRespond417ExpectationFailed(Transport transport) throws Exception { - test_Expect100Continue_WithContent_RespondError(transport, 417); + testExpect100ContinueWithContentRespondError(transport, 417); } @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithContent_Respond413RequestEntityTooLarge(Transport transport) throws Exception + public void testExpect100ContinueWithContentRespond413RequestEntityTooLarge(Transport transport) throws Exception { - test_Expect100Continue_WithContent_RespondError(transport, 413); + testExpect100ContinueWithContentRespondError(transport, 413); } - private void test_Expect100Continue_WithContent_RespondError(Transport transport, final int error) throws Exception + private void testExpect100ContinueWithContentRespondError(Transport transport, final int error) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -225,7 +225,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithContent_WithRedirect(Transport transport) throws Exception + public void testExpect100ContinueWithContentWithRedirect(Transport transport) throws Exception { init(transport); final String data = "success"; @@ -273,7 +273,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Redirect_WithExpect100Continue_WithContent(Transport transport) throws Exception + public void testRedirectWithExpect100ContinueWithContent(Transport transport) throws Exception { init(transport); // A request with Expect: 100-Continue cannot receive non-final responses like 3xx @@ -326,7 +326,7 @@ public class HttpClientContinueTest extends AbstractTest @ArgumentsSource(TransportProvider.class) @Tag("Slow") @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_Expect100Continue_WithContent_WithResponseFailure_Before100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithContentWithResponseFailureBefore100Continue(Transport transport) throws Exception { init(transport); final long idleTimeout = 1000; @@ -374,7 +374,7 @@ public class HttpClientContinueTest extends AbstractTest @ArgumentsSource(TransportProvider.class) @Tag("Slow") @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_Expect100Continue_WithContent_WithResponseFailure_After100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithContentWithResponseFailureAfter100Continue(Transport transport) throws Exception { init(transport); final long idleTimeout = 1000; @@ -421,7 +421,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithContent_WithResponseFailure_During100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithContentWithResponseFailureDuring100Continue(Transport transport) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -483,7 +483,7 @@ public class HttpClientContinueTest extends AbstractTest @ArgumentsSource(TransportProvider.class) @Tag("Slow") @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_Expect100Continue_WithDeferredContent_Respond100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithDeferredContentRespond100Continue(Transport transport) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -534,7 +534,7 @@ public class HttpClientContinueTest extends AbstractTest @ArgumentsSource(TransportProvider.class) @Tag("Slow") @DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review - public void test_Expect100Continue_WithInitialAndDeferredContent_Respond100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithInitialAndDeferredContentRespond100Continue(Transport transport) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -579,7 +579,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithConcurrentDeferredContent_Respond100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithConcurrentDeferredContentRespond100Continue(Transport transport) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -620,7 +620,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithInitialAndConcurrentDeferredContent_Respond100Continue(Transport transport) throws Exception + public void testExpect100ContinueWithInitialAndConcurrentDeferredContentRespond100Continue(Transport transport) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -679,7 +679,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_Expect100Continue_WithTwoResponsesInOneRead(Transport transport) throws Exception + public void testExpect100ContinueWithTwoResponsesInOneRead(Transport transport) throws Exception { init(transport); assumeTrue(scenario.transport.isHttp1Based()); @@ -739,7 +739,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_NoExpect_Respond100Continue(Transport transport) throws Exception + public void testNoExpectRespond100Continue(Transport transport) throws Exception { init(transport); scenario.start(new AbstractHandler() @@ -768,7 +768,7 @@ public class HttpClientContinueTest extends AbstractTest @ParameterizedTest @ArgumentsSource(TransportProvider.class) - public void test_NoExpect_100Continue_ThenRedirect_Then100Continue_ThenResponse(Transport transport) throws Exception + public void testNoExpect100ContinueThenRedirectThen100ContinueThenResponse(Transport transport) throws Exception { init(transport); assumeTrue(scenario.transport.isHttp1Based()); diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java index 0156a48a665..ba144e5a5e6 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DefaultHandlerTest.java @@ -78,7 +78,7 @@ public class DefaultHandlerTest } @Test - public void testGET_URL() throws Exception + public void testGetURL() throws Exception { URL url = new URL("http://localhost:" + serverPort + "/tests/alpha.txt"); URLConnection conn = url.openConnection(); @@ -93,7 +93,7 @@ public class DefaultHandlerTest } @Test - public void testGET_Raw() throws Exception + public void testGetRaw() throws Exception { StringBuffer rawRequest = new StringBuffer(); rawRequest.append("GET /tests/alpha.txt HTTP/1.1\r\n"); @@ -118,7 +118,7 @@ public class DefaultHandlerTest } @Test - public void testGET_HttpTesting() throws Exception + public void testGetHttpTesting() throws Exception { HttpTester.Request request = HttpTester.newRequest(); request.setMethod("GET"); diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorTest.java index e6df59aa66d..46aa8e050fe 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/DeploymentErrorTest.java @@ -166,7 +166,7 @@ public class DeploymentErrorTest * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=true;}. */ @Test - public void testInitial_BadApp_UnavailableTrue() + public void testInitialBadAppUnavailableTrue() { assertThrows(NoClassDefFoundError.class, () -> { @@ -183,7 +183,7 @@ public class DeploymentErrorTest * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=false;}. */ @Test - public void testInitial_BadApp_UnavailableFalse() throws Exception + public void testInitialBadAppUnavailableFalse() throws Exception { startServer(docroots -> copyBadApp("badapp-unavailable-false.xml", docroots)); @@ -220,7 +220,7 @@ public class DeploymentErrorTest * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=true;}. */ @Test - public void testDelayedAdd_BadApp_UnavailableTrue() throws Exception + public void testDelayedAddBadAppUnavailableTrue() throws Exception { Path docroots = startServer(null); @@ -266,7 +266,7 @@ public class DeploymentErrorTest * The webapp is a WebAppContext with {@code throwUnavailableOnStartupException=false;}. */ @Test - public void testDelayedAdd_BadApp_UnavailableFalse() throws Exception + public void testDelayedAddBadAppUnavailableFalse() throws Exception { Path docroots = startServer(null); diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java index 6139fa50bd7..3fc1a44dcce 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/HttpInputIntegrationTest.java @@ -102,9 +102,9 @@ public class HttpInputIntegrationTest __server.addConnector(http); // SSL Context Factory for HTTPS and HTTP/2 - String jetty_distro = System.getProperty("jetty.distro", "../../jetty-distribution/target/distribution"); + String jettyDistro = System.getProperty("jetty.distro", "../../jetty-distribution/target/distribution"); __sslContextFactory = new SslContextFactory.Server(); - __sslContextFactory.setKeyStorePath(jetty_distro + "/../../../jetty-server/src/test/config/etc/keystore"); + __sslContextFactory.setKeyStorePath(jettyDistro + "/../../../jetty-server/src/test/config/etc/keystore"); __sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); __sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g"); diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java index 5cf7b6a1a16..0ac4345c3a5 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java @@ -124,7 +124,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 3.3) */ @Test - public void test3_3() + public void test33() { Calendar expected = Calendar.getInstance(); expected.set(Calendar.YEAR, 1994); @@ -162,7 +162,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 3.6) */ @Test - public void test3_6() throws Throwable + public void test36() throws Throwable { // Chunk last StringBuffer req1 = new StringBuffer(); @@ -187,7 +187,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 3.6) */ @Test - public void test3_6_2() throws Throwable + public void test362() throws Throwable { // Chunked StringBuffer req2 = new StringBuffer(); @@ -240,7 +240,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 3.6) */ @Test - public void test3_6_3() throws Throwable + public void test363() throws Throwable { // Chunked StringBuffer req3 = new StringBuffer(); @@ -293,7 +293,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 3.6) */ @Test - public void test3_6_4() throws Throwable + public void test364() throws Throwable { // Chunked and keep alive StringBuffer req4 = new StringBuffer(); @@ -332,7 +332,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 3.9) */ @Test - public void test3_9() + public void test39() { HttpFields fields = new HttpFields(); @@ -353,7 +353,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 4.4) */ @Test - public void test4_4() throws Exception + public void test44() throws Exception { // 4.4.2 - transfer length is 'chunked' when the 'Transfer-Encoding' header // is provided with a value other than 'identity', unless the @@ -448,7 +448,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_DefaultHost() throws Exception + public void test52DefaultHost() throws Exception { // Default Host @@ -470,7 +470,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_VirtualHost() throws Exception + public void test52VirtualHost() throws Exception { // Virtual Host @@ -492,7 +492,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_VirtualHostInsensitive() throws Exception + public void test52VirtualHostInsensitive() throws Exception { // Virtual Host case insensitive @@ -514,7 +514,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_NoVirtualHost() throws Exception + public void test52NoVirtualHost() throws Exception { // No Virtual Host @@ -534,7 +534,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_BadVirtualHost() throws Exception + public void test52BadVirtualHost() throws Exception { // Bad Virtual Host @@ -556,7 +556,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_VirtualHostAbsoluteURI_Http11_WithoutHostHeader() throws Exception + public void test52VirtualHostAbsoluteURIHttp11WithoutHostHeader() throws Exception { // Virtual Host as Absolute URI @@ -577,7 +577,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_VirtualHostAbsoluteURI_Http10_WithoutHostHeader() throws Exception + public void test52VirtualHostAbsoluteURIHttp10WithoutHostHeader() throws Exception { // Virtual Host as Absolute URI @@ -598,7 +598,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 5.2) */ @Test - public void test5_2_VirtualHostAbsoluteURI_WithHostHeader() throws Exception + public void test52VirtualHostAbsoluteURIWithHostHeader() throws Exception { // Virtual Host as Absolute URI (with Host header) @@ -620,7 +620,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 8.1) */ @Test - public void test8_1() throws Exception + public void test81() throws Exception { StringBuffer req1 = new StringBuffer(); req1.append("GET /tests/R1.txt HTTP/1.1\n"); @@ -671,7 +671,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 8.2) */ @Test - public void test8_2_ExpectInvalid() throws Exception + public void test82ExpectInvalid() throws Exception { // Expect Failure @@ -695,7 +695,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 8.2) */ @Test - public void test8_2_ExpectWithBody() throws Exception + public void test82ExpectWithBody() throws Exception { // Expect with body @@ -723,7 +723,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 8.2) */ @Test - public void test8_2_UnexpectWithBody() throws Exception + public void test82UnexpectWithBody() throws Exception { // Expect with body @@ -758,7 +758,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 8.2) */ @Test - public void test8_2_ExpectNormal() throws Exception + public void test82ExpectNormal() throws Exception { // Expect 100 @@ -798,7 +798,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 9.2) */ @Test - public void test9_2_ServerOptions() throws Exception + public void test92ServerOptions() throws Exception { // Unsupported in Jetty. // Server can handle many webapps, each with their own set of supported OPTIONS. @@ -837,7 +837,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 9.2) */ @Test - public void test9_2_ResourceOptions() throws Exception + public void test92ResourceOptions() throws Exception { // Jetty is conditionally compliant. // Possible Bug in the Spec. @@ -884,7 +884,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 9.4) */ @Test - public void test9_4() throws Exception + public void test94() throws Exception { /* Test GET first. (should have body) */ @@ -948,7 +948,7 @@ public abstract class RFC2616BaseTest */ @Test @Disabled("Introduction of fix for realm-less security constraints has rendered this test invalid due to default configuration preventing use of TRACE in webdefault.xml") - public void test9_8() throws Exception + public void test98() throws Exception { StringBuffer req1 = new StringBuffer(); @@ -971,7 +971,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 10.2.7) */ @Test - public void test10_2_7() throws Exception + public void test1027() throws Exception { // check to see if corresponding GET w/o range would return // a) ETag @@ -1050,7 +1050,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 10.3) */ @Test - public void test10_3_RedirectHttp10Path() throws Exception + public void test103RedirectHttp10Path() throws Exception { String specId; @@ -1076,7 +1076,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 10.3) */ @Test - public void test10_3_RedirectHttp11Path() throws Exception + public void test103RedirectHttp11Path() throws Exception { // HTTP/1.1 @@ -1111,7 +1111,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 10.3) */ @Test - public void test10_3_RedirectHttp10Resource() throws Exception + public void test103RedirectHttp10Resource() throws Exception { // HTTP/1.0 - redirect with resource/content @@ -1134,7 +1134,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 10.3) */ @Test - public void test10_3_RedirectHttp11Resource() throws Exception + public void test103RedirectHttp11Resource() throws Exception { // HTTP/1.1 - redirect with resource/content @@ -1159,7 +1159,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.3) */ @Test - public void test14_3_AcceptEncodingGzip() throws Exception + public void test143AcceptEncodingGzip() throws Exception { String specId; @@ -1185,7 +1185,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.16) */ @Test - public void test14_16_NoRange() throws Exception + public void test1416NoRange() throws Exception { // // calibrate with normal request (no ranges); if this doesnt @@ -1231,7 +1231,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.16) */ @Test - public void test14_16_PartialRange() throws Exception + public void test1416PartialRange() throws Exception { String alpha = ALPHA; @@ -1251,7 +1251,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.16) */ @Test - public void test14_16_PartialRange_MixedRanges() throws Exception + public void test1416PartialRangeMixedRanges() throws Exception { String alpha = ALPHA; @@ -1292,7 +1292,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.16) */ @Test - public void test14_16_PartialRange_MixedBytes() throws Exception + public void test1416PartialRangeMixedBytes() throws Exception { String alpha = ALPHA; @@ -1331,7 +1331,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.16) */ @Test - public void test14_16_PartialRange_MixedMultiple() throws Exception + public void test1416PartialRangeMixedMultiple() throws Exception { String alpha = ALPHA; @@ -1370,7 +1370,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.23) */ @Test - public void test14_23_Http10_NoHostHeader() throws Exception + public void test1423Http10NoHostHeader() throws Exception { // HTTP/1.0 OK with no host @@ -1389,7 +1389,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.23) */ @Test - public void test14_23_Http11_NoHost() throws Exception + public void test1423Http11NoHost() throws Exception { // HTTP/1.1 400 (bad request) with no host @@ -1408,7 +1408,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.23) */ @Test - public void test14_23_ValidHost() throws Exception + public void test1423ValidHost() throws Exception { // HTTP/1.1 - Valid host @@ -1428,7 +1428,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.23) */ @Test - public void test14_23_IncompleteHostHeader() throws Exception + public void test1423IncompleteHostHeader() throws Exception { // HTTP/1.1 - Incomplete (empty) Host header try (StacklessLogging stackless = new StacklessLogging(HttpParser.class)) @@ -1474,7 +1474,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.35) */ @Test - public void test14_35_Range() throws Exception + public void test1435Range() throws Exception { // // test various valid range specs that have not been @@ -1503,7 +1503,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.35) */ @Test - public void test14_35_Range_Multipart1() throws Exception + public void test1435RangeMultipart1() throws Exception { String rangedef = "23-23,-2"; // Request byte at offset 23, and the last 2 bytes @@ -1560,7 +1560,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.35) */ @Test - public void test14_35_PartialRange() throws Exception + public void test1435PartialRange() throws Exception { // // test various valid range specs that have not been @@ -1596,7 +1596,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.35) */ @Test - public void test14_35_BadRange_InvalidSyntax() throws Exception + public void test1435BadRangeInvalidSyntax() throws Exception { // server should ignore all range headers which include // at least one syntactically invalid range @@ -1613,7 +1613,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.39) */ @Test - public void test14_39_TEGzip() throws Exception + public void test1439TEGzip() throws Exception { if (STRICT) { @@ -1641,7 +1641,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 14.39) */ @Test - public void test14_39_TEDeflate() throws Exception + public void test1439TEDeflate() throws Exception { if (STRICT) { @@ -1667,7 +1667,7 @@ public abstract class RFC2616BaseTest * @see RFC 2616 (section 19.6) */ @Test - public void test19_6() throws Exception + public void test196() throws Exception { String specId; diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java index 62f74b65fb5..7ef1c80a238 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/rawhttp/HttpTesting.java @@ -163,6 +163,7 @@ public class HttpTesting } } + // @checkstyle-disable-check : MethodName private void DEBUG(String msg) { if (debug) @@ -170,6 +171,7 @@ public class HttpTesting System.out.println(msg); } } + // @checkstyle-enable-check : MethodName public void enableDebug() { diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java index ccaf15a8bc5..8ed8efa5418 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java @@ -203,7 +203,7 @@ public class AttributeNormalizerTest @ParameterizedTest @MethodSource("scenarios") - public void testNormalizeJettyBaseAsURI_WithAuthority(final Scenario scenario) + public void testNormalizeJettyBaseAsURIWithAuthority(final Scenario scenario) { // Normalize jetty.base as URI path // Path.toUri() typically includes an URI authority @@ -212,7 +212,7 @@ public class AttributeNormalizerTest @ParameterizedTest @MethodSource("scenarios") - public void testNormalizeJettyBaseAsURI_WithoutAuthority(final Scenario scenario) + public void testNormalizeJettyBaseAsURIWithoutAuthority(final Scenario scenario) { // Normalize jetty.base as URI path // File.toURI() typically DOES NOT include an URI authority @@ -221,7 +221,7 @@ public class AttributeNormalizerTest @ParameterizedTest @MethodSource("scenarios") - public void testNormalizeJettyHomeAsURI_WithAuthority(final Scenario scenario) + public void testNormalizeJettyHomeAsURIWithAuthority(final Scenario scenario) { // Normalize jetty.home as URI path String expected = scenario.jettyBase.equals(scenario.jettyHome) ? "${jetty.base.uri}" : "${jetty.home.uri}"; @@ -232,7 +232,7 @@ public class AttributeNormalizerTest @ParameterizedTest @MethodSource("scenarios") - public void testNormalizeJettyHomeAsURI_WithoutAuthority(final Scenario scenario) + public void testNormalizeJettyHomeAsURIWithoutAuthority(final Scenario scenario) { // Normalize jetty.home as URI path String expected = scenario.jettyBase.equals(scenario.jettyHome) ? "${jetty.base.uri}" : "${jetty.home.uri}"; diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizer_ToCanonicalUriTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerToCanonicalUriTest.java similarity index 97% rename from tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizer_ToCanonicalUriTest.java rename to tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerToCanonicalUriTest.java index 5a8c1b98214..cd86ace49a2 100644 --- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizer_ToCanonicalUriTest.java +++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerToCanonicalUriTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -public class AttributeNormalizer_ToCanonicalUriTest +public class AttributeNormalizerToCanonicalUriTest { public static Stream sampleUris() { diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java index 021aba5e992..686e120d49e 100644 --- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java +++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java @@ -173,17 +173,17 @@ public class JdbcTestHelper ResultSet result = null; try (Connection con = DriverManager.getConnection(DEFAULT_CONNECTION_URL);) { - statement = con.prepareStatement( - "select * from " + TABLE + + statement = con.prepareStatement("select * from " + TABLE + " where " + ID_COL + " = ? and " + CONTEXT_COL + - " = ? and virtualHost = ?" ); + " = ? and virtualHost = ?"); statement.setString(1, data.getId()); statement.setString(2, data.getContextPath()); statement.setString(3, data.getVhost()); result = statement.executeQuery(); - if (!result.next()) return false; + if (!result.next()) + return false; assertEquals(data.getCreated(), result.getLong(CREATE_COL)); assertEquals(data.getAccessed(), result.getLong(ACCESS_COL)); @@ -200,9 +200,9 @@ public class JdbcTestHelper Blob blob = result.getBlob(MAP_COL); SessionData tmp = - new SessionData( data.getId(), data.getContextPath(), data.getVhost(), result.getLong(CREATE_COL), - result.getLong(ACCESS_COL), result.getLong(LAST_ACCESS_COL), - result.getLong(MAX_IDLE_COL)); + new SessionData(data.getId(), data.getContextPath(), data.getVhost(), result.getLong(CREATE_COL), + result.getLong(ACCESS_COL), result.getLong(LAST_ACCESS_COL), + result.getLong(MAX_IDLE_COL)); if (blob.length() > 0) { diff --git a/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java b/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java index 4c33b1bc112..8ae62372596 100644 --- a/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java +++ b/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java @@ -64,11 +64,11 @@ public class TestServer ((StdErrLog)Log.getLog()).setSource(false); // TODO don't depend on this file structure - Path jetty_root = FileSystems.getDefault().getPath(".").toAbsolutePath().normalize(); - if (!Files.exists(jetty_root.resolve("VERSION.txt"))) - jetty_root = FileSystems.getDefault().getPath("../../..").toAbsolutePath().normalize(); - if (!Files.exists(jetty_root.resolve("VERSION.txt"))) - throw new IllegalArgumentException(jetty_root.toString()); + Path jettyRoot = FileSystems.getDefault().getPath(".").toAbsolutePath().normalize(); + if (!Files.exists(jettyRoot.resolve("VERSION.txt"))) + jettyRoot = FileSystems.getDefault().getPath("../../..").toAbsolutePath().normalize(); + if (!Files.exists(jettyRoot.resolve("VERSION.txt"))) + throw new IllegalArgumentException(jettyRoot.toString()); // Setup Threadpool QueuedThreadPool threadPool = new QueuedThreadPool(); @@ -113,7 +113,7 @@ public class TestServer // Setup context HashLoginService login = new HashLoginService(); login.setName("Test Realm"); - login.setConfig(jetty_root.resolve("tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/realm.properties").toString()); + login.setConfig(jettyRoot.resolve("tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/realm.properties").toString()); server.addBean(login); File log = File.createTempFile("jetty-yyyy_mm_dd", "log"); @@ -125,7 +125,7 @@ public class TestServer WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/test"); webapp.setParentLoaderPriority(true); - webapp.setResourceBase(jetty_root.resolve("tests/test-webapps/test-jetty-webapp/src/main/webapp").toString()); + webapp.setResourceBase(jettyRoot.resolve("tests/test-webapps/test-jetty-webapp/src/main/webapp").toString()); webapp.setAttribute("testAttribute", "testValue"); File sessiondir = File.createTempFile("sessions", null); if (sessiondir.exists()) @@ -141,7 +141,7 @@ public class TestServer contexts.addHandler(webapp); ContextHandler srcroot = new ContextHandler(); - srcroot.setResourceBase(jetty_root.resolve("tests/test-webapps/test-jetty-webapp/src").toString()); + srcroot.setResourceBase(jettyRoot.resolve("tests/test-webapps/test-jetty-webapp/src").toString()); srcroot.setHandler(new ResourceHandler()); srcroot.setContextPath("/src"); contexts.addHandler(srcroot); diff --git a/tests/test-webapps/test-proxy-webapp/src/test/java/org/eclipse/jetty/TestTransparentProxyServer.java b/tests/test-webapps/test-proxy-webapp/src/test/java/org/eclipse/jetty/TestTransparentProxyServer.java index 85836a65de6..8d1839c21b1 100644 --- a/tests/test-webapps/test-proxy-webapp/src/test/java/org/eclipse/jetty/TestTransparentProxyServer.java +++ b/tests/test-webapps/test-proxy-webapp/src/test/java/org/eclipse/jetty/TestTransparentProxyServer.java @@ -49,7 +49,7 @@ public class TestTransparentProxyServer { ((StdErrLog)Log.getLog()).setSource(false); - String jetty_root = "../../.."; + String jettyRoot = "../../.."; // Setup Threadpool QueuedThreadPool threadPool = new QueuedThreadPool(); @@ -80,10 +80,10 @@ public class TestTransparentProxyServer // SSL configurations SslContextFactory sslContextFactory = new SslContextFactory.Server(); - sslContextFactory.setKeyStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore"); + sslContextFactory.setKeyStorePath(jettyRoot + "/jetty-server/src/main/config/etc/keystore"); sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g"); - sslContextFactory.setTrustStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore"); + sslContextFactory.setTrustStorePath(jettyRoot + "/jetty-server/src/main/config/etc/keystore"); sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); sslContextFactory.setExcludeCipherSuites( "SSL_RSA_WITH_DES_CBC_SHA", @@ -96,11 +96,11 @@ public class TestTransparentProxyServer sslContextFactory.setCipherComparator(new HTTP2Cipher.CipherComparator()); // HTTPS Configuration - HttpConfiguration https_config = new HttpConfiguration(config); - https_config.addCustomizer(new SecureRequestCustomizer()); + HttpConfiguration httpsConfig = new HttpConfiguration(config); + httpsConfig.addCustomizer(new SecureRequestCustomizer()); // HTTP2 factory - HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config); + HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig); ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory(); alpn.setDefaultProtocol(h2.getProtocol()); @@ -109,7 +109,7 @@ public class TestTransparentProxyServer // HTTP2 Connector ServerConnector http2Connector = - new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(https_config)); + new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(httpsConfig)); http2Connector.setPort(8443); http2Connector.setIdleTimeout(15000); server.addConnector(http2Connector); From 988b11d2bcfd7584e7a223d41ad95a205e497cf9 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 14 Jan 2020 14:43:06 -0600 Subject: [PATCH 04/20] Fixing checkstyle violations Signed-off-by: Joakim Erdfelt --- .../org/eclipse/jetty/alpn/java/server/JDK9ALPNTest.java | 3 ++- .../org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/jetty-alpn/jetty-alpn-java-server/src/test/java/org/eclipse/jetty/alpn/java/server/JDK9ALPNTest.java b/jetty-alpn/jetty-alpn-java-server/src/test/java/org/eclipse/jetty/alpn/java/server/JDK9ALPNTest.java index 0b80da1ea5f..2c4e532d72d 100644 --- a/jetty-alpn/jetty-alpn-java-server/src/test/java/org/eclipse/jetty/alpn/java/server/JDK9ALPNTest.java +++ b/jetty-alpn/jetty-alpn-java-server/src/test/java/org/eclipse/jetty/alpn/java/server/JDK9ALPNTest.java @@ -182,7 +182,8 @@ public class JDK9ALPNTest @Test public void testClientSupportingALPNCannotNegotiateProtocol() throws Exception { - startServer(new AbstractHandler() { + startServer(new AbstractHandler() + { @Override public void handle(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) { diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java index 304e3efd2f0..397c75868ae 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616NIOHttpsTest.java @@ -49,10 +49,4 @@ public class RFC2616NIOHttpsTest extends RFC2616BaseTest { return new HttpsSocketImpl(); } - - @Override - public void test8_2_ExpectInvalid() throws Exception - { - super.test8_2_ExpectInvalid(); - } } From 1c00006ca70cfddd487b18e972ce93b279715a3b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 14 Jan 2020 14:47:16 -0600 Subject: [PATCH 05/20] Checkstyle now mandatory on build + Removed checkstyle suppressions + Force scan on source directories (main and test) + Excluding generated / filtered / copied sources + Removed Jenkins job for checkstyle Signed-off-by: Joakim Erdfelt --- Jenkinsfile | 13 ---- .../src/main/resources/jetty-checkstyle.xml | 6 -- .../src/main/resources/jetty-suppressions.xml | 35 ----------- pom.xml | 60 ++++++++++++------- 4 files changed, 37 insertions(+), 77 deletions(-) delete mode 100644 build-resources/src/main/resources/jetty-suppressions.xml diff --git a/Jenkinsfile b/Jenkinsfile index c090fc07d50..91950baf63d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,19 +73,6 @@ pipeline { } } - stage("Checkstyle ") { - agent { node { label 'linux' } } - steps { - timeout(time: 30, unit: 'MINUTES') { - mavenBuild("jdk11", "clean install -f build-resources", "maven3", true) - mavenBuild("jdk11", "install checkstyle:check -DskipTests", "maven3", true) - recordIssues( - enabledForFailure: true, aggregatingResults: true, - tools: [java(), checkStyle(pattern: '**/target/checkstyle-result.xml', reportEncoding: 'UTF-8')]) - } - } - } - stage("Build Compact3") { agent { node { label 'linux' } } steps { diff --git a/build-resources/src/main/resources/jetty-checkstyle.xml b/build-resources/src/main/resources/jetty-checkstyle.xml index 6f6c68a9c69..16338ac3327 100644 --- a/build-resources/src/main/resources/jetty-checkstyle.xml +++ b/build-resources/src/main/resources/jetty-checkstyle.xml @@ -14,12 +14,6 @@ - - - - - - diff --git a/build-resources/src/main/resources/jetty-suppressions.xml b/build-resources/src/main/resources/jetty-suppressions.xml deleted file mode 100644 index 5d84676914e..00000000000 --- a/build-resources/src/main/resources/jetty-suppressions.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index 9192343cf52..5dec4e7829e 100644 --- a/pom.xml +++ b/pom.xml @@ -431,6 +431,43 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + jetty-checkstyle.xml + true + warning + true + + + ${project.build.sourceDirectory} + ${project.build.testSourceDirectory} + + + + + org.eclipse.jetty + build-resources + ${project.version} + + + com.puppycrawl.tools + checkstyle + 8.20 + + + + + checkcheck + validate + + check + + + + @@ -452,29 +489,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - jetty-checkstyle.xml - jetty-suppressions.xml - checkstyle.suppressions.file - true - - - - org.eclipse.jetty - build-resources - ${project.version} - - - com.puppycrawl.tools - checkstyle - 8.20 - - - org.apache.maven.plugins maven-clean-plugin From 0d9605823a1f691653f0b25898c323b8ca08d969 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 14 Jan 2020 16:05:55 -0600 Subject: [PATCH 06/20] Restoring unicode testcase Signed-off-by: Joakim Erdfelt --- .../java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java index 041f54a0e5d..e579ef9c071 100644 --- a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java +++ b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2ServerTest.java @@ -390,8 +390,9 @@ public class HTTP2ServerTest extends AbstractServerTest @Override protected void service(HttpServletRequest request, HttpServletResponse response) { + // @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck // Invalid header name, the connection must be closed. - response.setHeader("Euro_(%E2%82%AC)", "42"); + response.setHeader("Euro_(\u20AC)", "42"); } }); From aecc9a4af6d5e591d2b2770b8df3963d31df9289 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 14 Jan 2020 16:56:06 -0600 Subject: [PATCH 07/20] Bumping up javadoc stage timeout to 40 minutes Signed-off-by: Joakim Erdfelt --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 91950baf63d..0b88fc8a3f3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -66,7 +66,7 @@ pipeline { stage("Build Javadoc") { agent { node { label 'linux' } } steps { - timeout(time: 30, unit: 'MINUTES') { + timeout(time: 40, unit: 'MINUTES') { mavenBuild("jdk11", "install javadoc:javadoc javadoc:aggregate-jar -DskipTests", "maven3", true) warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'JavaDoc'], [parserName: 'Java']] } From 33ed4713eba6be37163b200b48fcd62483144bac Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 15 Jan 2020 08:37:25 -0600 Subject: [PATCH 08/20] Moving maven threading to individual stages. + Javadoc stage is sensitive to multi-threaded execution Signed-off-by: Joakim Erdfelt --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b88fc8a3f3..2509d42b6e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { agent { node { label 'linux' } } steps { timeout(time: 120, unit: 'MINUTES') { - mavenBuild("jdk8", "-Pmongodb clean install", "maven3", true) + mavenBuild("jdk8", "-T3 -Pmongodb clean install", "maven3", true) // Collect up the jacoco execution results (only on main build) jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class', exclusionPattern: '' + @@ -45,7 +45,7 @@ pipeline { agent { node { label 'linux' } } steps { timeout(time: 120, unit: 'MINUTES') { - mavenBuild("jdk11", "-Pmongodb clean install", "maven3", true) + mavenBuild("jdk11", "-T3 -Pmongodb clean install", "maven3", true) warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] junit testResults: '**/target/surefire-reports/*.xml,**/target/invoker-reports/TEST*.xml' } @@ -56,7 +56,7 @@ pipeline { agent { node { label 'linux' } } steps { timeout(time: 120, unit: 'MINUTES') { - mavenBuild("jdk13", "-Pmongodb clean install", "maven3", true) + mavenBuild("jdk13", "-T3 -Pmongodb clean install", "maven3", true) warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] junit testResults: '**/target/surefire-reports/*.xml,**/target/invoker-reports/TEST*.xml' } @@ -77,7 +77,7 @@ pipeline { agent { node { label 'linux' } } steps { timeout(time: 30, unit: 'MINUTES') { - mavenBuild("jdk8", "-Pcompact3 clean install -DskipTests", "maven3", true) + mavenBuild("jdk8", "-T3 -Pcompact3 clean install -DskipTests", "maven3", true) warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] } } @@ -139,7 +139,7 @@ def mavenBuild(jdk, cmdline, mvnName, junitPublishDisabled) { mavenOpts: mavenOpts, mavenLocalRepo: localRepo) { // Some common Maven command line + provided command line - sh "mvn -Pci -V -B -T3 -e -Dmaven.test.failure.ignore=true -Djetty.testtracker.log=true $cmdline -Dunix.socket.tmp=" + env.JENKINS_HOME + sh "mvn -Pci -V -B -e -Dmaven.test.failure.ignore=true -Djetty.testtracker.log=true $cmdline -Dunix.socket.tmp=" + env.JENKINS_HOME } } From d701065c20f7dcefb28ec399899e59e0fb6f1163 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 15 Jan 2020 08:38:49 -0600 Subject: [PATCH 09/20] Skipping pmd/checkstyle on javadoc stage Signed-off-by: Joakim Erdfelt --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2509d42b6e8..2e5ab191b26 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,7 +67,7 @@ pipeline { agent { node { label 'linux' } } steps { timeout(time: 40, unit: 'MINUTES') { - mavenBuild("jdk11", "install javadoc:javadoc javadoc:aggregate-jar -DskipTests", "maven3", true) + mavenBuild("jdk11", "install javadoc:javadoc javadoc:aggregate-jar -DskipTests -Dpmd.skip=true -Dcheckstyle.skip=true", "maven3", true) warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'JavaDoc'], [parserName: 'Java']] } } From 33a5a257aa2c47574392f49b2487320c7660d82d Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 15 Jan 2020 11:32:04 -0600 Subject: [PATCH 10/20] Updates from review Signed-off-by: Joakim Erdfelt --- pom.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5dec4e7829e..03c0471e296 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,7 @@ http://www.eclipse.org/jetty UTF-8 1.4 + 8.20 1.7.25 2.11.2 3.4.2 @@ -455,12 +456,12 @@ com.puppycrawl.tools checkstyle - 8.20 + ${checkstyle.version} - checkcheck + checkstyle-check validate check @@ -489,6 +490,11 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + org.apache.maven.plugins maven-clean-plugin From d4f72256e7f7e62b163894360960eb1314071009 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 15 Jan 2020 12:54:20 -0600 Subject: [PATCH 11/20] Removing javadoc:aggregate-jar due to MJAVADOC-618 Signed-off-by: Joakim Erdfelt --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f95e667e617..11a770057d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { agent { node { label 'linux' } } steps { timeout(time: 30, unit: 'MINUTES') { - mavenBuild("jdk11", "install javadoc:javadoc javadoc:aggregate-jar -DskipTests -Dpmd.skip=true -Dcheckstyle.skip=true", "maven3", true) + mavenBuild("jdk11", "install javadoc:javadoc -DskipTests -Dpmd.skip=true -Dcheckstyle.skip=true", "maven3", true) warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'JavaDoc'], [parserName: 'Java']] } } From 37f85034422ce86438d52ab5d86f4d675689c8ff Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 15 Jan 2020 15:31:43 -0600 Subject: [PATCH 12/20] Issue #4383 - Minimal NPE prevention on MultiPart Signed-off-by: Joakim Erdfelt --- .../jetty/http/MultiPartFormInputStream.java | 7 +++++++ .../jetty/http/MultiPartFormInputStreamTest.java | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java b/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java index 05c1dbf25e1..08f1e0b96e6 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java @@ -397,6 +397,13 @@ public class MultiPartFormInputStream */ public void deleteParts() { + if (_parts == null) + { + // If we call deleteParts at this point, we are considered CLOSED + _err = new IllegalStateException("CLOSED via call to deleteParts()"); + return; + } + MultiException err = null; for (List parts : _parts.values()) { diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java index 2308314886c..2e7062c4c63 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java @@ -509,6 +509,20 @@ public class MultiPartFormInputStreamTest assertThat(stuff.exists(), is(false)); //tmp file was removed after cleanup } + @Test + public void testParseAfterCleanUp() throws Exception + { + final InputStream input = new ByteArrayInputStream(createMultipartRequestString("myFile").getBytes()); + MultipartConfigElement config = new MultipartConfigElement(_dirname, 1024, 1024, 50); + MultiPartFormInputStream mpis = new MultiPartFormInputStream(input, _contentType, config, _tmpDir); + + mpis.deleteParts(); + + // The call to getParts should throw because we have already cleaned up the parts. + Throwable error = assertThrows(IllegalStateException.class, mpis::getParts); + assertThat(error.getMessage(), containsString("CLOSED")); + } + @Test public void testLFOnlyRequest() throws Exception From eba24b6b83579dcf30c1a6625793bc01ced472f1 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 15 Jan 2020 15:48:51 -0600 Subject: [PATCH 13/20] Issue #4383 - Updates behavior to eliminate ISE Signed-off-by: Joakim Erdfelt --- .../jetty/http/MultiPartFormInputStream.java | 24 ++++++++----------- .../http/MultiPartFormInputStreamTest.java | 8 ++----- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java b/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java index 08f1e0b96e6..f1deb18681b 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPartFormInputStream.java @@ -60,10 +60,10 @@ public class MultiPartFormInputStream { private static final Logger LOG = Log.getLogger(MultiPartFormInputStream.class); private static final MultiMap EMPTY_MAP = new MultiMap<>(Collections.emptyMap()); + private final MultiMap _parts; private InputStream _in; private MultipartConfigElement _config; private String _contentType; - private MultiMap _parts; private Throwable _err; private File _tmpDir; private File _contextTmpDir; @@ -341,16 +341,19 @@ public class MultiPartFormInputStream if (_config == null) _config = new MultipartConfigElement(_contextTmpDir.getAbsolutePath()); + MultiMap parts = new MultiMap(); + if (in instanceof ServletInputStream) { if (((ServletInputStream)in).isFinished()) { - _parts = EMPTY_MAP; + parts = EMPTY_MAP; _parsed = true; - return; } } - _in = new BufferedInputStream(in); + if (!_parsed) + _in = new BufferedInputStream(in); + _parts = parts; } /** @@ -397,13 +400,6 @@ public class MultiPartFormInputStream */ public void deleteParts() { - if (_parts == null) - { - // If we call deleteParts at this point, we are considered CLOSED - _err = new IllegalStateException("CLOSED via call to deleteParts()"); - return; - } - MultiException err = null; for (List parts : _parts.values()) { @@ -439,6 +435,9 @@ public class MultiPartFormInputStream parse(); throwIfError(); + if (_parts.isEmpty()) + return Collections.emptyList(); + Collection> values = _parts.values(); List parts = new ArrayList<>(); for (List o : values) @@ -499,9 +498,6 @@ public class MultiPartFormInputStream Handler handler = new Handler(); try { - // initialize - _parts = new MultiMap<>(); - // if its not a multipart request, don't parse it if (_contentType == null || !_contentType.startsWith("multipart/form-data")) return; diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java index 2e7062c4c63..f2f96a7a8c2 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartFormInputStreamTest.java @@ -510,17 +510,13 @@ public class MultiPartFormInputStreamTest } @Test - public void testParseAfterCleanUp() throws Exception + public void testDeleteNPE() { final InputStream input = new ByteArrayInputStream(createMultipartRequestString("myFile").getBytes()); MultipartConfigElement config = new MultipartConfigElement(_dirname, 1024, 1024, 50); MultiPartFormInputStream mpis = new MultiPartFormInputStream(input, _contentType, config, _tmpDir); - mpis.deleteParts(); - - // The call to getParts should throw because we have already cleaned up the parts. - Throwable error = assertThrows(IllegalStateException.class, mpis::getParts); - assertThat(error.getMessage(), containsString("CLOSED")); + mpis.deleteParts(); // this should not be an NPE } @Test From f1474a4a3f637ec4c71b6671617f8e65b2b4283f Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 17 Jan 2020 00:39:16 +1100 Subject: [PATCH 14/20] Issue #4431 Add tests for default-context-path (#4467) Signed-off-by: Jan Bartel --- .../jetty/webapp/WebAppContextTest.java | 59 +++++++++++++++++++ ...override-web-with-default-context-path.xml | 10 ++++ .../web-default-with-default-context-path.xml | 10 ++++ .../web-with-default-context-path.xml | 10 ++++ .../web-with-empty-default-context-path.xml | 10 ++++ 5 files changed, 99 insertions(+) create mode 100644 jetty-webapp/src/test/resources/override-web-with-default-context-path.xml create mode 100644 jetty-webapp/src/test/resources/web-default-with-default-context-path.xml create mode 100644 jetty-webapp/src/test/resources/web-with-default-context-path.xml create mode 100644 jetty-webapp/src/test/resources/web-with-empty-default-context-path.xml diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java index 9ebece9e725..88a19e215c2 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java @@ -79,6 +79,65 @@ public class WebAppContextTest Configurations.cleanKnown(); } + @Test + public void testDefaultContextPath() throws Exception + { + Server server = new Server(); + File webXml = MavenTestingUtils.getTestResourceFile("web-with-default-context-path.xml"); + File webXmlEmptyPath = MavenTestingUtils.getTestResourceFile("web-with-empty-default-context-path.xml"); + File webDefaultXml = MavenTestingUtils.getTestResourceFile("web-default-with-default-context-path.xml"); + File overrideWebXml = MavenTestingUtils.getTestResourceFile("override-web-with-default-context-path.xml"); + assertNotNull(webXml); + assertNotNull(webDefaultXml); + assertNotNull(overrideWebXml); + assertNotNull(webXmlEmptyPath); + + try + { + WebAppContext wac = new WebAppContext(); + wac.setResourceBase(MavenTestingUtils.getTargetTestingDir().getAbsolutePath()); + server.setHandler(wac); + + //test that an empty default-context-path defaults to root + wac.setDescriptor(webXmlEmptyPath.getAbsolutePath()); + server.start(); + assertEquals("/", wac.getContextPath()); + + server.stop(); + + //test web-default.xml value is used + wac.setDescriptor(null); + wac.setDefaultsDescriptor(webDefaultXml.getAbsolutePath()); + server.start(); + assertEquals("/one", wac.getContextPath()); + + server.stop(); + + //test web.xml value is used + wac.setDescriptor(webXml.getAbsolutePath()); + server.start(); + assertEquals("/two", wac.getContextPath()); + + server.stop(); + + //test override-web.xml value is used + wac.setOverrideDescriptor(overrideWebXml.getAbsolutePath()); + server.start(); + assertEquals("/three", wac.getContextPath()); + + server.stop(); + + //test that explicitly set context path is used instead + wac.setContextPath("/foo"); + server.start(); + assertEquals("/foo", wac.getContextPath()); + } + finally + { + server.stop(); + } + } + @Test public void testSessionListeners() { diff --git a/jetty-webapp/src/test/resources/override-web-with-default-context-path.xml b/jetty-webapp/src/test/resources/override-web-with-default-context-path.xml new file mode 100644 index 00000000000..6e4b27ea699 --- /dev/null +++ b/jetty-webapp/src/test/resources/override-web-with-default-context-path.xml @@ -0,0 +1,10 @@ + + + + Test 4 WebApp + /three + + diff --git a/jetty-webapp/src/test/resources/web-default-with-default-context-path.xml b/jetty-webapp/src/test/resources/web-default-with-default-context-path.xml new file mode 100644 index 00000000000..1b89bf2dcf1 --- /dev/null +++ b/jetty-webapp/src/test/resources/web-default-with-default-context-path.xml @@ -0,0 +1,10 @@ + + + + Test 4 WebApp + /one + + diff --git a/jetty-webapp/src/test/resources/web-with-default-context-path.xml b/jetty-webapp/src/test/resources/web-with-default-context-path.xml new file mode 100644 index 00000000000..82614beaf0e --- /dev/null +++ b/jetty-webapp/src/test/resources/web-with-default-context-path.xml @@ -0,0 +1,10 @@ + + + + Test 4 WebApp + /two + + diff --git a/jetty-webapp/src/test/resources/web-with-empty-default-context-path.xml b/jetty-webapp/src/test/resources/web-with-empty-default-context-path.xml new file mode 100644 index 00000000000..f4ad38d48af --- /dev/null +++ b/jetty-webapp/src/test/resources/web-with-empty-default-context-path.xml @@ -0,0 +1,10 @@ + + + + Test 4 WebApp + + + From 86e33339166a47f1925af410f9919f93bdaeae23 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 17 Jan 2020 00:40:06 +1100 Subject: [PATCH 15/20] Issue #4434 Implement context default request/response encodings. (#4455) * Issue #4434 Implement context default request/response encodings. Signed-off-by: Jan Bartel --- .../QuickStartGeneratorConfiguration.java | 8 +++ .../jetty/quickstart/TestQuickStart.java | 51 +++++++++++++-- jetty-quickstart/src/test/resources/web.xml | 2 + .../org/eclipse/jetty/server/Request.java | 18 ++++-- .../org/eclipse/jetty/server/Response.java | 53 +++++++++++---- .../jetty/server/handler/ContextHandler.java | 26 ++++++-- .../server/CharEncodingContextHandler.java | 49 ++++++++++++++ .../org/eclipse/jetty/server/RequestTest.java | 64 ++++++++++++++++++- .../eclipse/jetty/server/ResponseTest.java | 62 ++++++++++++++++++ .../jetty/servlet/ServletContextHandler.java | 30 +++++++++ .../webapp/StandardDescriptorProcessor.java | 31 ++++++--- .../java/com/acme/test/AnnotationTest.java | 11 ++++ .../src/main/webapp/WEB-INF/web.xml | 3 +- .../src/main/webapp/index.html | 9 +-- 14 files changed, 373 insertions(+), 44 deletions(-) create mode 100644 jetty-server/src/test/java/org/eclipse/jetty/server/CharEncodingContextHandler.java diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartGeneratorConfiguration.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartGeneratorConfiguration.java index 84ed622a697..59f864b93a5 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartGeneratorConfiguration.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartGeneratorConfiguration.java @@ -182,6 +182,14 @@ public class QuickStartGeneratorConfiguration extends AbstractConfiguration String defaultContextPath = (String)context.getAttribute("default-context-path"); if (defaultContextPath != null) out.tag("default-context-path", defaultContextPath); + + String requestEncoding = (String)context.getAttribute("request-character-encoding"); + if (!StringUtil.isBlank(requestEncoding)) + out.tag("request-character-encoding", requestEncoding); + + String responseEncoding = (String)context.getAttribute("response-character-encoding"); + if (!StringUtil.isBlank(responseEncoding)) + out.tag("response-character-encoding", responseEncoding); //add the name of the origin attribute, if it is being used if (StringUtil.isNotBlank(_originAttribute)) diff --git a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/TestQuickStart.java b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/TestQuickStart.java index bfad7ebbd20..64b0d22d3bb 100644 --- a/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/TestQuickStart.java +++ b/jetty-quickstart/src/test/java/org/eclipse/jetty/quickstart/TestQuickStart.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.toolchain.test.FS; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.webapp.WebAppContext; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -43,6 +44,7 @@ public class TestQuickStart { File testDir; File webInf; + Server server; @BeforeEach public void setUp() @@ -51,6 +53,14 @@ public class TestQuickStart FS.ensureEmpty(testDir); webInf = new File(testDir, "WEB-INF"); FS.ensureDirExists(webInf); + + server = new Server(); + } + + @AfterEach + public void tearDown() throws Exception + { + server.stop(); } @Test @@ -59,8 +69,6 @@ public class TestQuickStart File quickstartXml = new File(webInf, "quickstart-web.xml"); assertFalse(quickstartXml.exists()); - Server server = new Server(); - //generate a quickstart-web.xml WebAppContext quickstart = new WebAppContext(); quickstart.addConfiguration(new QuickStartConfiguration()); @@ -96,8 +104,6 @@ public class TestQuickStart ServletHolder sh = webapp.getServletHandler().getMappedServlet("/").getResource(); assertNotNull(sh); assertEquals("foo", sh.getName()); - - server.stop(); } @Test @@ -106,8 +112,6 @@ public class TestQuickStart File quickstartXml = new File(webInf, "quickstart-web.xml"); assertFalse(quickstartXml.exists()); - Server server = new Server(); - // generate a quickstart-web.xml WebAppContext quickstart = new WebAppContext(); quickstart.setResourceBase(testDir.getAbsolutePath()); @@ -138,7 +142,40 @@ public class TestQuickStart // verify the context path is the default-context-path assertEquals("/thisIsTheDefault", webapp.getContextPath()); assertTrue(webapp.isContextPathDefault()); + } + + @Test + public void testDefaultRequestAndResponseEncodings() throws Exception + { + File quickstartXml = new File(webInf, "quickstart-web.xml"); + assertFalse(quickstartXml.exists()); - server.stop(); + // generate a quickstart-web.xml + WebAppContext quickstart = new WebAppContext(); + quickstart.setResourceBase(testDir.getAbsolutePath()); + quickstart.addConfiguration(new QuickStartConfiguration()); + quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.GENERATE); + quickstart.setAttribute(QuickStartConfiguration.ORIGIN_ATTRIBUTE, "origin"); + quickstart.setDescriptor(MavenTestingUtils.getTestResourceFile("web.xml").getAbsolutePath()); + quickstart.setContextPath("/foo"); + server.setHandler(quickstart); + server.setDryRun(true); + server.start(); + + assertTrue(quickstartXml.exists()); + + // quick start + WebAppContext webapp = new WebAppContext(); + webapp.addConfiguration(new QuickStartConfiguration()); + quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); + webapp.setResourceBase(testDir.getAbsolutePath()); + webapp.setClassLoader(new URLClassLoader(new URL[0], Thread.currentThread().getContextClassLoader())); + server.setHandler(webapp); + + server.setDryRun(false); + server.start(); + + assertEquals("ascii", webapp.getDefaultRequestCharacterEncoding()); + assertEquals("utf-16", webapp.getDefaultResponseCharacterEncoding()); } } diff --git a/jetty-quickstart/src/test/resources/web.xml b/jetty-quickstart/src/test/resources/web.xml index 68b02eec221..cf4aef929c5 100644 --- a/jetty-quickstart/src/test/resources/web.xml +++ b/jetty-quickstart/src/test/resources/web.xml @@ -10,6 +10,8 @@ /thisIsTheDefault + ascii + utf-16 diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index d3756165a33..3efc38195db 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -681,13 +681,19 @@ public class Request implements HttpServletRequest { if (_characterEncoding == null) { - String contentType = getContentType(); - if (contentType != null) + if (_context != null) + _characterEncoding = _context.getRequestCharacterEncoding(); + + if (_characterEncoding == null) { - MimeTypes.Type mime = MimeTypes.CACHE.get(contentType); - String charset = (mime == null || mime.getCharset() == null) ? MimeTypes.getCharsetFromContentType(contentType) : mime.getCharset().toString(); - if (charset != null) - _characterEncoding = charset; + String contentType = getContentType(); + if (contentType != null) + { + MimeTypes.Type mime = MimeTypes.CACHE.get(contentType); + String charset = (mime == null || mime.getCharset() == null) ? MimeTypes.getCharsetFromContentType(contentType) : mime.getCharset().toString(); + if (charset != null) + _characterEncoding = charset; + } } } return _characterEncoding; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index bf538c41c32..0bdb6944ffe 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -56,6 +56,7 @@ import org.eclipse.jetty.http.MetaData; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.http.PreEncodedHttpField; import org.eclipse.jetty.io.RuntimeIOException; +import org.eclipse.jetty.server.handler.ContextHandler.Context; import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.util.AtomicBiInteger; import org.eclipse.jetty.util.Callback; @@ -683,9 +684,18 @@ public class Response implements HttpServletResponse String encoding = MimeTypes.getCharsetAssumedFromContentType(_contentType); if (encoding != null) return encoding; + encoding = MimeTypes.getCharsetInferredFromContentType(_contentType); if (encoding != null) return encoding; + + Context context = _channel.getRequest().getContext(); + if (context != null) + { + encoding = context.getResponseCharacterEncoding(); + if (encoding != null) + return encoding; + } return StringUtil.__ISO_8859_1; } return _characterEncoding; @@ -729,23 +739,42 @@ public class Response implements HttpServletResponse if (_outputType == OutputType.NONE) { - /* get encoding from Content-Type header */ + //first try explicit char encoding String encoding = _characterEncoding; + + //try char set from mime type if (encoding == null) { if (_mimeType != null && _mimeType.isCharsetAssumed()) encoding = _mimeType.getCharsetString(); - else - { - encoding = MimeTypes.getCharsetAssumedFromContentType(_contentType); - if (encoding == null) - { - encoding = MimeTypes.getCharsetInferredFromContentType(_contentType); - if (encoding == null) - encoding = StringUtil.__ISO_8859_1; - setCharacterEncoding(encoding, EncodingFrom.INFERRED); - } - } + } + + //try char set assumed from content type + if (encoding == null) + { + encoding = MimeTypes.getCharsetAssumedFromContentType(_contentType); + } + + //try char set inferred from content type + if (encoding == null) + { + encoding = MimeTypes.getCharsetInferredFromContentType(_contentType); + setCharacterEncoding(encoding, EncodingFrom.INFERRED); + } + + //try any default char encoding for the context + if (encoding == null) + { + Context context = _channel.getRequest().getContext(); + if (context != null) + encoding = context.getResponseCharacterEncoding(); + } + + //fallback to last resort iso-8859-1 + if (encoding == null) + { + encoding = StringUtil.__ISO_8859_1; + setCharacterEncoding(encoding, EncodingFrom.INFERRED); } Locale locale = getLocale(); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 710b11ba5e2..be7b6c29026 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -177,6 +177,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu private final Map _initParams; private ClassLoader _classLoader; private boolean _contextPathDefault = true; + private String _defaultRequestCharacterEncoding; + private String _defaultResponseCharacterEncoding; private String _contextPath = "/"; private String _contextPathEncoded = "/"; @@ -1482,7 +1484,27 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu setContextPath(contextPath); _contextPathDefault = true; } + + public void setDefaultRequestCharacterEncoding(String encoding) + { + _defaultRequestCharacterEncoding = encoding; + } + public String getDefaultRequestCharacterEncoding() + { + return _defaultRequestCharacterEncoding; + } + + public void setDefaultResponseCharacterEncoding(String encoding) + { + _defaultResponseCharacterEncoding = encoding; + } + + public String getDefaultResponseCharacterEncoding() + { + return _defaultResponseCharacterEncoding; + } + /** * @return True if the current contextPath is from default settings */ @@ -2877,7 +2899,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu @Override public String getRequestCharacterEncoding() { - // TODO new in 4.0 LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "getRequestCharacterEncoding()"); return null; } @@ -2888,7 +2909,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu @Override public void setRequestCharacterEncoding(String encoding) { - // TODO new in 4.0 LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "setRequestCharacterEncoding(String)"); } @@ -2898,7 +2918,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu @Override public String getResponseCharacterEncoding() { - // TODO new in 4.0 LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "getResponseCharacterEncoding()"); return null; } @@ -2909,7 +2928,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu @Override public void setResponseCharacterEncoding(String encoding) { - // TODO new in 4.0 LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "setResponseCharacterEncoding(String)"); } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/CharEncodingContextHandler.java b/jetty-server/src/test/java/org/eclipse/jetty/server/CharEncodingContextHandler.java new file mode 100644 index 00000000000..41104d690cc --- /dev/null +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/CharEncodingContextHandler.java @@ -0,0 +1,49 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +package org.eclipse.jetty.server; + +import org.eclipse.jetty.server.handler.ContextHandler; + +/** + * ContextHandler for testing that implements some + * CharEncoding methods from the servlet spec. + */ +public class CharEncodingContextHandler extends ContextHandler +{ + class Context extends ContextHandler.Context + { + @Override + public String getRequestCharacterEncoding() + { + return getDefaultRequestCharacterEncoding(); + } + + @Override + public String getResponseCharacterEncoding() + { + return getDefaultResponseCharacterEncoding(); + } + } + + public CharEncodingContextHandler() + { + super(); + _scontext = new Context(); + } +} diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index 65279142dff..0ba04bf55cf 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -35,6 +35,8 @@ import java.util.List; import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + import javax.servlet.DispatcherType; import javax.servlet.MultipartConfigElement; import javax.servlet.ServletException; @@ -118,6 +120,66 @@ public class RequestTest _server.stop(); _server.join(); } + + @Test + public void testRequestCharacterEncoding() throws Exception + { + AtomicReference result = new AtomicReference<>(null); + AtomicReference overrideCharEncoding = new AtomicReference<>(null); + + _server.stop(); + ContextHandler handler = new CharEncodingContextHandler(); + _server.setHandler(handler); + handler.setHandler(_handler); + _handler._checker = new RequestTester() + { + @Override + public boolean check(HttpServletRequest request, HttpServletResponse response) + { + try + { + String s = overrideCharEncoding.get(); + if (s != null) + request.setCharacterEncoding(s); + + result.set(request.getCharacterEncoding()); + return true; + } + catch (UnsupportedEncodingException e) + { + return false; + } + } + }; + _server.start(); + + String request = "GET / HTTP/1.1\n" + + "Host: whatever\r\n" + + "Content-Type: text/html;charset=utf8\n" + + "Connection: close\n" + + "\n"; + + //test setting the default char encoding + handler.setDefaultRequestCharacterEncoding("ascii"); + String response = _connector.getResponse(request); + assertTrue(response.startsWith("HTTP/1.1 200")); + assertEquals("ascii", result.get()); + + //test overriding the default char encoding with explicit encoding + result.set(null); + overrideCharEncoding.set("utf-16"); + response = _connector.getResponse(request); + assertTrue(response.startsWith("HTTP/1.1 200")); + assertEquals("utf-16", result.get()); + + //test fallback to content-type encoding + result.set(null); + overrideCharEncoding.set(null); + handler.setDefaultRequestCharacterEncoding(null); + response = _connector.getResponse(request); + assertTrue(response.startsWith("HTTP/1.1 200")); + assertEquals("utf-8", result.get()); + } @Test public void testParamExtraction() throws Exception @@ -1731,7 +1793,7 @@ public class RequestTest assertNotNull(request.getParameterMap()); assertEquals(0, request.getParameterMap().size()); } - + interface RequestTester { boolean check(HttpServletRequest request, HttpServletResponse response) throws IOException; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java index 41f250488ef..653700e9b7f 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java @@ -410,6 +410,68 @@ public class ResponseTest assertThat(BufferUtil.toString(_content), Matchers.containsString("TestD2 1.234.567,89")); } + @Test + public void testResponseCharacterEncoding() throws Exception + { + _server.stop(); + ContextHandler handler = new CharEncodingContextHandler(); + _server.setHandler(handler); + handler.setDefaultResponseCharacterEncoding("utf-16"); + handler.setHandler(new DumpHandler()); + _server.start(); + + //test setting the default response character encoding + Response response = getResponse(); + _channel.getRequest().setContext(handler.getServletContext()); + assertThat("utf-16", Matchers.equalTo(response.getCharacterEncoding())); + + _channel.getRequest().setContext(null); + response.recycle(); + + //test that explicit overrides default + response = getResponse(); + _channel.getRequest().setContext(handler.getServletContext()); + response.setCharacterEncoding("ascii"); + assertThat("ascii", Matchers.equalTo(response.getCharacterEncoding())); + //getWriter should not change explicit character encoding + response.getWriter(); + assertThat("ascii", Matchers.equalTo(response.getCharacterEncoding())); + + _channel.getRequest().setContext(null); + response.recycle(); + + //test that assumed overrides default + response = getResponse(); + _channel.getRequest().setContext(handler.getServletContext()); + response.setContentType("application/json"); + assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding())); + response.getWriter(); + //getWriter should not have modified character encoding + assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding())); + + _channel.getRequest().setContext(null); + response.recycle(); + + //test that inferred overrides default + response = getResponse(); + _channel.getRequest().setContext(handler.getServletContext()); + response.setContentType("application/xhtml+xml"); + assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding())); + //getWriter should not have modified character encoding + response.getWriter(); + assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding())); + + _channel.getRequest().setContext(null); + response.recycle(); + + //test that without a default or any content type, use iso-8859-1 + response = getResponse(); + assertThat("iso-8859-1", Matchers.equalTo(response.getCharacterEncoding())); + //getWriter should not have modified character encoding + response.getWriter(); + assertThat("iso-8859-1", Matchers.equalTo(response.getCharacterEncoding())); + } + @Test public void testContentTypeCharacterEncoding() throws Exception { diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java index b0612de9c4c..52859a3ed73 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletContextHandler.java @@ -1450,5 +1450,35 @@ public class ServletContextHandler extends ContextHandler throw new UnsupportedOperationException(); addRoles(roleNames); } + + @Override + public String getRequestCharacterEncoding() + { + return getDefaultRequestCharacterEncoding(); + } + + @Override + public void setRequestCharacterEncoding(String encoding) + { + if (!isStarting()) + throw new IllegalStateException(); + + setDefaultRequestCharacterEncoding(encoding); + } + + @Override + public String getResponseCharacterEncoding() + { + return getDefaultResponseCharacterEncoding(); + } + + @Override + public void setResponseCharacterEncoding(String encoding) + { + if (!isStarting()) + throw new IllegalStateException(); + + setDefaultResponseCharacterEncoding(encoding); + } } } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java index 82e6a2938f8..8c7cef789a6 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java @@ -98,8 +98,8 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor registerVisitor("distributable", this.getClass().getMethod("visitDistributable", __signature)); registerVisitor("deny-uncovered-http-methods", this.getClass().getMethod("visitDenyUncoveredHttpMethods", __signature)); registerVisitor("default-context-path", this.getClass().getMethod("visitDefaultContextPath", __signature)); - registerVisitor("request-encoding", this.getClass().getMethod("visitRequestEncoding", __signature)); - registerVisitor("response-encoding", this.getClass().getMethod("visitResponseEncoding", __signature)); + registerVisitor("request-character-encoding", this.getClass().getMethod("visitRequestCharacterEncoding", __signature)); + registerVisitor("response-character-encoding", this.getClass().getMethod("visitResponseCharacterEncoding", __signature)); } catch (Exception e) { @@ -1983,11 +1983,17 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node the xml node * @since Servlet 4.0 */ - public void visitRequestEncoding(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitRequestCharacterEncoding(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { - // TODO - LOG.warn("Not implemented {}", node); - // TODO + //As per spec, this element can only appear in web.xml, never in a fragment. Jetty will + //allow it to be specified in webdefault.xml, web.xml, and web-override.xml. + if (!(descriptor instanceof FragmentDescriptor)) + { + String encoding = node.toString(false, true); + context.setAttribute("request-character-encoding", encoding); + context.setDefaultRequestCharacterEncoding(encoding); + context.getMetaData().setOrigin("request-character-encoding", descriptor); + } } /** @@ -1999,9 +2005,16 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node the xml node * @since Servlet 4.0 */ - public void visitResponseEncoding(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitResponseCharacterEncoding(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { - // TODO - LOG.warn("Not implemented {}", node); + //As per spec, this element can only appear in web.xml, never in a fragment. Jetty will + //allow it to be specified in webdefault.xml, web.xml, and web-override.xml. + if (!(descriptor instanceof FragmentDescriptor)) + { + String encoding = node.toString(false, true); + context.setAttribute("response-character-encoding", encoding); + context.setDefaultResponseCharacterEncoding(encoding); + context.getMetaData().setOrigin("response-character-encoding", descriptor); + } } } diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java index 33f65b26ee3..a252edf7300 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/java/com/acme/test/AnnotationTest.java @@ -186,6 +186,17 @@ public class AnnotationTest extends HttpServlet out.println(""); out.println("

Results

"); + out.println("

Context Defaults

"); + out.println("

default-context-path: " + + (request.getServletContext().getAttribute("default-context-path") != null ? "PASS" : "FAIL") + + "

"); + out.println("

request-character-encoding: " + + ("utf-8".equals(request.getServletContext().getAttribute("request-character-encoding")) ? "PASS" : "FAIL") + + "

"); + out.println("

response-character-encoding: " + + ("utf-8".equals(request.getServletContext().getAttribute("response-character-encoding")) ? "PASS" : "FAIL") + + "

"); + out.println("

Init Params from Annotation

"); out.println("
");
             out.println("initParams={@WebInitParam(name=\"fromAnnotation\", value=\"xyz\")}");
diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/web.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/web.xml
index 92b9efbd773..f5e0e3fa8a4 100644
--- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/web.xml
@@ -9,6 +9,8 @@
   Test Annotations WebApp
 
   /test-spec
+  utf-8
+  utf-8
   
   
     com.acme.test.TestListener
@@ -80,7 +82,6 @@
     server-administrator
   
 
-