Skip to content

Commit

Permalink
Updated Jetty dependency and a test broken by Jetty changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakaarl committed Oct 31, 2016
1 parent 1a3e014 commit 623b76c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -30,7 +30,7 @@

<properties>
<java.version>1.8</java.version>
<jetty.version>9.3.6.v20151106</jetty.version>
<jetty.version>9.3.13.v20161014</jetty.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<powermock.version>1.6.4</powermock.version>
<mockito.version>1.10.19</mockito.version>
Expand Down
@@ -1,10 +1,10 @@
package spark.embeddedserver.jetty.websocket;

import org.eclipse.jetty.http.pathmap.MappedResource;
import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.websocket.server.WebSocketServerFactory;
import org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter;
import org.eclipse.jetty.websocket.server.pathmap.PathMappings;
import org.eclipse.jetty.websocket.server.pathmap.PathSpec;
import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -47,12 +47,12 @@ public void testCreate_whenNoIdleTimeoutIsPresent() throws Exception {

assertNotNull("Should return a WebSocketUpgradeFilter because we configured it to have one", webSocketUpgradeFilter);

PathMappings.MappedResource<WebSocketCreator> mappedResource = webSocketUpgradeFilter.getMappings().getMatch("/websocket");
MappedResource<WebSocketCreator> mappedResource = webSocketUpgradeFilter.getMappings().getMatch("/websocket");
WebSocketCreatorFactory.SparkWebSocketCreator sc = (WebSocketCreatorFactory.SparkWebSocketCreator) mappedResource.getResource();
PathSpec pathSpec = (PathSpec) mappedResource.getPathSpec();

assertEquals("Should return the WebSocket path specified when contexst handler was created",
webSocketPath, pathSpec.getPathSpec());
assertTrue("Should return the WebSocket path specified when contexst handler was created",
pathSpec.matches(webSocketPath));

assertTrue("Should return true because handler should be an instance of the one we passed when it was created",
sc.getHandler() instanceof WebSocketTestHandler);
Expand All @@ -79,12 +79,12 @@ public void testCreate_whenTimeoutIsPresent() throws Exception {
assertEquals("Timeout value should be the same as the timeout specified when context handler was created",
timeout.longValue(), webSocketServerFactory.getPolicy().getIdleTimeout());

PathMappings.MappedResource<WebSocketCreator> mappedResource = webSocketUpgradeFilter.getMappings().getMatch("/websocket");
MappedResource<WebSocketCreator> mappedResource = webSocketUpgradeFilter.getMappings().getMatch("/websocket");
WebSocketCreatorFactory.SparkWebSocketCreator sc = (WebSocketCreatorFactory.SparkWebSocketCreator) mappedResource.getResource();
PathSpec pathSpec = (PathSpec) mappedResource.getPathSpec();

assertEquals("Should return the WebSocket path specified when context handler was created",
webSocketPath, pathSpec.getPathSpec());
assertTrue("Should return the WebSocket path specified when context handler was created",
pathSpec.matches(webSocketPath));

assertTrue("Should return true because handler should be an instance of the one we passed when it was created",
sc.getHandler() instanceof WebSocketTestHandler);
Expand Down

0 comments on commit 623b76c

Please sign in to comment.