From 273dcc4131284da584da633a7b1fc23d876b45b5 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 17 Jul 2017 14:18:17 -0700 Subject: [PATCH] Improving output seen during websocket-tests to squelch known stacktraces produced by testcase --- .../tests/MessageOutputStreamTest.java | 4 -- .../websocket/tests/MessageWriterTest.java | 4 -- .../tests/server/BadOpCodesTest.java | 6 +-- .../tests/server/CloseHandlingTest.java | 6 +-- .../CloseHandling_BadStatusCodesTest.java | 8 +++- .../tests/server/ContinuationTest.java | 40 +++++++++--------- .../tests/server/ReservedBitTest.java | 16 +++---- .../websocket/tests/server/TextTest.java | 15 ++++--- .../tests/server/WebSocketOverSSLTest.java | 3 -- .../tests/server/WebSocketServletRFCTest.java | 42 +++++++++++-------- .../JettyServerEndpointConfiguratorTest.java | 2 - .../server/jsr356/LargeContainerTest.java | 2 - .../tests/server/jsr356/MemoryUsageTest.java | 4 -- 13 files changed, 74 insertions(+), 78 deletions(-) diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageOutputStreamTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageOutputStreamTest.java index 89a63b05321..b82e82a0aee 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageOutputStreamTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageOutputStreamTest.java @@ -26,7 +26,6 @@ import java.nio.ByteBuffer; import java.util.Arrays; import java.util.concurrent.TimeUnit; -import org.eclipse.jetty.toolchain.test.TestTracker; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -47,9 +46,6 @@ public class MessageOutputStreamTest { private static final Logger LOG = Log.getLogger(MessageOutputStreamTest.class); - @Rule - public TestTracker testtracker = new TestTracker(); - @Rule public TestName testname = new TestName(); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageWriterTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageWriterTest.java index 9002b71e03e..7183e40e568 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageWriterTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/MessageWriterTest.java @@ -23,7 +23,6 @@ import static org.hamcrest.Matchers.is; import java.net.URI; import java.util.Arrays; -import org.eclipse.jetty.toolchain.test.TestTracker; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.api.WebSocketPolicy; @@ -43,9 +42,6 @@ public class MessageWriterTest { private static final Logger LOG = Log.getLogger(MessageWriterTest.class); - @Rule - public TestTracker testtracker = new TestTracker(); - @Rule public TestName testname = new TestName(); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/BadOpCodesTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/BadOpCodesTest.java index df04b94e34a..87960d8ed69 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/BadOpCodesTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/BadOpCodesTest.java @@ -26,12 +26,12 @@ import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.CloseInfo; -import org.eclipse.jetty.websocket.common.Parser; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.PingFrame; import org.eclipse.jetty.websocket.common.frames.TextFrame; import org.eclipse.jetty.websocket.tests.BadFrame; import org.eclipse.jetty.websocket.tests.LocalFuzzer; +import org.eclipse.jetty.websocket.tests.servlets.EchoSocket; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -72,7 +72,7 @@ public class BadOpCodesTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -94,7 +94,7 @@ public class BadOpCodesTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("hello")); // echo expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandlingTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandlingTest.java index 2bc7db594b9..c7ee1043f52 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandlingTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandlingTest.java @@ -30,7 +30,6 @@ import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.CloseInfo; import org.eclipse.jetty.websocket.common.OpCode; -import org.eclipse.jetty.websocket.common.Parser; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.CloseFrame; import org.eclipse.jetty.websocket.common.frames.ContinuationFrame; @@ -40,6 +39,7 @@ import org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection; import org.eclipse.jetty.websocket.tests.BadFrame; import org.eclipse.jetty.websocket.tests.DataUtils; import org.eclipse.jetty.websocket.tests.LocalFuzzer; +import org.eclipse.jetty.websocket.tests.servlets.EchoSocket; import org.junit.Test; /** @@ -66,7 +66,7 @@ public class CloseHandlingTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -98,7 +98,7 @@ public class CloseHandlingTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class,CloseInfo.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandling_BadStatusCodesTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandling_BadStatusCodesTest.java index dcbd65ee06e..2434478d009 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandling_BadStatusCodesTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/CloseHandling_BadStatusCodesTest.java @@ -25,11 +25,13 @@ import java.util.List; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.CloseInfo; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.CloseFrame; import org.eclipse.jetty.websocket.tests.LocalFuzzer; +import org.eclipse.jetty.websocket.tests.servlets.EchoSocket; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -96,7 +98,8 @@ public class CloseHandling_BadStatusCodesTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (LocalFuzzer session = server.newLocalFuzzer()) + try (StacklessLogging ignore = new StacklessLogging(EchoSocket.class); + LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); session.expect(expect); @@ -123,7 +126,8 @@ public class CloseHandling_BadStatusCodesTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (LocalFuzzer session = server.newLocalFuzzer()) + try (StacklessLogging ignore = new StacklessLogging(EchoSocket.class); + LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); session.expect(expect); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ContinuationTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ContinuationTest.java index c9d0c7e7966..34f92711d68 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ContinuationTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ContinuationTest.java @@ -25,13 +25,13 @@ import org.eclipse.jetty.toolchain.test.annotation.Slow; import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.CloseInfo; -import org.eclipse.jetty.websocket.common.Parser; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.ContinuationFrame; import org.eclipse.jetty.websocket.common.frames.PingFrame; import org.eclipse.jetty.websocket.common.frames.PongFrame; import org.eclipse.jetty.websocket.common.frames.TextFrame; import org.eclipse.jetty.websocket.tests.LocalFuzzer; +import org.eclipse.jetty.websocket.tests.servlets.EchoSocket; import org.junit.Test; /** @@ -57,7 +57,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -83,7 +83,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendFrames(send); @@ -109,7 +109,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendSegmented(send,1 ); @@ -135,7 +135,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -164,7 +164,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("fragment1fragment2")); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -190,7 +190,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendFrames(send); @@ -220,7 +220,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -246,7 +246,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendSegmented(send,1); @@ -276,7 +276,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -302,7 +302,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -328,7 +328,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -354,7 +354,7 @@ public class ContinuationTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -381,7 +381,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -408,7 +408,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendFrames(send); @@ -443,7 +443,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("f1,f2,f3,f4,f5")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -470,7 +470,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendSegmented(send,1); @@ -499,7 +499,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -528,7 +528,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendFrames(send); @@ -557,7 +557,7 @@ public class ContinuationTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("hello, world")); expect.add(new CloseInfo(StatusCode.NORMAL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendSegmented(send,1); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ReservedBitTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ReservedBitTest.java index fd64e4fd8a5..752bbf3077b 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ReservedBitTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/ReservedBitTest.java @@ -25,12 +25,12 @@ import java.util.List; import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.CloseInfo; -import org.eclipse.jetty.websocket.common.Parser; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.BinaryFrame; import org.eclipse.jetty.websocket.common.frames.PingFrame; import org.eclipse.jetty.websocket.common.frames.TextFrame; import org.eclipse.jetty.websocket.tests.LocalFuzzer; +import org.eclipse.jetty.websocket.tests.servlets.EchoSocket; import org.junit.Test; /** @@ -54,7 +54,7 @@ public class ReservedBitTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -81,7 +81,7 @@ public class ReservedBitTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("small")); // echo on good frame expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -108,7 +108,7 @@ public class ReservedBitTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("small")); // echo on good frame expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendFrames(send); @@ -135,7 +135,7 @@ public class ReservedBitTest extends AbstractLocalServerCase expect.add(new TextFrame().setPayload("small")); // echo on good frame expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendSegmented(send, 1); @@ -162,7 +162,7 @@ public class ReservedBitTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -189,7 +189,7 @@ public class ReservedBitTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); @@ -217,7 +217,7 @@ public class ReservedBitTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/TextTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/TextTest.java index b7c8b98fa1c..bf5e132da75 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/TextTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/TextTest.java @@ -32,13 +32,13 @@ import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.common.CloseInfo; import org.eclipse.jetty.websocket.common.OpCode; -import org.eclipse.jetty.websocket.common.Parser; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.frames.ContinuationFrame; import org.eclipse.jetty.websocket.common.frames.DataFrame; import org.eclipse.jetty.websocket.common.frames.TextFrame; import org.eclipse.jetty.websocket.tests.DataUtils; import org.eclipse.jetty.websocket.tests.LocalFuzzer; +import org.eclipse.jetty.websocket.tests.servlets.EchoSocket; import org.junit.Test; /** @@ -465,7 +465,8 @@ public class TextTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame()); - try (LocalFuzzer session = server.newLocalFuzzer()) + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); + LocalFuzzer session = server.newLocalFuzzer()) { session.sendBulk(send); session.expect(expect); @@ -483,7 +484,7 @@ public class TextTest extends AbstractLocalServerCase public void testText_BadUtf8_ByteWise() throws Exception { // Disable Long Stacks from Parser (we know this test will throw an exception) - try (StacklessLogging ignored = new StacklessLogging(Parser.class)) + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class)) { ByteBuffer payload = ByteBuffer.allocate(64); BufferUtil.clearToFill(payload); @@ -554,7 +555,8 @@ public class TextTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame()); - try (LocalFuzzer session = server.newLocalFuzzer()) + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); + LocalFuzzer session = server.newLocalFuzzer()) { session.sendFrames(send); session.expect(expect); @@ -592,7 +594,8 @@ public class TextTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame()); - try (LocalFuzzer session = server.newLocalFuzzer()) + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); + LocalFuzzer session = server.newLocalFuzzer()) { session.sendFrames(send); session.expect(expect); @@ -618,7 +621,7 @@ public class TextTest extends AbstractLocalServerCase List expect = new ArrayList<>(); expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame()); - try (StacklessLogging ignored = new StacklessLogging(Parser.class); + try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class); LocalFuzzer session = server.newLocalFuzzer()) { ByteBuffer net = session.asNetworkBuffer(send); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketOverSSLTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketOverSSLTest.java index 80ac11ef39f..05d695414df 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketOverSSLTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketOverSSLTest.java @@ -82,7 +82,6 @@ public class WebSocketOverSSLTest TrackingEndpoint clientSocket = new TrackingEndpoint("Client"); URI requestUri = server.getServerUri(); - System.err.printf("Request URI: %s%n",requestUri.toASCIIString()); Future fut = client.connect(clientSocket,requestUri); // wait for connect @@ -124,7 +123,6 @@ public class WebSocketOverSSLTest TrackingEndpoint clientSocket = new TrackingEndpoint("Client"); URI requestUri = server.getServerUri(); - System.err.printf("Request URI: %s%n",requestUri.toASCIIString()); Future fut = client.connect(clientSocket,requestUri); // wait for connect @@ -165,7 +163,6 @@ public class WebSocketOverSSLTest TrackingEndpoint clientSocket = new TrackingEndpoint("Client"); URI requestUri = server.getServerUri().resolve("/deep?a=b"); - System.err.printf("Request URI: %s%n",requestUri.toASCIIString()); Future fut = client.connect(clientSocket,requestUri); // wait for connect diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketServletRFCTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketServletRFCTest.java index 07a298b4d7d..cca96adcbfd 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketServletRFCTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketServletRFCTest.java @@ -28,10 +28,10 @@ import java.util.Arrays; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import org.eclipse.jetty.toolchain.test.AdvancedRunner; import org.eclipse.jetty.toolchain.test.Hex; import org.eclipse.jetty.util.Utf8Appendable.NotUtf8Exception; import org.eclipse.jetty.util.Utf8StringBuilder; +import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.websocket.api.StatusCode; @@ -39,6 +39,7 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.common.Generator; import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketSession; import org.eclipse.jetty.websocket.common.frames.BinaryFrame; import org.eclipse.jetty.websocket.common.frames.ContinuationFrame; import org.eclipse.jetty.websocket.common.frames.TextFrame; @@ -58,12 +59,10 @@ import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; -import org.junit.runner.RunWith; /** * Test various RFC 6455 specified requirements placed on {@link WebSocketServlet} */ -@RunWith(AdvancedRunner.class) public class WebSocketServletRFCTest { private static SimpleServletServer server; @@ -220,10 +219,16 @@ public class WebSocketServletRFCTest UntrustedWSSession clientSession = clientConnectFuture.get(Defaults.CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS); UntrustedWSEndpoint clientSocket = clientSession.getUntrustedEndpoint(); - - clientSession.getRemote().sendString("CRASH"); - clientSocket.awaitCloseEvent("Client"); - clientSocket.assertCloseInfo("Client", StatusCode.SERVER_ERROR, anything()); + + try (StacklessLogging ignored = new StacklessLogging( + Log.getLogger(WebSocketSession.class.getName() + ".SERVER"), + Log.getLogger(RFC6455Socket.class))) + { + clientSession.getRemote().sendString("CRASH"); + + clientSocket.awaitCloseEvent("Client"); + clientSocket.assertCloseInfo("Client", StatusCode.SERVER_ERROR, anything()); + } } /** @@ -314,15 +319,18 @@ public class WebSocketServletRFCTest byte buf[] = new byte[]{(byte) 0xC2, (byte) 0xC3}; Generator generator = new Generator(WebSocketPolicy.newServerPolicy(), client.getBufferPool(), false); - - WebSocketFrame txt = new TextFrame().setPayload(ByteBuffer.wrap(buf)); - txt.setMask(Hex.asByteArray("11223344")); - ByteBuffer bbHeader = generator.generateHeaderBytes(txt); - - clientConnection.writeRaw(bbHeader); - clientConnection.writeRaw(txt.getPayload()); - - clientSocket.awaitCloseEvent("Client"); - clientSocket.assertCloseInfo("Client", StatusCode.BAD_PAYLOAD, anything()); + + try (StacklessLogging ignored = new StacklessLogging(RFC6455Socket.class)) + { + WebSocketFrame txt = new TextFrame().setPayload(ByteBuffer.wrap(buf)); + txt.setMask(Hex.asByteArray("11223344")); + ByteBuffer bbHeader = generator.generateHeaderBytes(txt); + + clientConnection.writeRaw(bbHeader); + clientConnection.writeRaw(txt.getPayload()); + + clientSocket.awaitCloseEvent("Client"); + clientSocket.assertCloseInfo("Client", StatusCode.BAD_PAYLOAD, anything()); + } } } diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/JettyServerEndpointConfiguratorTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/JettyServerEndpointConfiguratorTest.java index c9093efb065..79a5530619f 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/JettyServerEndpointConfiguratorTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/JettyServerEndpointConfiguratorTest.java @@ -39,8 +39,6 @@ public class JettyServerEndpointConfiguratorTest @Test public void testServiceLoader() { - System.out.printf("Service Name: %s%n",ServerEndpointConfig.Configurator.class.getName()); - ServiceLoader loader = ServiceLoader.load(javax.websocket.server.ServerEndpointConfig.Configurator.class); assertThat("loader",loader,notNullValue()); Iterator iter = loader.iterator(); diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/LargeContainerTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/LargeContainerTest.java index 988ca40eaaf..a800a2669dd 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/LargeContainerTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/LargeContainerTest.java @@ -37,7 +37,6 @@ import org.eclipse.jetty.toolchain.test.TestingDir; import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.client.WebSocketClient; -import org.eclipse.jetty.websocket.common.util.TextUtil; import org.eclipse.jetty.websocket.tests.LeakTrackingBufferPoolRule; import org.eclipse.jetty.websocket.tests.TrackingEndpoint; import org.eclipse.jetty.websocket.tests.WSServer; @@ -56,7 +55,6 @@ public class LargeContainerTest public void echo(javax.websocket.Session session, String msg) { // reply with echo - System.err.printf("echo(%s)%n", TextUtil.hint(msg)); session.getAsyncRemote().sendText(msg); } } diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/MemoryUsageTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/MemoryUsageTest.java index b363bdf6fb3..129b10d9f39 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/MemoryUsageTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/jsr356/MemoryUsageTest.java @@ -132,10 +132,6 @@ public class MemoryUsageTest long heapUsed = heapAfter.getUsed() - heapBefore.getUsed(); long nonHeapUsed = nonHeapAfter.getUsed() - nonHeapBefore.getUsed(); - System.out.println("heapUsed = " + heapUsed); - System.out.println("nonHeapUsed = " + nonHeapUsed); -// new CountDownLatch(1).await(); - // Assume no more than 25 KiB per session pair (client and server). long expected = 25 * 1024 * sessionCount; Assert.assertThat("heap used", heapUsed,lessThan(expected));