Merge branch 'jetty-10.0.x-3167-websocket-mapping' into jetty-10.0.x-3167-2175-websocket-close

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-01-15 18:02:41 +11:00
commit be69351f0e
12 changed files with 54 additions and 48 deletions

View File

@ -100,7 +100,7 @@ abstract public class WriteFlusher
* @param previous the expected current state
* @param next the desired new state
* @return the previous state or null if the state transition failed
* @throws WritePendingException if currentState is WRITING and new state is WRITING (api usage error)
* @throws IllegalStateException if previous to next is not a legal state transition (api usage error)
*/
private boolean updateState(State previous, State next)
{

View File

@ -32,7 +32,6 @@ import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -81,19 +80,14 @@ public class TestJettyOSGiBootContextAsService
@Ignore
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
}
/**
*/
@Test
public void testContextHandlerAsOSGiService() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
// now test the context
HttpClient client = new HttpClient();
try

View File

@ -40,7 +40,6 @@ import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -117,8 +116,7 @@ public class TestJettyOSGiBootHTTP2Conscrypt
}
@Ignore
@Test
public void assertAllBundlesActiveOrResolved() throws Exception
{
TestOSGiUtil.debugBundles(bundleContext);
@ -134,6 +132,9 @@ public class TestJettyOSGiBootHTTP2Conscrypt
@Test
public void testHTTP2() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
HTTP2Client client = new HTTP2Client();
try
{

View File

@ -39,7 +39,6 @@ import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -108,7 +107,6 @@ public class TestJettyOSGiBootHTTP2JDK9
}
@Ignore
public void assertAllBundlesActiveOrResolved() throws Exception
{
TestOSGiUtil.debugBundles(bundleContext);
@ -126,6 +124,9 @@ public class TestJettyOSGiBootHTTP2JDK9
@Test
public void testHTTP2() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
HttpClient httpClient = null;
HTTP2Client http2Client = null;
try

View File

@ -33,7 +33,6 @@ import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -97,8 +96,7 @@ public class TestJettyOSGiBootWebAppAsService
return res;
}
@Ignore
@Test
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.debugBundles(bundleContext);
@ -110,6 +108,11 @@ public class TestJettyOSGiBootWebAppAsService
@Test
public void testBundle() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
// now test getting a static file
HttpClient client = new HttpClient();
try

View File

@ -33,7 +33,6 @@ import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.http.HttpStatus;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -95,10 +94,9 @@ public class TestJettyOSGiBootWithAnnotations
}
@Ignore
@Test
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.debugBundles(bundleContext);
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
}
@ -107,6 +105,10 @@ public class TestJettyOSGiBootWithAnnotations
@Test
public void testIndex() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
HttpClient client = new HttpClient();
try
{

View File

@ -35,7 +35,6 @@ import javax.websocket.RemoteEndpoint;
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -91,6 +90,7 @@ public class TestJettyOSGiBootWithJavaxWebSocket
public static List<Option> testJettyWebApp()
{
List<Option> res = new ArrayList<>();
//test webapp bundle
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("test-jetty-webapp").classifier("webbundle").versionAsInProject().noStart());
return res;
}
@ -102,16 +102,9 @@ public class TestJettyOSGiBootWithJavaxWebSocket
return res;
}
@Ignore
public void assertAllBundlesActiveOrResolved() throws BundleException
public void assertAllBundlesActiveOrResolved()
{
fixJavaxWebSocketApi();
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.common");
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.client");
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.server");
startBundle(bundleContext, "org.eclipse.jetty.tests.webapp");
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
TestOSGiUtil.debugBundles(bundleContext);
}
@ -119,6 +112,7 @@ public class TestJettyOSGiBootWithJavaxWebSocket
@Test
public void testWebsocket() throws Exception
{
fixJavaxWebSocketApi();
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.common");
@ -126,6 +120,9 @@ public class TestJettyOSGiBootWithJavaxWebSocket
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.server");
startBundle(bundleContext, "org.eclipse.jetty.tests.webapp");
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
String port = System.getProperty("boot.javax.websocket.port");
assertNotNull(port);

View File

@ -32,7 +32,6 @@ import javax.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -86,8 +85,6 @@ public class TestJettyOSGiBootWithJsp
}
@Ignore
@Test
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.debugBundles(bundleContext);
@ -98,6 +95,9 @@ public class TestJettyOSGiBootWithJsp
@Test
public void testJspDump() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
HttpClient client = new HttpClient();
try
{

View File

@ -32,7 +32,6 @@ import javax.inject.Inject;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -85,7 +84,6 @@ public class TestJettyOSGiBootWithWebSocket
}
@Ignore
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
@ -97,6 +95,9 @@ public class TestJettyOSGiBootWithWebSocket
@Test
public void testWebsocket() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
String port = System.getProperty("boot.websocket.port");
assertNotNull(port);

View File

@ -44,7 +44,6 @@ import org.eclipse.jetty.osgi.boot.OSGiServerConstants;
import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Option;
import org.osgi.framework.Bundle;
@ -58,6 +57,8 @@ import org.osgi.service.http.HttpService;
public class TestOSGiUtil
{
public static final String BUNDLE_DEBUG = "bundle.debug";
public static List<Option> configureJettyHomeAndPort(boolean ssl,String jettySelectorFileName)
{
File etc = new File(FS.separators("src/test/config/etc"));
@ -103,7 +104,7 @@ public class TestOSGiUtil
public static List<Option> coreJettyDependencies()
{
List<Option> res = new ArrayList<>();
res.add(systemProperty("bundle.debug").value(Boolean.toString(Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))));
String mavenRepoPath = System.getProperty( "mavenRepoPath" );
if (!StringUtil.isBlank(mavenRepoPath))
res.add( systemProperty( "org.ops4j.pax.url.mvn.localRepository" ).value( mavenRepoPath ) );

View File

@ -18,9 +18,6 @@
package org.eclipse.jetty.websocket.javax.tests.client;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
@ -51,6 +48,9 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class DecoderReaderManySmallTest
{
private CoreServer server;
@ -91,12 +91,14 @@ public class DecoderReaderManySmallTest
{
URI wsUri = server.getWsUri().resolve("/eventids");
EventIdSocket clientSocket = new EventIdSocket(testInfo.getTestMethod().toString());
Session clientSession = client.connectToServer(clientSocket, wsUri);
final int from = 1000;
final int to = 2000;
clientSession.getAsyncRemote().sendText("seq|" + from + "|" + to);
try(Session clientSession = client.connectToServer(clientSocket, wsUri))
{
clientSession.getAsyncRemote().sendText("seq|" + from + "|" + to);
}
// collect seen ids
List<Integer> seen = new ArrayList<>();
@ -182,6 +184,8 @@ public class DecoderReaderManySmallTest
sendText(Integer.toString(id), Callback.NOOP, false);
}
}
getCoreSession().flush(callback);
}
}
}

View File

@ -18,7 +18,11 @@
package org.eclipse.jetty.websocket.javax.tests.server;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.websocket.core.CloseStatus;
import org.eclipse.jetty.websocket.core.Frame;
@ -31,9 +35,6 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
@ -69,7 +70,8 @@ public class IdleTimeoutTest
private void assertConnectionTimeout(String requestPath) throws Exception
{
try (Fuzzer session = server.newNetworkFuzzer(requestPath))
try (Fuzzer session = server.newNetworkFuzzer(requestPath);
StacklessLogging stacklessLogging = new StacklessLogging(IdleTimeoutOnOpenSocket.class))
{
// wait 1 second to allow timeout to fire off
TimeUnit.SECONDS.sleep(1);