Silencing bogus JSR356 IdleTimeoutTest warning

This commit is contained in:
Joakim Erdfelt 2017-05-10 12:13:24 -07:00
parent 427408c251
commit 2679715a30
1 changed files with 4 additions and 15 deletions

View File

@ -22,42 +22,31 @@ import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.common.test.LeakTrackingBufferPoolRule;
import org.eclipse.jetty.websocket.jsr356.annotations.JsrEvents; import org.eclipse.jetty.websocket.jsr356.annotations.JsrEvents;
import org.eclipse.jetty.websocket.jsr356.server.samples.idletimeout.IdleTimeoutContextListener; import org.eclipse.jetty.websocket.jsr356.server.samples.idletimeout.IdleTimeoutContextListener;
import org.eclipse.jetty.websocket.jsr356.server.samples.idletimeout.OnOpenIdleTimeoutEndpoint; import org.eclipse.jetty.websocket.jsr356.server.samples.idletimeout.OnOpenIdleTimeoutEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.samples.idletimeout.OnOpenIdleTimeoutSocket; import org.eclipse.jetty.websocket.jsr356.server.samples.idletimeout.OnOpenIdleTimeoutSocket;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
public class IdleTimeoutTest public class IdleTimeoutTest
{ {
private static final Logger LOG = Log.getLogger(IdleTimeoutTest.class); private static final Logger LOG = Log.getLogger(IdleTimeoutTest.class);
@Rule
public TestingDir testdir = new TestingDir();
@Rule
public LeakTrackingBufferPoolRule bufferPool = new LeakTrackingBufferPoolRule("Test");
private static WSServer server; private static WSServer server;
@BeforeClass @BeforeClass
@ -85,15 +74,15 @@ public class IdleTimeoutTest
server.stop(); server.stop();
} }
private void assertConnectionTimeout(URI uri) throws Exception, IOException, InterruptedException, ExecutionException, TimeoutException private void assertConnectionTimeout(URI uri) throws Exception
{ {
WebSocketClient client = new WebSocketClient(bufferPool); WebSocketClient client = new WebSocketClient();
try try
{ {
client.start(); client.start();
JettyEchoSocket clientEcho = new JettyEchoSocket(); JettyEchoSocket clientEcho = new JettyEchoSocket();
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("Client Attempting to connnect"); LOG.debug("Client Attempting to connect");
Future<Session> future = client.connect(clientEcho,uri); Future<Session> future = client.connect(clientEcho,uri);
// wait for connect // wait for connect
future.get(1,TimeUnit.SECONDS); future.get(1,TimeUnit.SECONDS);
@ -129,7 +118,7 @@ public class IdleTimeoutTest
@Test @Test
public void testAnnotated() throws Exception public void testAnnotated() throws Exception
{ {
try(StacklessLogging stackless = new StacklessLogging(JsrEvents.class)) try(StacklessLogging ignored = new StacklessLogging(JsrEvents.class))
{ {
URI uri = server.getServerBaseURI(); URI uri = server.getServerBaseURI();
assertConnectionTimeout(uri.resolve("idle-onopen-socket")); assertConnectionTimeout(uri.resolve("idle-onopen-socket"));