Disable test for WebSocket CDI HttpSession injection and link to issue.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-04-15 09:38:40 +10:00
parent 0d84f35b0d
commit 045bc72c92
2 changed files with 6 additions and 5 deletions

View File

@ -53,7 +53,7 @@ public class LocalEndpointMetadataTest
} }
private final WebSocketComponents components = new WebSocketComponents(); private final WebSocketComponents components = new WebSocketComponents();
private final JettyWebSocketFrameHandlerFactory endpointFactory = new JettyWebSocketFrameHandlerFactory(container,components); private final JettyWebSocketFrameHandlerFactory endpointFactory = new JettyWebSocketFrameHandlerFactory(container, components);
private JettyWebSocketFrameHandlerMetadata createMetadata(Class<?> endpointClass) private JettyWebSocketFrameHandlerMetadata createMetadata(Class<?> endpointClass)
{ {

View File

@ -17,7 +17,6 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -56,9 +55,11 @@ import org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletCont
import org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletContainerInitializer.Configurator; import org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletContainerInitializer.Configurator;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
@ -162,6 +163,7 @@ public class JavaxWebSocketCdiTest
} }
@Test @Test
@Disabled("See issue https://github.com/eclipse/jetty.project/issues/6174")
public void testHttpSessionInjection() throws Exception public void testHttpSessionInjection() throws Exception
{ {
start((servletContext, wsContainer) -> wsContainer.addEndpoint(CdiHttpSessionSocket.class)); start((servletContext, wsContainer) -> wsContainer.addEndpoint(CdiHttpSessionSocket.class));
@ -172,7 +174,7 @@ public class JavaxWebSocketCdiTest
Session session = _client.connectToServer(clientEndpoint, uri); Session session = _client.connectToServer(clientEndpoint, uri);
session.getBasicRemote().sendObject("hello world"); session.getBasicRemote().sendObject("hello world");
String rcvMessage = clientEndpoint._textMessages.poll(5, TimeUnit.SECONDS); String rcvMessage = clientEndpoint._textMessages.poll(5, TimeUnit.SECONDS);
assertThat(rcvMessage, is("hello world")); assertThat(rcvMessage, containsString("hello world, SessionID:"));
session.close(); session.close();
assertTrue(clientEndpoint._closeLatch.await(5, TimeUnit.SECONDS)); assertTrue(clientEndpoint._closeLatch.await(5, TimeUnit.SECONDS));
} }
@ -396,8 +398,7 @@ public class JavaxWebSocketCdiTest
@Override @Override
public void onMessage(String message) throws IOException public void onMessage(String message) throws IOException
{ {
Objects.requireNonNull(httpSession); session.getBasicRemote().sendText(message + ", SessionID:" + httpSession.getId());
session.getBasicRemote().sendText(message + " " + httpSession.getClass());
} }
} }
} }