Class {@code com.acme.Person} must either implement {@link Convertible},
+ * or be mapped with a {@link Convertor} via {@link Factory#putConvertor(String, Convertor)}.
+ */
+public class AsyncJSON
+{
+ /**
+ *
The factory that creates AsyncJSON instances.
+ *
The factory can be configured with custom {@link Convertor}s,
+ * and with cached strings that will not be allocated if they can
+ * be looked up from the cache.
+ */
+ public static class Factory
+ {
+ private Trie cache;
+ private Map convertors;
+ private boolean detailedParseException;
+
+ /**
+ * @return whether a parse failure should report the whole JSON string or just the last chunk
+ */
+ public boolean isDetailedParseException()
+ {
+ return detailedParseException;
+ }
+
+ /**
+ * @param detailedParseException whether a parse failure should report the whole JSON string or just the last chunk
+ */
+ public void setDetailedParseException(boolean detailedParseException)
+ {
+ this.detailedParseException = detailedParseException;
+ }
+
+ /**
+ * @param value the string to cache
+ * @return whether the value can be cached
+ */
+ public boolean cache(String value)
+ {
+ if (cache == null)
+ cache = new ArrayTernaryTrie.Growing<>(false, 64, 64);
+
+ CachedString cached = new CachedString(value);
+ if (cached.isCacheable())
+ {
+ cache.put(cached.encoded, cached);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
Attempts to return a cached string from the buffer bytes.
+ *
In case of a cache hit, the string is returned and the buffer
+ * position updated.
+ *
In case of cache miss, {@code null} is returned and the buffer
+ * position is left unaltered.
+ *
+ * @param buffer the buffer to lookup the string from
+ * @return a cached string or {@code null}
+ */
+ protected String cached(ByteBuffer buffer)
+ {
+ if (cache != null)
+ {
+ CachedString result = cache.getBest(buffer, 0, buffer.remaining());
+ if (result != null)
+ {
+ buffer.position(buffer.position() + result.encoded.length());
+ return result.value;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return a new parser instance
+ */
+ public AsyncJSON newAsyncJSON()
+ {
+ return new AsyncJSON(this);
+ }
+
+ /**
+ *
Associates the given {@link Convertor} to the given class name.
+ *
+ * @param className the domain class name such as {@code com.acme.Person}
+ * @param convertor the {@link Convertor} that converts {@code Map} to domain objects
+ */
+ public void putConvertor(String className, Convertor convertor)
+ {
+ if (convertors == null)
+ convertors = new ConcurrentHashMap<>();
+ convertors.put(className, convertor);
+ }
+
+ /**
+ *
Removes the {@link Convertor} associated with the given class name.
+ *
+ * @param className the class name associated with the {@link Convertor}
+ * @return the {@link Convertor} associated with the class name, or {@code null}
+ */
+ public Convertor removeConvertor(String className)
+ {
+ if (convertors != null)
+ return convertors.remove(className);
+ return null;
+ }
+
+ /**
+ *
Returns the {@link Convertor} associated with the given class name, if any.
+ *
+ * @param className the class name associated with the {@link Convertor}
+ * @return the {@link Convertor} associated with the class name, or {@code null}
+ */
+ public Convertor getConvertor(String className)
+ {
+ return convertors == null ? null : convertors.get(className);
+ }
+
+ private static class CachedString
+ {
+ private final String encoded;
+ private final String value;
+
+ private CachedString(String value)
+ {
+ this.encoded = new JSON().toJSON(value);
+ this.value = value;
+ }
+
+ private boolean isCacheable()
+ {
+ for (int i = encoded.length(); i-- > 0;)
+ {
+ char c = encoded.charAt(i);
+ if (c > 127)
+ return false;
+ }
+ return true;
+ }
+ }
+ }
+
+ private static final Object UNSET = new Object();
+
+ private final FrameStack stack = new FrameStack();
+ private final NumberBuilder numberBuilder = new NumberBuilder();
+ private final Utf8StringBuilder stringBuilder = new Utf8StringBuilder(32);
+ private final Factory factory;
+ private List chunks;
+
+ public AsyncJSON(Factory factory)
+ {
+ this.factory = factory;
+ }
+
+ // Used by tests only.
+ boolean isEmpty()
+ {
+ return stack.isEmpty();
+ }
+
+ /**
+ *
Feeds the parser with the given bytes chunk.
+ *
+ * @param bytes the bytes to parse
+ * @return whether the JSON parsing was complete
+ * @throws IllegalArgumentException if the JSON is malformed
+ */
+ public boolean parse(byte[] bytes)
+ {
+ return parse(bytes, 0, bytes.length);
+ }
+
+ /**
+ *
Feeds the parser with the given bytes chunk.
+ *
+ * @param bytes the bytes to parse
+ * @param offset the offset to start parsing from
+ * @param length the number of bytes to parse
+ * @return whether the JSON parsing was complete
+ * @throws IllegalArgumentException if the JSON is malformed
+ */
+ public boolean parse(byte[] bytes, int offset, int length)
+ {
+ return parse(ByteBuffer.wrap(bytes, offset, length));
+ }
+
+ /**
+ *
Feeds the parser with the given buffer chunk.
+ *
+ * @param buffer the buffer to parse
+ * @return whether the JSON parsing was complete
+ * @throws IllegalArgumentException if the JSON is malformed
+ */
+ public boolean parse(ByteBuffer buffer)
+ {
+ try
+ {
+ if (factory.isDetailedParseException())
+ {
+ if (chunks == null)
+ chunks = new ArrayList<>();
+ ByteBuffer copy = buffer.isDirect()
+ ? ByteBuffer.allocateDirect(buffer.remaining())
+ : ByteBuffer.allocate(buffer.remaining());
+ copy.put(buffer).flip();
+ chunks.add(copy);
+ buffer.flip();
+ }
+
+ if (stack.isEmpty())
+ stack.push(State.COMPLETE, UNSET);
+
+ while (true)
+ {
+ Frame frame = stack.peek();
+ State state = frame.state;
+ switch (state)
+ {
+ case COMPLETE:
+ {
+ if (frame.value == UNSET)
+ {
+ if (parseAny(buffer))
+ break;
+ return false;
+ }
+ else
+ {
+ while (buffer.hasRemaining())
+ {
+ int position = buffer.position();
+ byte peek = buffer.get(position);
+ if (isWhitespace(peek))
+ buffer.position(position + 1);
+ else
+ throw newInvalidJSON(buffer, "invalid character after JSON data");
+ }
+ return true;
+ }
+ }
+ case NULL:
+ {
+ if (parseNull(buffer))
+ break;
+ return false;
+ }
+ case TRUE:
+ {
+ if (parseTrue(buffer))
+ break;
+ return false;
+ }
+ case FALSE:
+ {
+ if (parseFalse(buffer))
+ break;
+ return false;
+ }
+ case NUMBER:
+ {
+ if (parseNumber(buffer))
+ break;
+ return false;
+ }
+ case STRING:
+ {
+ if (parseString(buffer))
+ break;
+ return false;
+ }
+ case ESCAPE:
+ {
+ if (parseEscape(buffer))
+ break;
+ return false;
+ }
+ case UNICODE:
+ {
+ if (parseUnicode(buffer))
+ break;
+ return false;
+ }
+ case ARRAY:
+ {
+ if (parseArray(buffer))
+ break;
+ return false;
+ }
+ case OBJECT:
+ {
+ if (parseObject(buffer))
+ break;
+ return false;
+ }
+ case OBJECT_FIELD:
+ {
+ if (parseObjectField(buffer))
+ break;
+ return false;
+ }
+ case OBJECT_FIELD_NAME:
+ {
+ if (parseObjectFieldName(buffer))
+ break;
+ return false;
+ }
+ case OBJECT_FIELD_VALUE:
+ {
+ if (parseObjectFieldValue(buffer))
+ break;
+ return false;
+ }
+ default:
+ {
+ throw new IllegalStateException("invalid state " + state);
+ }
+ }
+ }
+ }
+ catch (Throwable x)
+ {
+ reset();
+ throw x;
+ }
+ }
+
+ /**
+ *
Signals to the parser that the parse data is complete, and returns
+ * the object parsed from the JSON chunks passed to the {@code parse()}
+ * methods.
+ *
+ * @param the type the result is cast to
+ * @return the result of the JSON parsing
+ * @throws IllegalArgumentException if the JSON is malformed
+ * @throws IllegalStateException if the no JSON was passed to the {@code parse()} methods
+ */
+ public R complete()
+ {
+ try
+ {
+ if (stack.isEmpty())
+ throw new IllegalStateException("no JSON parsed");
+
+ while (true)
+ {
+ State state = stack.peek().state;
+ switch (state)
+ {
+ case NUMBER:
+ {
+ Number value = numberBuilder.value();
+ stack.pop();
+ stack.peek().value(value);
+ break;
+ }
+ case COMPLETE:
+ {
+ if (stack.peek().value == UNSET)
+ throw new IllegalStateException("invalid state " + state);
+ return (R)end();
+ }
+ default:
+ {
+ throw newInvalidJSON(BufferUtil.EMPTY_BUFFER, "incomplete JSON");
+ }
+ }
+ }
+ }
+ catch (Throwable x)
+ {
+ reset();
+ throw x;
+ }
+ }
+
+ /**
+ *
When a JSON { is encountered during parsing,
+ * this method is called to create a new {@code Map} instance.
+ *
Subclasses may override to return a custom {@code Map} instance.
When a JSON [ is encountered during parsing,
+ * this method is called to create a new {@code List} instance.
+ *
Subclasses may override to return a custom {@code List} instance.
+ *
+ * @param context the parsing context
+ * @return a {@code List} instance
+ */
+ protected List
*
- *
On the server, the application layer must provide a {@link org.eclipse.jetty.websocket.core.server.WebSocketNegotiator} instance
+ *
On the server, the application layer must provide a {@code org.eclipse.jetty.websocket.core.server.WebSocketNegotiator} instance
* to negotiate and accept websocket connections, which will return the FrameHandler instance to use from
- * {@link org.eclipse.jetty.websocket.core.server.WebSocketNegotiator#negotiate(Negotiation)}.
- *
On the client, the application returns the FrameHandler instance to user from the {@link ClientUpgradeRequest}
- * instance that it passes to the {@link org.eclipse.jetty.websocket.core.client.WebSocketCoreClient#connect(ClientUpgradeRequest)} method/
On the client, the application returns the FrameHandler instance to user from the {@code ClientUpgradeRequest}
+ * instance that it passes to the {@code org.eclipse.jetty.websocket.core.client.WebSocketCoreClient#connect(ClientUpgradeRequest)} method/
*
*
* Once instantiated the FrameHandler follows is used as follows:
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/IncomingFrames.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/IncomingFrames.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/IncomingFrames.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/IncomingFrames.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/OpCode.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/OpCode.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/OpCode.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/OpCode.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/OutgoingFrames.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/OutgoingFrames.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/OutgoingFrames.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/OutgoingFrames.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java
similarity index 71%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java
index 1f5d593f7fd..325132b097b 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java
@@ -19,7 +19,6 @@
package org.eclipse.jetty.websocket.core;
import java.util.zip.Deflater;
-import javax.servlet.ServletContext;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.MappedByteBufferPool;
@@ -31,26 +30,14 @@ import org.eclipse.jetty.util.compression.InflaterPool;
/**
* A collection of components which are the resources needed for websockets such as
* {@link ByteBufferPool}, {@link WebSocketExtensionRegistry}, and {@link DecoratedObjectFactory}.
- *
- * These components should be accessed through {@link WebSocketComponents#ensureWebSocketComponents} so that
- * the instance can be shared by being stored as a bean on the ContextHandler.
*/
public class WebSocketComponents
{
- public static final String WEBSOCKET_COMPONENTS_ATTRIBUTE = WebSocketComponents.class.getName();
-
- public static WebSocketComponents ensureWebSocketComponents(ServletContext servletContext)
- {
- // Ensure a mapping exists
- WebSocketComponents components = (WebSocketComponents)servletContext.getAttribute(WEBSOCKET_COMPONENTS_ATTRIBUTE);
- if (components == null)
- {
- components = new WebSocketComponents();
- servletContext.setAttribute(WEBSOCKET_COMPONENTS_ATTRIBUTE, components);
- }
-
- return components;
- }
+ private final DecoratedObjectFactory objectFactory;
+ private final WebSocketExtensionRegistry extensionRegistry;
+ private final ByteBufferPool bufferPool;
+ private final InflaterPool inflaterPool;
+ private final DeflaterPool deflaterPool;
public WebSocketComponents()
{
@@ -69,12 +56,6 @@ public class WebSocketComponents
this.inflaterPool = inflaterPool;
}
- private DecoratedObjectFactory objectFactory;
- private WebSocketExtensionRegistry extensionRegistry;
- private ByteBufferPool bufferPool;
- private InflaterPool inflaterPool;
- private DeflaterPool deflaterPool;
-
public ByteBufferPool getBufferPool()
{
return bufferPool;
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketConstants.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketConstants.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketConstants.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketConstants.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketExtensionRegistry.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketExtensionRegistry.java
similarity index 96%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketExtensionRegistry.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketExtensionRegistry.java
index a6b55884f68..09b6d51754a 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketExtensionRegistry.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketExtensionRegistry.java
@@ -30,7 +30,7 @@ import org.eclipse.jetty.util.TypeUtil;
public class WebSocketExtensionRegistry implements Iterable>
{
- private Map> availableExtensions = new HashMap<>();
+ private final Map> availableExtensions = new HashMap<>();
public WebSocketExtensionRegistry()
{
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/BadPayloadException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/BadPayloadException.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/BadPayloadException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/BadPayloadException.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java
similarity index 97%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java
index 6243d216de8..150700ec616 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java
@@ -21,7 +21,7 @@ package org.eclipse.jetty.websocket.core.exception;
@SuppressWarnings("serial")
public class CloseException extends WebSocketException
{
- private int statusCode;
+ private final int statusCode;
public CloseException(int closeCode, String message)
{
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/MessageTooLargeException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/MessageTooLargeException.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/MessageTooLargeException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/MessageTooLargeException.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/ProtocolException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/ProtocolException.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/ProtocolException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/ProtocolException.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/UpgradeException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/UpgradeException.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/UpgradeException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/UpgradeException.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketException.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketException.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketTimeoutException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketTimeoutException.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketTimeoutException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketTimeoutException.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketWriteTimeoutException.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketWriteTimeoutException.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketWriteTimeoutException.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketWriteTimeoutException.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java
index 28f3232c816..ccde09f3361 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java
@@ -54,7 +54,7 @@ public class ExtensionStack implements IncomingFrames, OutgoingFrames, Dumpable
private List extensions;
private IncomingFrames incoming;
private OutgoingFrames outgoing;
- private Extension[] rsvClaims = new Extension[3];
+ private final Extension[] rsvClaims = new Extension[3];
public ExtensionStack(WebSocketComponents components, Behavior behavior)
{
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java
similarity index 97%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java
index a4b7ccb73f4..9612f744651 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java
@@ -51,8 +51,8 @@ public class FrameCaptureExtension extends AbstractExtension
private Path incomingFramesPath;
private Path outgoingFramesPath;
- private AtomicInteger incomingCount = new AtomicInteger(0);
- private AtomicInteger outgoingCount = new AtomicInteger(0);
+ private final AtomicInteger incomingCount = new AtomicInteger(0);
+ private final AtomicInteger outgoingCount = new AtomicInteger(0);
private SeekableByteChannel incomingChannel;
private SeekableByteChannel outgoingChannel;
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameEntry.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameEntry.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameEntry.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameEntry.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java
index c7633d291e5..e4483f6e719 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java
@@ -511,7 +511,7 @@ public class FrameFlusher extends IteratingCallback
private class Entry extends FrameEntry
{
private ByteBuffer headerBuffer;
- private long timeOfCreation = System.currentTimeMillis();
+ private final long timeOfCreation = System.currentTimeMillis();
private Entry(Frame frame, Callback callback, boolean batch)
{
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Generator.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Generator.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Generator.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Generator.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/IdentityExtension.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/IdentityExtension.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/IdentityExtension.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/IdentityExtension.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Negotiated.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Negotiated.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Negotiated.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Negotiated.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/NullAppendable.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/NullAppendable.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/NullAppendable.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/NullAppendable.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/TransformingFlusher.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/TransformingFlusher.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/TransformingFlusher.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/TransformingFlusher.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java
index e83759e7285..0d61d603659 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java
@@ -63,8 +63,8 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
private long demand;
private boolean fillingAndParsing;
- private LongAdder messagesIn = new LongAdder();
- private LongAdder bytesIn = new LongAdder();
+ private final LongAdder messagesIn = new LongAdder();
+ private final LongAdder bytesIn = new LongAdder();
// Read / Parse variables
private RetainableByteBuffer networkBuffer;
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCore.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCore.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCore.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCore.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java
similarity index 97%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java
index 53de09e2191..148d2fcf0ed 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java
+++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java
@@ -29,7 +29,6 @@ import java.util.concurrent.Executor;
import java.util.concurrent.TimeoutException;
import org.eclipse.jetty.io.ByteBufferPool;
-import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Utf8Appendable;
import org.eclipse.jetty.util.component.Dumpable;
@@ -81,7 +80,6 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
private long maxTextMessageSize = WebSocketConstants.DEFAULT_MAX_TEXT_MESSAGE_SIZE;
private Duration idleTimeout = WebSocketConstants.DEFAULT_IDLE_TIMEOUT;
private Duration writeTimeout = WebSocketConstants.DEFAULT_WRITE_TIMEOUT;
- private final ContextHandler contextHandler;
public WebSocketCoreSession(FrameHandler handler, Behavior behavior, Negotiated negotiated, WebSocketComponents components)
{
@@ -90,26 +88,16 @@ public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpab
this.behavior = behavior;
this.negotiated = negotiated;
this.demanding = handler.isDemanding();
-
- if (behavior == Behavior.SERVER)
- {
- ContextHandler.Context context = ContextHandler.getCurrentContext();
- this.contextHandler = (context != null) ? context.getContextHandler() : null;
- }
- else
- {
- this.contextHandler = null;
- }
-
negotiated.getExtensions().initialize(new IncomingAdaptor(), new OutgoingAdaptor(), this);
}
- private void handle(Runnable runnable)
+ /**
+ * Can be overridden to scope into the correct classloader before calling application code.
+ * @param runnable the runnable to execute.
+ */
+ protected void handle(Runnable runnable)
{
- if (contextHandler != null)
- contextHandler.handle(runnable);
- else
- runnable.run();
+ runnable.run();
}
/**
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java
rename to jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java
diff --git a/jetty-websocket/websocket-core/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.core.Extension b/jetty-websocket/websocket-core-common/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.core.Extension
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.core.Extension
rename to jetty-websocket/websocket-core-common/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.core.Extension
diff --git a/jetty-websocket/websocket-core-server/pom.xml b/jetty-websocket/websocket-core-server/pom.xml
new file mode 100644
index 00000000000..ab55a54ecb0
--- /dev/null
+++ b/jetty-websocket/websocket-core-server/pom.xml
@@ -0,0 +1,76 @@
+
+
+
+ org.eclipse.jetty.websocket
+ websocket-parent
+ 10.0.0-SNAPSHOT
+
+
+ 4.0.0
+ websocket-core-server
+ Jetty :: Websocket :: Core :: Server
+
+
+ ${project.groupId}.core.server
+
+
+
+
+ org.eclipse.jetty.websocket
+ websocket-core-common
+ ${project.version}
+
+
+ org.eclipse.jetty
+ jetty-server
+ ${project.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+
+
+ ban-ws-apis
+
+ enforce
+
+
+
+
+
+ org.eclipse.jetty.websocket:websocket-jetty-api
+ javax.websocket
+
+
+
+
+
+
+ ban-java-servlet-api
+
+ enforce
+
+
+
+
+
+ javax.servlet
+ servletapi
+ org.eclipse.jetty.orbit:javax.servlet
+ org.mortbay.jetty:servlet-api
+ jetty:servlet-api
+ jetty-servlet-api
+
+
+
+
+
+
+
+
+
+
diff --git a/jetty-websocket/websocket-core-server/src/main/config/modules/websocket.mod b/jetty-websocket/websocket-core-server/src/main/config/modules/websocket.mod
new file mode 100644
index 00000000000..da53af6d2e2
--- /dev/null
+++ b/jetty-websocket/websocket-core-server/src/main/config/modules/websocket.mod
@@ -0,0 +1,11 @@
+DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
+
+[description]
+Enable both jetty and javax websocket modules for deployed web applications.
+
+[tags]
+websocket
+
+[depend]
+websocket-jetty
+websocket-javax
diff --git a/jetty-websocket/websocket-core-server/src/main/java/module-info.java b/jetty-websocket/websocket-core-server/src/main/java/module-info.java
new file mode 100644
index 00000000000..fa7c47d2610
--- /dev/null
+++ b/jetty-websocket/websocket-core-server/src/main/java/module-info.java
@@ -0,0 +1,26 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
+//
+// This program and the accompanying materials are made available under
+// the terms of the Eclipse Public License 2.0 which is available at
+// https://www.eclipse.org/legal/epl-2.0
+//
+// This Source Code may also be made available under the following
+// Secondary Licenses when the conditions for such availability set
+// forth in the Eclipse Public License, v. 2.0 are satisfied:
+// the Apache License v2.0 which is available at
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+// ========================================================================
+//
+
+module org.eclipse.jetty.websocket.core.server
+{
+ exports org.eclipse.jetty.websocket.core.server;
+
+ requires org.slf4j;
+ requires transitive org.eclipse.jetty.server;
+ requires transitive org.eclipse.jetty.websocket.core.common;
+}
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Negotiation.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/Negotiation.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Negotiation.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/Negotiation.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java
diff --git a/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java
new file mode 100644
index 00000000000..2fefc439d09
--- /dev/null
+++ b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java
@@ -0,0 +1,51 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
+//
+// This program and the accompanying materials are made available under
+// the terms of the Eclipse Public License 2.0 which is available at
+// https://www.eclipse.org/legal/epl-2.0
+//
+// This Source Code may also be made available under the following
+// Secondary Licenses when the conditions for such availability set
+// forth in the Eclipse Public License, v. 2.0 are satisfied:
+// the Apache License v2.0 which is available at
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.core.server;
+
+import javax.servlet.ServletContext;
+
+import org.eclipse.jetty.io.ByteBufferPool;
+import org.eclipse.jetty.util.DecoratedObjectFactory;
+import org.eclipse.jetty.websocket.core.WebSocketComponents;
+import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry;
+
+/**
+ * A collection of components which are the resources needed for websockets such as
+ * {@link ByteBufferPool}, {@link WebSocketExtensionRegistry}, and {@link DecoratedObjectFactory}.
+ *
+ * These components should be accessed through {@link WebSocketServerComponents#ensureWebSocketComponents} so that
+ * the instance can be shared by being stored as a bean on the ContextHandler.
+ */
+public class WebSocketServerComponents extends WebSocketComponents
+{
+ public static final String WEBSOCKET_COMPONENTS_ATTRIBUTE = WebSocketComponents.class.getName();
+
+ public static WebSocketComponents ensureWebSocketComponents(ServletContext servletContext)
+ {
+ // Ensure a mapping exists
+ WebSocketComponents components = (WebSocketComponents)servletContext.getAttribute(WEBSOCKET_COMPONENTS_ATTRIBUTE);
+ if (components == null)
+ {
+ components = new WebSocketServerComponents();
+ servletContext.setAttribute(WEBSOCKET_COMPONENTS_ATTRIBUTE, components);
+ }
+
+ return components;
+ }
+}
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketUpgradeHandler.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketUpgradeHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketUpgradeHandler.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketUpgradeHandler.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java
similarity index 93%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java
index 1a0d84c1c5b..77259143103 100644
--- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java
+++ b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java
@@ -34,6 +34,7 @@ import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpTransport;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
+import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.websocket.core.Behavior;
import org.eclipse.jetty.websocket.core.Configuration;
@@ -132,7 +133,7 @@ public abstract class AbstractHandshaker implements Handshaker
Negotiated negotiated = new Negotiated(baseRequest.getHttpURI().toURI(), protocol, baseRequest.isSecure(), extensionStack, WebSocketConstants.SPEC_VERSION_STRING);
// Create the Session
- WebSocketCoreSession coreSession = newWebSocketCoreSession(handler, negotiated, components);
+ WebSocketCoreSession coreSession = newWebSocketCoreSession(request, handler, negotiated, components);
if (defaultCustomizer != null)
defaultCustomizer.customize(coreSession);
negotiator.customize(coreSession);
@@ -195,9 +196,20 @@ public abstract class AbstractHandshaker implements Handshaker
return true;
}
- protected WebSocketCoreSession newWebSocketCoreSession(FrameHandler handler, Negotiated negotiated, WebSocketComponents components)
+ protected WebSocketCoreSession newWebSocketCoreSession(HttpServletRequest request, FrameHandler handler, Negotiated negotiated, WebSocketComponents components)
{
- return new WebSocketCoreSession(handler, Behavior.SERVER, negotiated, components);
+ final ContextHandler contextHandler = ContextHandler.getContextHandler(request.getServletContext());
+ return new WebSocketCoreSession(handler, Behavior.SERVER, negotiated, components)
+ {
+ @Override
+ protected void handle(Runnable runnable)
+ {
+ if (contextHandler != null)
+ contextHandler.handle(runnable);
+ else
+ runnable.run();
+ }
+ };
}
protected abstract WebSocketConnection createWebSocketConnection(Request baseRequest, WebSocketCoreSession coreSession);
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Negotiation.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Negotiation.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Negotiation.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Negotiation.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java
diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Negotiation.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Negotiation.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Negotiation.java
rename to jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Negotiation.java
diff --git a/jetty-websocket/websocket-core/fuzzingclient.json b/jetty-websocket/websocket-core-tests/fuzzingclient.json
similarity index 100%
rename from jetty-websocket/websocket-core/fuzzingclient.json
rename to jetty-websocket/websocket-core-tests/fuzzingclient.json
diff --git a/jetty-websocket/websocket-core/fuzzingserver.json b/jetty-websocket/websocket-core-tests/fuzzingserver.json
similarity index 100%
rename from jetty-websocket/websocket-core/fuzzingserver.json
rename to jetty-websocket/websocket-core-tests/fuzzingserver.json
diff --git a/jetty-websocket/websocket-core/pom.xml b/jetty-websocket/websocket-core-tests/pom.xml
similarity index 51%
rename from jetty-websocket/websocket-core/pom.xml
rename to jetty-websocket/websocket-core-tests/pom.xml
index 2e976948002..f24b3607818 100644
--- a/jetty-websocket/websocket-core/pom.xml
+++ b/jetty-websocket/websocket-core-tests/pom.xml
@@ -7,105 +7,53 @@
4.0.0
- websocket-core
- Jetty :: Websocket :: Core
+ websocket-core-tests
+ Jetty :: Websocket :: Core :: Tests
- ${project.groupId}.core
+ ${project.groupId}.core.tests
- org.eclipse.jetty
- jetty-util
+ org.eclipse.jetty.websocket
+ websocket-core-client${project.version}
- org.eclipse.jetty
- jetty-io
+ org.eclipse.jetty.websocket
+ websocket-core-server${project.version}
- org.eclipse.jetty
- jetty-http
+ org.eclipse.jetty.websocket
+ websocket-core-common${project.version}
-
- org.slf4j
- slf4j-api
-
-
- org.eclipse.jetty
- jetty-xml
- ${project.version}
- true
-
-
- org.eclipse.jetty
- jetty-client
- ${project.version}
-
-
- org.eclipse.jetty
- jetty-server
- ${project.version}
-
-
org.eclipse.jettyjetty-slf4j-impltest
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
- org.apache.maven.plugins
- maven-enforcer-plugin
-
-
- ban-ws-apis
-
- enforce
-
-
-
-
-
- org.eclipse.jetty.websocket:websocket-jetty-api
- javax.websocket
-
-
-
-
-
-
- ban-java-servlet-api
-
- enforce
-
-
-
-
-
- javax.servlet
- servletapi
- org.eclipse.jetty.orbit:javax.servlet
- org.mortbay.jetty:servlet-api
- jetty:servlet-api
- jetty-servlet-api
-
-
-
-
-
-
+ maven-deploy-plugin
+
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ true
+
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AcceptHashTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/AcceptHashTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AcceptHashTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/AcceptHashTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/CapturedHexPayloads.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/CapturedHexPayloads.java
similarity index 95%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/CapturedHexPayloads.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/CapturedHexPayloads.java
index 14a641f1cd7..da005f5ad69 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/CapturedHexPayloads.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/CapturedHexPayloads.java
@@ -26,7 +26,7 @@ import org.eclipse.jetty.util.Callback;
public class CapturedHexPayloads implements OutgoingFrames
{
- private List captured = new ArrayList<>();
+ private final List captured = new ArrayList<>();
@Override
public void sendFrame(Frame frame, Callback callback, boolean batch)
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/CloseStatusTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/CloseStatusTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/CloseStatusTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/CloseStatusTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/EchoFrameHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/EchoFrameHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/EchoFrameHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/EchoFrameHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FlushTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/FlushTest.java
similarity index 97%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FlushTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/FlushTest.java
index f787ae8fd89..e17524caaf9 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FlushTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/FlushTest.java
@@ -41,9 +41,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class FlushTest
{
private WebSocketServer server;
- private TestFrameHandler serverHandler = new TestFrameHandler();
+ private final TestFrameHandler serverHandler = new TestFrameHandler();
private WebSocketCoreClient client;
- private WebSocketComponents components = new WebSocketComponents();
+ private final WebSocketComponents components = new WebSocketComponents();
@BeforeEach
public void startup() throws Exception
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java
similarity index 96%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java
index a891d6d932f..9acce6884bd 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java
@@ -40,9 +40,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class FrameBufferTest extends WebSocketTester
{
private WebSocketServer server;
- private TestFrameHandler serverHandler = new TestFrameHandler();
+ private final TestFrameHandler serverHandler = new TestFrameHandler();
private WebSocketCoreClient client;
- private WebSocketComponents components = new WebSocketComponents();
+ private final WebSocketComponents components = new WebSocketComponents();
@BeforeEach
public void startup() throws Exception
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java
similarity index 97%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java
index af413ce7ea7..5d18c8027c9 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java
@@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
*/
public class GeneratorFrameFlagsTest
{
- private static WebSocketComponents components = new WebSocketComponents();
+ private static final WebSocketComponents components = new WebSocketComponents();
private WebSocketCoreSession coreSession;
public static Stream data()
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java
similarity index 97%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java
index 449afdd7fd6..3e8b523c881 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java
@@ -33,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class GeneratorParserRoundTripTest
{
- private ByteBufferPool bufferPool = new MappedByteBufferPool();
+ private final ByteBufferPool bufferPool = new MappedByteBufferPool();
@Test
public void testParserAndGenerator() throws Exception
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java
index 5456640b22e..d03da52f3e4 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java
@@ -47,9 +47,9 @@ public class GeneratorTest
{
private static final Logger LOG = LoggerFactory.getLogger(Helper.class);
- private static Generator generator = new Generator();
- private static WebSocketCoreSession coreSession = newWebSocketCoreSession(Behavior.SERVER);
- private static WebSocketComponents components = new WebSocketComponents();
+ private static final Generator generator = new Generator();
+ private static final WebSocketCoreSession coreSession = newWebSocketCoreSession(Behavior.SERVER);
+ private static final WebSocketComponents components = new WebSocketComponents();
private static WebSocketCoreSession newWebSocketCoreSession(Behavior behavior)
{
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/IncomingFramesCapture.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/IncomingFramesCapture.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/IncomingFramesCapture.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/IncomingFramesCapture.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java
index e48d38d58a7..fc14e360b83 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java
@@ -65,7 +65,7 @@ public class MessageHandlerTest
coreSession = new CoreSession.Empty()
{
- private ByteBufferPool byteBufferPool = new MappedByteBufferPool();
+ private final ByteBufferPool byteBufferPool = new MappedByteBufferPool();
@Override
public void sendFrame(Frame frame, Callback callback, boolean batch)
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OutgoingFramesCapture.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/OutgoingFramesCapture.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OutgoingFramesCapture.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/OutgoingFramesCapture.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OutgoingNetworkBytesCapture.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/OutgoingNetworkBytesCapture.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OutgoingNetworkBytesCapture.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/OutgoingNetworkBytesCapture.java
index 1c067d2a157..33561dda1f1 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OutgoingNetworkBytesCapture.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/OutgoingNetworkBytesCapture.java
@@ -38,7 +38,7 @@ import static org.hamcrest.Matchers.lessThan;
public class OutgoingNetworkBytesCapture implements OutgoingFrames
{
private final Generator generator;
- private List captured;
+ private final List captured;
public OutgoingNetworkBytesCapture(Generator generator)
{
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParsePayloadLengthTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParsePayloadLengthTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParsePayloadLengthTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParsePayloadLengthTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java
index 6fe3e60b6c5..4dfc798e772 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java
@@ -65,7 +65,7 @@ public class ParserBadCloseStatusCodesTest
);
}
- private ByteBufferPool bufferPool = new MappedByteBufferPool();
+ private final ByteBufferPool bufferPool = new MappedByteBufferPool();
@ParameterizedTest(name = "closeCode={0} {1}")
@MethodSource("data")
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java
index a0dfcd2167a..f06c8960e24 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java
@@ -57,7 +57,7 @@ public class ParserBadOpCodesTest
);
}
- private ByteBufferPool bufferPool = new MappedByteBufferPool();
+ private final ByteBufferPool bufferPool = new MappedByteBufferPool();
@ParameterizedTest(name = "opcode={0} {1}")
@MethodSource("data")
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserGoodCloseStatusCodesTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserGoodCloseStatusCodesTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserGoodCloseStatusCodesTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserGoodCloseStatusCodesTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/SynchronousFrameHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/SynchronousFrameHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/SynchronousFrameHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/SynchronousFrameHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestUpgradeHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestUpgradeHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestUpgradeHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestUpgradeHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketUpgradeHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketUpgradeHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketUpgradeHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketUpgradeHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/Timeouts.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/Timeouts.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/Timeouts.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/Timeouts.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java
index bac1e2451d6..eeef7f56d4f 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java
@@ -58,7 +58,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class WebSocketCloseTest extends WebSocketTester
{
- private static Logger LOG = LoggerFactory.getLogger(WebSocketCloseTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(WebSocketCloseTest.class);
private static final String WS_SCHEME = "ws";
private static final String WSS_SCHEME = "wss";
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketFrameTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketFrameTest.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketFrameTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketFrameTest.java
index 3ef42883dce..6c75606b6ad 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketFrameTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketFrameTest.java
@@ -32,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class WebSocketFrameTest
{
- private Generator generator = new Generator();
+ private final Generator generator = new Generator();
private ByteBuffer generateWholeFrame(Generator generator, Frame frame)
{
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java
index ae25d7bbe94..e55ec678902 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java
@@ -76,7 +76,7 @@ public class WebSocketNegotiationTest extends WebSocketTester
private WebSocketServer server;
private WebSocketCoreClient client;
- private WebSocketComponents components = new WebSocketComponents();
+ private final WebSocketComponents components = new WebSocketComponents();
@BeforeEach
public void startup() throws Exception
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java
index a96241d613d..1b564a76448 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java
@@ -46,7 +46,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class WebSocketOpenTest extends WebSocketTester
{
- private static Logger LOG = LoggerFactory.getLogger(WebSocketOpenTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(WebSocketOpenTest.class);
private WebSocketServer server;
private DemandingAsyncFrameHandler serverHandler;
@@ -190,7 +190,7 @@ public class WebSocketOpenTest extends WebSocketTester
static class DemandingAsyncFrameHandler extends TestAsyncFrameHandler
{
- private BiFunction onOpen;
+ private final BiFunction onOpen;
DemandingAsyncFrameHandler(BiFunction onOpen)
{
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketServer.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketServer.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketServer.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketServer.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java
index 8ea7da37f89..4eb84f8cc0a 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java
@@ -44,7 +44,7 @@ import static org.hamcrest.Matchers.startsWith;
public class WebSocketTester
{
- private static String NON_RANDOM_KEY = Base64.getEncoder().encodeToString("0123456701234567".getBytes());
+ private static final String NON_RANDOM_KEY = Base64.getEncoder().encodeToString("0123456701234567".getBytes());
private static SslContextFactory.Client sslContextFactory;
protected ByteBufferPool bufferPool;
protected ByteBuffer buffer;
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java
index 79252a0c1a3..3e297e52127 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java
@@ -138,9 +138,9 @@ public class CoreAutobahnClient
}
private static final Logger LOG = LoggerFactory.getLogger(CoreAutobahnClient.class);
- private URI baseWebsocketUri;
- private WebSocketCoreClient client;
- private String userAgent;
+ private final URI baseWebsocketUri;
+ private final WebSocketCoreClient client;
+ private final String userAgent;
public CoreAutobahnClient(String hostname, int port, String userAgent) throws Exception
{
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnServer.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnServer.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnServer.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnServer.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketClient.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketClient.java
similarity index 95%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketClient.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketClient.java
index e5192c37dc3..3734c499324 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketClient.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketClient.java
@@ -36,11 +36,11 @@ import org.slf4j.LoggerFactory;
public class ChatWebSocketClient
{
- private static Logger LOG = LoggerFactory.getLogger(ChatWebSocketClient.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ChatWebSocketClient.class);
- private URI baseWebsocketUri;
- private WebSocketCoreClient client;
- private MessageHandler handler;
+ private final URI baseWebsocketUri;
+ private final WebSocketCoreClient client;
+ private final MessageHandler handler;
private String name = String.format("unknown@%x", ThreadLocalRandom.current().nextInt());
public ChatWebSocketClient(String hostname, int port) throws Exception
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java
index 493946f2183..fee18160955 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java
@@ -45,7 +45,7 @@ import static org.eclipse.jetty.util.Callback.NOOP;
public class ChatWebSocketServer
{
- private Set members = new HashSet<>();
+ private final Set members = new HashSet<>();
private FrameHandler negotiate(Negotiation negotiation)
{
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java
index 8a4260cad67..3a4dc6741a4 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java
@@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class WebSocketClientServerTest
{
- private static Logger LOG = LoggerFactory.getLogger(WebSocketClientServerTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(WebSocketClientServerTest.class);
private WebSocketServer server;
private TestFrameHandler serverHandler;
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/AbstractExtensionTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/AbstractExtensionTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/AbstractExtensionTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/AbstractExtensionTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionConfigTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionConfigTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionConfigTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionConfigTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionStackTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionStackTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionStackTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionStackTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java
similarity index 97%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java
index c8d080b0a13..1f5d2826da4 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java
@@ -51,11 +51,11 @@ public class ExtensionTool
{
public class Tester
{
- private String requestedExtParams;
- private ExtensionConfig extConfig;
+ private final String requestedExtParams;
+ private final ExtensionConfig extConfig;
private Extension ext;
- private Parser parser;
- private IncomingFramesCapture capture;
+ private final Parser parser;
+ private final IncomingFramesCapture capture;
private Tester(String parameterizedExtension)
{
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java
similarity index 98%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java
index 8d3a40bae68..5f28a82b544 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java
@@ -53,8 +53,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class PerMessageDeflaterBufferSizeTest
{
private WebSocketServer server;
- private TestFrameHandler serverHandler = new TestFrameHandler();
- private TestNegotiator testNegotiator = new TestNegotiator();
+ private final TestFrameHandler serverHandler = new TestFrameHandler();
+ private final TestNegotiator testNegotiator = new TestNegotiator();
private URI serverUri;
private WebSocketCoreClient client;
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ValidationExtensionTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ValidationExtensionTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ValidationExtensionTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/extensions/ValidationExtensionTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java
index 2e376571e18..35f034d244c 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java
@@ -57,7 +57,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class FrameFlusherTest
{
- private ByteBufferPool bufferPool = new MappedByteBufferPool();
+ private final ByteBufferPool bufferPool = new MappedByteBufferPool();
private Scheduler scheduler;
@BeforeEach
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/MockEndpoint.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/MockEndpoint.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/MockEndpoint.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/MockEndpoint.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java
index 5d6944e0bdc..6af276077e1 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java
@@ -51,8 +51,8 @@ class WebSocketProxy
}
private final Object lock = new Object();
- private WebSocketCoreClient client;
- private URI serverUri;
+ private final WebSocketCoreClient client;
+ private final URI serverUri;
public Client2Proxy client2Proxy = new Client2Proxy();
public Server2Proxy server2Proxy = new Server2Proxy();
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java
diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java
similarity index 99%
rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java
rename to jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java
index 66f235de234..d46db6e37f0 100644
--- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java
+++ b/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java
@@ -53,7 +53,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class WebSocketServerTest extends WebSocketTester
{
- private static Logger LOG = LoggerFactory.getLogger(WebSocketServerTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(WebSocketServerTest.class);
private WebSocketServer server;
diff --git a/jetty-websocket/websocket-core/src/test/resources/jetty-logging.properties b/jetty-websocket/websocket-core-tests/src/test/resources/jetty-logging.properties
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/resources/jetty-logging.properties
rename to jetty-websocket/websocket-core-tests/src/test/resources/jetty-logging.properties
diff --git a/jetty-websocket/websocket-core/src/test/resources/keystore.p12 b/jetty-websocket/websocket-core-tests/src/test/resources/keystore.p12
similarity index 100%
rename from jetty-websocket/websocket-core/src/test/resources/keystore.p12
rename to jetty-websocket/websocket-core-tests/src/test/resources/keystore.p12
diff --git a/jetty-websocket/websocket-javax-client/pom.xml b/jetty-websocket/websocket-javax-client/pom.xml
index b2fa1cd48aa..3d3f594e723 100644
--- a/jetty-websocket/websocket-javax-client/pom.xml
+++ b/jetty-websocket/websocket-javax-client/pom.xml
@@ -15,6 +15,15 @@
+
+ org.eclipse.jetty.toolchain
+ jetty-javax-websocket-api
+
+
+ org.eclipse.jetty.websocket
+ websocket-javax-common
+ ${project.version}
+ org.eclipse.jetty.websocketwebsocket-util
@@ -22,7 +31,7 @@
org.eclipse.jetty.websocket
- websocket-javax-common
+ websocket-core-client${project.version}
@@ -30,21 +39,12 @@
jetty-client${project.version}
-
- org.eclipse.jetty.toolchain
- jetty-javax-websocket-api
- org.eclipse.jettyjetty-xml${project.version}test
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
diff --git a/jetty-websocket/websocket-javax-client/src/main/java/module-info.java b/jetty-websocket/websocket-javax-client/src/main/java/module-info.java
index eb58cdef38e..362a4a64ac5 100644
--- a/jetty-websocket/websocket-javax-client/src/main/java/module-info.java
+++ b/jetty-websocket/websocket-javax-client/src/main/java/module-info.java
@@ -25,9 +25,10 @@ module org.eclipse.jetty.websocket.javax.client
exports org.eclipse.jetty.websocket.javax.client;
exports org.eclipse.jetty.websocket.javax.client.internal to org.eclipse.jetty.websocket.javax.server;
- requires transitive jetty.websocket.api;
- requires transitive org.eclipse.jetty.client;
+ requires org.eclipse.jetty.client;
+ requires org.eclipse.jetty.websocket.core.client;
requires org.eclipse.jetty.websocket.javax.common;
+ requires transitive jetty.websocket.api;
provides ContainerProvider with JavaxWebSocketClientContainerProvider;
}
diff --git a/jetty-websocket/websocket-javax-common/pom.xml b/jetty-websocket/websocket-javax-common/pom.xml
index d606965d46c..5788cfeb68a 100644
--- a/jetty-websocket/websocket-javax-common/pom.xml
+++ b/jetty-websocket/websocket-javax-common/pom.xml
@@ -67,9 +67,8 @@
- org.eclipse.jetty.websocket
- websocket-core
- ${project.version}
+ org.eclipse.jetty.toolchain
+ jetty-javax-websocket-apiorg.eclipse.jetty.websocket
@@ -77,8 +76,9 @@
${project.version}
- org.eclipse.jetty.toolchain
- jetty-javax-websocket-api
+ org.eclipse.jetty.websocket
+ websocket-core-client
+ ${project.version}org.slf4j
@@ -89,10 +89,5 @@
jetty-slf4j-impltest
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
diff --git a/jetty-websocket/websocket-javax-common/src/main/java/module-info.java b/jetty-websocket/websocket-javax-common/src/main/java/module-info.java
index 08b85dda862..97397c3d70e 100644
--- a/jetty-websocket/websocket-javax-common/src/main/java/module-info.java
+++ b/jetty-websocket/websocket-javax-common/src/main/java/module-info.java
@@ -23,10 +23,8 @@ module org.eclipse.jetty.websocket.javax.common
exports org.eclipse.jetty.websocket.javax.common.encoders;
exports org.eclipse.jetty.websocket.javax.common.messages;
- requires transitive jetty.websocket.api;
- requires transitive org.eclipse.jetty.http;
- requires transitive org.eclipse.jetty.io;
- requires transitive org.eclipse.jetty.websocket.core;
- requires transitive org.eclipse.jetty.websocket.util;
requires org.slf4j;
+ requires transitive jetty.websocket.api;
+ requires transitive org.eclipse.jetty.websocket.core.client;
+ requires transitive org.eclipse.jetty.websocket.util;
}
diff --git a/jetty-websocket/websocket-javax-server/pom.xml b/jetty-websocket/websocket-javax-server/pom.xml
index d629de14878..e543c2dc12c 100644
--- a/jetty-websocket/websocket-javax-server/pom.xml
+++ b/jetty-websocket/websocket-javax-server/pom.xml
@@ -43,11 +43,6 @@
jetty-slf4j-impltest
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
diff --git a/jetty-websocket/websocket-javax-server/src/main/config/modules/websocket-javax.mod b/jetty-websocket/websocket-javax-server/src/main/config/modules/websocket-javax.mod
index d46554bdfaf..bb9bd0b26c5 100644
--- a/jetty-websocket/websocket-javax-server/src/main/config/modules/websocket-javax.mod
+++ b/jetty-websocket/websocket-javax-server/src/main/config/modules/websocket-javax.mod
@@ -11,7 +11,9 @@ client
annotations
[lib]
-lib/websocket/websocket-core-${jetty.version}.jar
+lib/websocket/websocket-core-common-${jetty.version}.jar
+lib/websocket/websocket-core-client-${jetty.version}.jar
+lib/websocket/websocket-core-server-${jetty.version}.jar
lib/websocket/websocket-util-${jetty.version}.jar
lib/websocket/websocket-util-server-${jetty.version}.jar
lib/websocket/jetty-javax-websocket-api-1.1.2.jar
diff --git a/jetty-websocket/websocket-javax-server/src/main/java/module-info.java b/jetty-websocket/websocket-javax-server/src/main/java/module-info.java
index af5c88bbdd4..c4ad6598d80 100644
--- a/jetty-websocket/websocket-javax-server/src/main/java/module-info.java
+++ b/jetty-websocket/websocket-javax-server/src/main/java/module-info.java
@@ -28,11 +28,11 @@ module org.eclipse.jetty.websocket.javax.server
{
exports org.eclipse.jetty.websocket.javax.server.config;
- requires transitive org.eclipse.jetty.webapp;
- requires transitive org.eclipse.jetty.websocket.javax.client;
requires org.eclipse.jetty.websocket.javax.common;
requires org.eclipse.jetty.websocket.util.server;
requires org.slf4j;
+ requires transitive org.eclipse.jetty.webapp;
+ requires transitive org.eclipse.jetty.websocket.javax.client;
provides ServletContainerInitializer with JavaxWebSocketServletContainerInitializer;
provides ServerEndpointConfig.Configurator with ContainerDefaultConfigurator;
diff --git a/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/JavaxWebSocketServletContainerInitializer.java b/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/JavaxWebSocketServletContainerInitializer.java
index 87739c6a434..af4cca34fe3 100644
--- a/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/JavaxWebSocketServletContainerInitializer.java
+++ b/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/JavaxWebSocketServletContainerInitializer.java
@@ -37,6 +37,7 @@ import org.eclipse.jetty.servlet.listener.ContainerInitializer;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.thread.ThreadClassLoaderScope;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
import org.eclipse.jetty.websocket.javax.server.internal.JavaxWebSocketServerContainer;
import org.eclipse.jetty.websocket.util.server.WebSocketUpgradeFilter;
import org.eclipse.jetty.websocket.util.server.internal.WebSocketMapping;
@@ -70,20 +71,14 @@ public class JavaxWebSocketServletContainerInitializer implements ServletContain
String cp = context.getInitParameter(keyName);
if (cp != null)
{
- if (TypeUtil.isTrue(cp))
- return true;
- else
- return false;
+ return TypeUtil.isTrue(cp);
}
// Next, try attribute on context
Object enable = context.getAttribute(keyName);
if (enable != null)
{
- if (TypeUtil.isTrue(enable))
- return true;
- else
- return false;
+ return TypeUtil.isTrue(enable);
}
return null;
@@ -153,7 +148,7 @@ public class JavaxWebSocketServletContainerInitializer implements ServletContain
JavaxWebSocketServerContainer serverContainer = JavaxWebSocketServerContainer.getContainer(context.getServletContext());
if (serverContainer == null)
{
- WebSocketComponents components = WebSocketComponents.ensureWebSocketComponents(context.getServletContext());
+ WebSocketComponents components = WebSocketServerComponents.ensureWebSocketComponents(context.getServletContext());
FilterHolder filterHolder = WebSocketUpgradeFilter.ensureFilter(context.getServletContext());
WebSocketMapping mapping = WebSocketMapping.ensureMapping(context.getServletContext(), WebSocketMapping.DEFAULT_KEY);
serverContainer = JavaxWebSocketServerContainer.ensureContainer(context.getServletContext());
diff --git a/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java b/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java
index 35a5ba4a86c..59f211b5f2e 100644
--- a/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java
+++ b/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java
@@ -37,6 +37,7 @@ import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
import org.eclipse.jetty.websocket.javax.client.internal.JavaxWebSocketClientContainer;
import org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.util.server.internal.WebSocketMapping;
@@ -95,7 +96,7 @@ public class JavaxWebSocketServerContainer extends JavaxWebSocketClientContainer
// Create the Jetty ServerContainer implementation
container = new JavaxWebSocketServerContainer(
WebSocketMapping.ensureMapping(servletContext, WebSocketMapping.DEFAULT_KEY),
- WebSocketComponents.ensureWebSocketComponents(servletContext),
+ WebSocketServerComponents.ensureWebSocketComponents(servletContext),
coreClientSupplier);
contextHandler.addManaged(container);
contextHandler.addEventListener(container);
diff --git a/jetty-websocket/websocket-jetty-api/pom.xml b/jetty-websocket/websocket-jetty-api/pom.xml
index 5f7a34e1f77..15edf958083 100644
--- a/jetty-websocket/websocket-jetty-api/pom.xml
+++ b/jetty-websocket/websocket-jetty-api/pom.xml
@@ -14,14 +14,6 @@
${project.groupId}.api
-
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
-
-
diff --git a/jetty-websocket/websocket-jetty-client/pom.xml b/jetty-websocket/websocket-jetty-client/pom.xml
index ad9d334d39f..cc3c39db832 100644
--- a/jetty-websocket/websocket-jetty-client/pom.xml
+++ b/jetty-websocket/websocket-jetty-client/pom.xml
@@ -25,6 +25,11 @@
websocket-jetty-common${project.version}
+
+ org.eclipse.jetty.websocket
+ websocket-core-client
+ ${project.version}
+ org.eclipse.jettyjetty-client
@@ -39,11 +44,6 @@
jetty-slf4j-impltest
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
diff --git a/jetty-websocket/websocket-jetty-client/src/main/java/module-info.java b/jetty-websocket/websocket-jetty-client/src/main/java/module-info.java
index aa113d80a62..27c6f8600c3 100644
--- a/jetty-websocket/websocket-jetty-client/src/main/java/module-info.java
+++ b/jetty-websocket/websocket-jetty-client/src/main/java/module-info.java
@@ -20,9 +20,9 @@ module org.eclipse.jetty.websocket.jetty.client
{
exports org.eclipse.jetty.websocket.client;
- requires transitive org.eclipse.jetty.client;
- requires transitive org.eclipse.jetty.websocket.jetty.api;
- requires org.eclipse.jetty.websocket.core;
+ requires org.eclipse.jetty.websocket.core.client;
requires org.eclipse.jetty.websocket.jetty.common;
requires org.slf4j;
+ requires transitive org.eclipse.jetty.client;
+ requires transitive org.eclipse.jetty.websocket.jetty.api;
}
diff --git a/jetty-websocket/websocket-jetty-common/pom.xml b/jetty-websocket/websocket-jetty-common/pom.xml
index 83c726eb91d..b3809d06724 100644
--- a/jetty-websocket/websocket-jetty-common/pom.xml
+++ b/jetty-websocket/websocket-jetty-common/pom.xml
@@ -51,39 +51,10 @@
websocket-jetty-api${project.version}
-
- org.eclipse.jetty.websocket
- websocket-core
- ${project.version}
- org.eclipse.jetty.websocketwebsocket-util${project.version}
-
- org.eclipse.jetty
- jetty-util
- ${project.version}
-
-
- org.eclipse.jetty
- jetty-io
- ${project.version}
-
-
- org.slf4j
- slf4j-api
-
-
- org.eclipse.jetty
- jetty-slf4j-impl
- test
-
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/module-info.java b/jetty-websocket/websocket-jetty-common/src/main/java/module-info.java
index 3b652531aab..4bac66d7684 100644
--- a/jetty-websocket/websocket-jetty-common/src/main/java/module-info.java
+++ b/jetty-websocket/websocket-jetty-common/src/main/java/module-info.java
@@ -23,10 +23,11 @@ module org.eclipse.jetty.websocket.jetty.common
{
exports org.eclipse.jetty.websocket.common;
- requires transitive org.eclipse.jetty.websocket.core;
+ requires org.eclipse.jetty.util;
+ requires org.slf4j;
+ requires transitive org.eclipse.jetty.websocket.core.common;
requires transitive org.eclipse.jetty.websocket.jetty.api;
requires transitive org.eclipse.jetty.websocket.util;
- requires org.slf4j;
provides ExtensionConfig.Parser with ExtensionConfigParser;
}
diff --git a/jetty-websocket/websocket-jetty-server/pom.xml b/jetty-websocket/websocket-jetty-server/pom.xml
index ade9576c6e7..0387a72b773 100644
--- a/jetty-websocket/websocket-jetty-server/pom.xml
+++ b/jetty-websocket/websocket-jetty-server/pom.xml
@@ -15,27 +15,6 @@
-
- org.eclipse.jetty
- jetty-servlet
- ${project.version}
-
-
- org.eclipse.jetty
- jetty-annotations
- ${project.version}
-
-
- org.eclipse.jetty
- jetty-server
- ${project.version}
-
-
- org.eclipse.jetty
- jetty-jmx
- ${project.version}
- true
- org.eclipse.jetty.websocketwebsocket-jetty-api
@@ -55,6 +34,22 @@
org.eclipse.jetty.toolchainjetty-servlet-api
+
+ org.eclipse.jetty
+ jetty-servlet
+ ${project.version}
+
+
+ org.eclipse.jetty
+ jetty-annotations
+ ${project.version}
+
+
+ org.eclipse.jetty
+ jetty-jmx
+ ${project.version}
+ true
+ org.slf4jslf4j-api
@@ -64,11 +59,6 @@
jetty-slf4j-impltest
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
diff --git a/jetty-websocket/websocket-jetty-server/src/main/config/modules/websocket-jetty.mod b/jetty-websocket/websocket-jetty-server/src/main/config/modules/websocket-jetty.mod
index 9a93574f2bf..0dae0b934d1 100644
--- a/jetty-websocket/websocket-jetty-server/src/main/config/modules/websocket-jetty.mod
+++ b/jetty-websocket/websocket-jetty-server/src/main/config/modules/websocket-jetty.mod
@@ -11,7 +11,9 @@ client
annotations
[lib]
-lib/websocket/websocket-core-${jetty.version}.jar
+lib/websocket/websocket-core-common-${jetty.version}.jar
+lib/websocket/websocket-core-client-${jetty.version}.jar
+lib/websocket/websocket-core-server-${jetty.version}.jar
lib/websocket/websocket-util-${jetty.version}.jar
lib/websocket/websocket-util-server-${jetty.version}.jar
lib/websocket/websocket-jetty-api-${jetty.version}.jar
diff --git a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java
index 06a614efec2..bc6c85030e8 100644
--- a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java
+++ b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java
@@ -39,6 +39,7 @@ import org.eclipse.jetty.websocket.common.SessionTracker;
import org.eclipse.jetty.websocket.core.Configuration;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.internal.JettyServerFrameHandlerFactory;
import org.eclipse.jetty.websocket.util.server.internal.FrameHandlerFactory;
@@ -73,7 +74,7 @@ public class JettyWebSocketServerContainer extends ContainerLifeCycle implements
container = new JettyWebSocketServerContainer(
contextHandler,
WebSocketMapping.ensureMapping(servletContext, WebSocketMapping.DEFAULT_KEY),
- WebSocketComponents.ensureWebSocketComponents(servletContext), executor);
+ WebSocketServerComponents.ensureWebSocketComponents(servletContext), executor);
servletContext.setAttribute(JETTY_WEBSOCKET_CONTAINER_ATTRIBUTE, container);
contextHandler.addManaged(container);
contextHandler.addEventListener(container);
diff --git a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServlet.java b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServlet.java
index 448694577c5..be184470323 100644
--- a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServlet.java
+++ b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServlet.java
@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.websocket.core.Configuration;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
import org.eclipse.jetty.websocket.server.internal.JettyServerFrameHandlerFactory;
import org.eclipse.jetty.websocket.util.server.WebSocketUpgradeFilter;
import org.eclipse.jetty.websocket.util.server.internal.FrameHandlerFactory;
@@ -129,7 +130,7 @@ public abstract class JettyWebSocketServlet extends HttpServlet
{
ServletContext servletContext = getServletContext();
- components = WebSocketComponents.ensureWebSocketComponents(servletContext);
+ components = WebSocketServerComponents.ensureWebSocketComponents(servletContext);
mapping = new WebSocketMapping(components);
String max = getInitParameter("idleTimeout");
@@ -262,7 +263,7 @@ public abstract class JettyWebSocketServlet extends HttpServlet
private static class WrappedJettyCreator implements WebSocketCreator
{
- private JettyWebSocketCreator creator;
+ private final JettyWebSocketCreator creator;
private WrappedJettyCreator(JettyWebSocketCreator creator)
{
diff --git a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/config/JettyWebSocketServletContainerInitializer.java b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/config/JettyWebSocketServletContainerInitializer.java
index 43b65eafd16..3b164c017f8 100644
--- a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/config/JettyWebSocketServletContainerInitializer.java
+++ b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/config/JettyWebSocketServletContainerInitializer.java
@@ -26,6 +26,7 @@ import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.listener.ContainerInitializer;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer;
import org.eclipse.jetty.websocket.util.server.WebSocketUpgradeFilter;
import org.eclipse.jetty.websocket.util.server.internal.WebSocketMapping;
@@ -89,7 +90,7 @@ public class JettyWebSocketServletContainerInitializer implements ServletContain
*/
private static JettyWebSocketServerContainer initialize(ServletContextHandler context)
{
- WebSocketComponents components = WebSocketComponents.ensureWebSocketComponents(context.getServletContext());
+ WebSocketComponents components = WebSocketServerComponents.ensureWebSocketComponents(context.getServletContext());
FilterHolder filterHolder = WebSocketUpgradeFilter.ensureFilter(context.getServletContext());
WebSocketMapping mapping = WebSocketMapping.ensureMapping(context.getServletContext(), WebSocketMapping.DEFAULT_KEY);
JettyWebSocketServerContainer container = JettyWebSocketServerContainer.ensureContainer(context.getServletContext());
diff --git a/jetty-websocket/websocket-util-server/pom.xml b/jetty-websocket/websocket-util-server/pom.xml
index c8b50273799..3fd5fc74a48 100644
--- a/jetty-websocket/websocket-util-server/pom.xml
+++ b/jetty-websocket/websocket-util-server/pom.xml
@@ -66,7 +66,7 @@
org.eclipse.jetty.websocket
- websocket-core
+ websocket-core-server${project.version}
diff --git a/jetty-websocket/websocket-util-server/src/main/java/module-info.java b/jetty-websocket/websocket-util-server/src/main/java/module-info.java
index ae57cc58894..c067bea8bf3 100644
--- a/jetty-websocket/websocket-util-server/src/main/java/module-info.java
+++ b/jetty-websocket/websocket-util-server/src/main/java/module-info.java
@@ -23,5 +23,5 @@ module org.eclipse.jetty.websocket.util.server
requires org.slf4j;
requires transitive org.eclipse.jetty.servlet;
- requires transitive org.eclipse.jetty.websocket.core;
+ requires transitive org.eclipse.jetty.websocket.core.server;
}
diff --git a/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/WebSocketUpgradeFilter.java b/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/WebSocketUpgradeFilter.java
index b0a9c030e90..5a64fc85ef0 100644
--- a/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/WebSocketUpgradeFilter.java
+++ b/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/WebSocketUpgradeFilter.java
@@ -38,7 +38,7 @@ import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.websocket.core.Configuration;
-import org.eclipse.jetty.websocket.core.WebSocketComponents;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
import org.eclipse.jetty.websocket.util.server.internal.WebSocketMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -168,7 +168,7 @@ public class WebSocketUpgradeFilter implements Filter, Dumpable
if (mappingKey != null)
mapping = WebSocketMapping.ensureMapping(context, mappingKey);
else
- mapping = new WebSocketMapping(WebSocketComponents.ensureWebSocketComponents(context));
+ mapping = new WebSocketMapping(WebSocketServerComponents.ensureWebSocketComponents(context));
String max = config.getInitParameter("idleTimeout");
if (max == null)
diff --git a/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/internal/WebSocketMapping.java b/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/internal/WebSocketMapping.java
index a96a55d315c..d76cbd53e9f 100644
--- a/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/internal/WebSocketMapping.java
+++ b/jetty-websocket/websocket-util-server/src/main/java/org/eclipse/jetty/websocket/util/server/internal/WebSocketMapping.java
@@ -42,6 +42,7 @@ import org.eclipse.jetty.websocket.core.exception.WebSocketException;
import org.eclipse.jetty.websocket.core.server.Handshaker;
import org.eclipse.jetty.websocket.core.server.Negotiation;
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
+import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,7 +66,7 @@ public class WebSocketMapping implements Dumpable, LifeCycle.Listener
if (mappingObject != null)
{
- if (WebSocketMapping.class.isInstance(mappingObject))
+ if (mappingObject instanceof WebSocketMapping)
return (WebSocketMapping)mappingObject;
else
throw new IllegalStateException(
@@ -88,7 +89,7 @@ public class WebSocketMapping implements Dumpable, LifeCycle.Listener
if (mapping == null)
{
- mapping = new WebSocketMapping(WebSocketComponents.ensureWebSocketComponents(servletContext));
+ mapping = new WebSocketMapping(WebSocketServerComponents.ensureWebSocketComponents(servletContext));
servletContext.setAttribute(mappingKey, mapping);
}
diff --git a/jetty-websocket/websocket-util/pom.xml b/jetty-websocket/websocket-util/pom.xml
index 9412101ce9f..cafdccef949 100644
--- a/jetty-websocket/websocket-util/pom.xml
+++ b/jetty-websocket/websocket-util/pom.xml
@@ -48,7 +48,7 @@
org.eclipse.jetty.websocket
- websocket-core
+ websocket-core-common${project.version}
@@ -60,10 +60,5 @@
jetty-slf4j-impltest
-
- org.eclipse.jetty.toolchain
- jetty-test-helper
- test
-
diff --git a/jetty-websocket/websocket-util/src/main/java/module-info.java b/jetty-websocket/websocket-util/src/main/java/module-info.java
index 183e1fd2715..22dafa0caea 100644
--- a/jetty-websocket/websocket-util/src/main/java/module-info.java
+++ b/jetty-websocket/websocket-util/src/main/java/module-info.java
@@ -21,6 +21,8 @@ module org.eclipse.jetty.websocket.util
exports org.eclipse.jetty.websocket.util;
exports org.eclipse.jetty.websocket.util.messages;
+ requires org.eclipse.jetty.util;
requires org.slf4j;
- requires transitive org.eclipse.jetty.websocket.core;
+ requires org.eclipse.jetty.io;
+ requires transitive org.eclipse.jetty.websocket.core.common;
}
diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java
index 8838a0797dd..6cd7e3fb95a 100644
--- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java
+++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java
@@ -36,6 +36,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
+import org.eclipse.jetty.logging.JettyLevel;
import org.eclipse.jetty.logging.JettyLogger;
import org.eclipse.jetty.logging.StdErrAppender;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
@@ -54,7 +55,6 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.event.Level;
import org.xml.sax.SAXException;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -1595,13 +1595,13 @@ public class XmlConfigurationTest
JettyLogger jettyLogger = (JettyLogger)slf4jLogger;
StdErrAppender appender = (StdErrAppender)jettyLogger.getAppender();
PrintStream oldStream = appender.getStream();
- int oldLevel = jettyLogger.getLevel();
+ JettyLevel oldLevel = jettyLogger.getLevel();
try
{
// capture events
appender.setStream(new PrintStream(logBytes, true));
// make sure we are seeing WARN level events
- jettyLogger.setLevel(Level.WARN);
+ jettyLogger.setLevel(JettyLevel.WARN);
action.run();
}
diff --git a/pom.xml b/pom.xml
index a2f2d8475d4..9a824ca94c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
9.0.299.4.8.Final2.4.0
- 7.2
+ 7.3.11.21benchmarks1.4.0
@@ -56,8 +56,7 @@
false
- 5.3
-
+ 5.42.1.1.RELEASE
@@ -66,6 +65,7 @@
${project.build.directory}/local-reposrc/it/settings.xml0
+ 1.14.2
@@ -1066,12 +1066,12 @@
org.testcontainerstestcontainers
- 1.14.1
+ ${testcontainers.version}org.testcontainersjunit-jupiter
- 1.14.1
+ ${testcontainers.version}
@@ -1104,6 +1104,12 @@
slf4j-simple${slf4j.version}
+
+ org.slf4j
+ jul-to-slf4j
+ ${slf4j.version}
+ test
+ org.jboss.loggingjboss-logging
diff --git a/tests/test-sessions/test-hazelcast-sessions/pom.xml b/tests/test-sessions/test-hazelcast-sessions/pom.xml
index 22f7719be61..cca87657172 100644
--- a/tests/test-sessions/test-hazelcast-sessions/pom.xml
+++ b/tests/test-sessions/test-hazelcast-sessions/pom.xml
@@ -109,7 +109,6 @@
org.slf4jjul-to-slf4j
- ${slf4j.version}test
diff --git a/tests/test-sessions/test-infinispan-sessions/pom.xml b/tests/test-sessions/test-infinispan-sessions/pom.xml
index f30c57237aa..845f48b6e9e 100644
--- a/tests/test-sessions/test-infinispan-sessions/pom.xml
+++ b/tests/test-sessions/test-infinispan-sessions/pom.xml
@@ -11,7 +11,10 @@
http://www.eclipse.org/jetty${project.groupId}.sessions.infinispan
- 127.0.0.1
+
+ ${infinispan.version}
+
+ jboss/infinispan-server
@@ -141,19 +144,23 @@
org.slf4jjul-to-slf4j
- ${slf4j.version}test
- org.eclipse.jetty
- jetty-slf4j-impl
+ org.slf4j
+ slf4j-simple
+ test
+
+
+ org.testcontainers
+ testcontainerstest
- remote
+ remote-session-testshotrod.enabled
@@ -166,34 +173,13 @@
org.apache.maven.pluginsmaven-surefire-plugin
+
+ ${infinispan.docker.image.version}
+ ${infinispan.docker.image.name}
+ **/*.java
-
- **/ClusteredSessionScavengingTest.java
-
-
-
-
-
-
-
- alltests
-
-
- alltests
- true
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- FOOBAR
-
diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/InfinispanSessionDataStoreTest.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/InfinispanSessionDataStoreTest.java
index faa76ba22bb..1eca7eca60a 100644
--- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/InfinispanSessionDataStoreTest.java
+++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/InfinispanSessionDataStoreTest.java
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* InfinispanSessionDataStoreTest
@@ -110,15 +110,7 @@ public class InfinispanSessionDataStoreTest extends AbstractSessionDataStoreTest
((InfinispanSessionDataStore)store).setCache(null);
//test that loading it fails
- try
- {
- store.load("222");
- fail("Session should be unreadable");
- }
- catch (UnreadableSessionDataException e)
- {
- //expected exception
- }
+ assertThrows(UnreadableSessionDataException.class, () -> store.load("222"));
}
/**
diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java
index 5f45903196b..37f92e3b447 100644
--- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java
+++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/SerializedInfinispanSessionDataStoreTest.java
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* SerializedInfinispanSessionDataStoreTest
@@ -107,15 +107,7 @@ public class SerializedInfinispanSessionDataStoreTest extends AbstractSessionDat
((InfinispanSessionDataStore)store).setCache(null);
//test that loading it fails
- try
- {
- store.load("222");
- fail("Session should be unreadable");
- }
- catch (UnreadableSessionDataException e)
- {
- //expected exception
- }
+ assertThrows(UnreadableSessionDataException.class,() -> store.load("222"));
}
/**
diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java
index 91f0235d8a8..07d925881cc 100644
--- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java
+++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java
@@ -39,7 +39,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* RemoteInfinispanSessionDataStoreTest
@@ -135,15 +135,7 @@ public class RemoteInfinispanSessionDataStoreTest extends AbstractSessionDataSto
((InfinispanSessionDataStore)store).setCache(null);
//test that loading it fails
- try
- {
- store.load("222");
- fail("Session should be unreadable");
- }
- catch (UnreadableSessionDataException e)
- {
- //expected exception
- }
+ assertThrows(UnreadableSessionDataException.class, () -> store.load("222"));
}
@Test
diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java
index 1d3577df296..d0429185dba 100644
--- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java
+++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java
@@ -31,31 +31,62 @@ import org.hibernate.search.cfg.Environment;
import org.hibernate.search.cfg.SearchMapping;
import org.infinispan.client.hotrod.RemoteCache;
import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.infinispan.client.hotrod.configuration.ClientIntelligence;
+import org.infinispan.client.hotrod.configuration.Configuration;
import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;
import org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller;
import org.infinispan.protostream.FileDescriptorSource;
import org.infinispan.protostream.SerializationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
+import org.testcontainers.utility.MountableFile;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
/**
* RemoteInfinispanTestSupport
*/
public class RemoteInfinispanTestSupport
{
+ private static final Logger LOG = LoggerFactory.getLogger(RemoteInfinispanTestSupport.class);
public static final String DEFAULT_CACHE_NAME = "session_test_cache";
public RemoteCache _cache;
private String _name;
public static RemoteCacheManager _manager;
+ private static final Logger INFINISPAN_LOG =
+ LoggerFactory.getLogger("org.eclipse.jetty.server.session.remote.infinispanLogs");
+
+ static GenericContainer infinispan;
static
{
try
{
- String host = System.getProperty("hotrod.host", "127.0.0.1");
+ //Testcontainers.exposeHostPorts(11222);
+ long start = System.currentTimeMillis();
+ String infinispanVersion = System.getProperty("infinispan.docker.image.version", "9.4.8.Final");
+ infinispan =
+ new GenericContainer(System.getProperty("infinispan.docker.image.name", "jboss/infinispan-server") +
+ ":" + infinispanVersion)
+ .withEnv("APP_USER","theuser")
+ .withEnv("APP_PASS","foobar")
+ .withEnv("MGMT_USER", "admin")
+ .withEnv("MGMT_PASS", "admin")
+ .waitingFor(new LogMessageWaitStrategy()
+ .withRegEx(".*Infinispan Server.*started in.*\\s"))
+ .withExposedPorts(4712,4713,8088,8089,8443,9990,9993,11211,11222,11223,11224)
+ .withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG));
+ infinispan.start();
+ String host = infinispan.getContainerIpAddress();
+ System.setProperty("hotrod.host", host);
+ int port = infinispan.getMappedPort(11222);
+ LOG.info("Infinispan container started for {}:{} - {}ms", host, port,
+ System.currentTimeMillis() - start);
SearchMapping mapping = new SearchMapping();
mapping.entity(SessionData.class).indexed().providedId()
.property("expiry", ElementType.METHOD).field();
@@ -63,10 +94,25 @@ public class RemoteInfinispanTestSupport
Properties properties = new Properties();
properties.put(Environment.MODEL_MAPPING, mapping);
- ConfigurationBuilder clientBuilder = new ConfigurationBuilder();
- clientBuilder.withProperties(properties).addServer().host(host).marshaller(new ProtoStreamMarshaller());
+ ConfigurationBuilder configurationBuilder = new ConfigurationBuilder().withProperties(properties)
+ .addServer().host(host).port(port)
+ // we just want to limit connectivity to list of host:port we knows at start
+ // as infinispan create new host:port dynamically but due to how docker expose host/port we cannot do that
+ .clientIntelligence(ClientIntelligence.BASIC)
+ .marshaller(new ProtoStreamMarshaller());
- _manager = new RemoteCacheManager(clientBuilder.build());
+ if (infinispanVersion.startsWith("1"))
+ {
+ configurationBuilder.security().authentication()
+ .realm("default")
+ .serverName("infinispan")
+ .saslMechanism("DIGEST-MD5")
+ .username("theuser").password("foobar");
+ }
+
+ Configuration configuration = configurationBuilder.build();
+
+ _manager = new RemoteCacheManager(configuration);
FileDescriptorSource fds = new FileDescriptorSource();
fds.addProtoFiles("/session.proto");
@@ -86,11 +132,12 @@ public class RemoteInfinispanTestSupport
}
String content = baos.toString("UTF-8");
- _manager.getCache("___protobuf_metadata").put("session.proto", content);
+ _manager.administration().getOrCreateCache("___protobuf_metadata", (String)null).put("session.proto", content);
}
catch (Exception e)
{
- fail(e);
+ LOG.error(e.getMessage(), e);
+ throw new RuntimeException(e);
}
}
@@ -114,7 +161,7 @@ public class RemoteInfinispanTestSupport
public void setup() throws Exception
{
- _cache = _manager.getCache(_name);
+ _cache = _manager.administration().getOrCreateCache(_name,(String)null);
}
public void teardown() throws Exception
diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/resources/simplelogger.properties b/tests/test-sessions/test-infinispan-sessions/src/test/resources/simplelogger.properties
new file mode 100644
index 00000000000..cc6528beeee
--- /dev/null
+++ b/tests/test-sessions/test-infinispan-sessions/src/test/resources/simplelogger.properties
@@ -0,0 +1,3 @@
+org.slf4j.simpleLogger.defaultLogLevel=info
+org.slf4j.simpleLogger.log.org.eclipse.jetty.server.session.remote.infinispanLogs=info
+org.slf4j.simpleLogger.log.org.eclipse.jetty.server.session.remote.RemoteInfinispanTestSupport=info
diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml
index 8eb0cc52e99..c5d7c323231 100644
--- a/tests/test-sessions/test-jdbc-sessions/pom.xml
+++ b/tests/test-sessions/test-jdbc-sessions/pom.xml
@@ -8,9 +8,9 @@
test-jdbc-sessionsJetty Tests :: Sessions :: JDBC
- http://www.eclipse.org/jetty${project.groupId}.sessions.jdbc
+ 10.3.6
@@ -22,6 +22,15 @@
true
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ ${mariadb.docker.version}
+
+
+
@@ -55,13 +64,13 @@
test
- org.apache.derby
- derby
+ org.eclipse.jetty.toolchain
+ jetty-test-helpertest
- org.apache.derby
- derbytools
+ org.testcontainers
+ testcontainerstest
@@ -74,5 +83,21 @@
jetty-test-helpertest
+
+ org.testcontainers
+ mariadb
+ ${testcontainers.version}
+ test
+
+
+ org.testcontainers
+ junit-jupiter
+ test
+
+
+ org.mariadb.jdbc
+ mariadb-java-client
+ 2.6.0
+
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java
index d81074084c1..18f430eb86d 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredInvalidationSessionTest.java
@@ -19,10 +19,12 @@
package org.eclipse.jetty.server.session;
import org.junit.jupiter.api.AfterEach;
+import org.testcontainers.junit.jupiter.Testcontainers;
/**
* ClusteredInvalidationSessionTest
*/
+@Testcontainers(disabledWithoutDocker = true)
public class ClusteredInvalidationSessionTest extends AbstractClusteredInvalidationSessionTest
{
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
index 7e0ee188959..fadcf04dd7c 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredOrphanedSessionTest.java
@@ -19,10 +19,12 @@
package org.eclipse.jetty.server.session;
import org.junit.jupiter.api.AfterEach;
+import org.testcontainers.junit.jupiter.Testcontainers;
/**
* ClusteredOrphanedSessionTest
*/
+@Testcontainers(disabledWithoutDocker = true)
public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessionTest
{
@Override
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java
index 361fd148efa..571eca48998 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionMigrationTest.java
@@ -31,6 +31,7 @@ import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.http.HttpField;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
+import org.testcontainers.junit.jupiter.Testcontainers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -45,6 +46,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
* Rather, it tests all of the machinery above the SessionDataStore. Thus,
* to reduce test time, we only apply it to the JDBCSessionDataStore.
*/
+@Testcontainers(disabledWithoutDocker = true)
public class ClusteredSessionMigrationTest extends AbstractTestBase
{
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java
index b3b8a0232e4..e57e27b0e6c 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ClusteredSessionScavengingTest.java
@@ -19,10 +19,12 @@
package org.eclipse.jetty.server.session;
import org.junit.jupiter.api.AfterEach;
+import org.testcontainers.junit.jupiter.Testcontainers;
/**
* ClusteredSessionScavengingTest
*/
+@Testcontainers(disabledWithoutDocker = true)
public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest
{
@Override
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JDBCSessionDataStoreTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JDBCSessionDataStoreTest.java
index d41296f3a52..2beae163b9c 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JDBCSessionDataStoreTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JDBCSessionDataStoreTest.java
@@ -20,10 +20,12 @@ package org.eclipse.jetty.server.session;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
+import org.testcontainers.junit.jupiter.Testcontainers;
/**
* JDBCSessionDataStoreTest
*/
+@Testcontainers(disabledWithoutDocker = true)
public class JDBCSessionDataStoreTest extends AbstractSessionDataStoreTest
{
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java
index 2ff961416d1..2cb46544ae0 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/JdbcTestHelper.java
@@ -33,6 +33,11 @@ import java.util.Set;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.ClassLoadingObjectInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.MariaDBContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -42,9 +47,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class JdbcTestHelper
{
- public static final String DRIVER_CLASS = "org.apache.derby.jdbc.EmbeddedDriver";
- public static final String DEFAULT_CONNECTION_URL = "jdbc:derby:memory:sessions;create=true";
- public static final String DEFAULT_SHUTDOWN_URL = "jdbc:derby:memory:sessions;drop=true";
+ private static final Logger LOG = LoggerFactory.getLogger(JdbcTestHelper.class);
+ private static final Logger MARIADB_LOG = LoggerFactory.getLogger("org.eclipse.jetty.server.session.MariaDbLogs");
+
+ public static String DRIVER_CLASS;
+ public static String DEFAULT_CONNECTION_URL;
+
public static final int STALE_INTERVAL = 1;
public static final String EXPIRY_COL = "extime";
@@ -60,28 +68,60 @@ public class JdbcTestHelper
public static final String COOKIE_COL = "cooktime";
public static final String CREATE_COL = "ctime";
+ static MariaDBContainer MARIAD_DB;
+
+ static final String MARIA_DB_USER = "beer";
+ static final String MARIA_DB_PASSWORD = "pacific_ale";
+
static
{
- System.setProperty("derby.system.home", MavenTestingUtils.getTargetFile("test-derby").getAbsolutePath());
+ try
+ {
+ long start = System.currentTimeMillis();
+ MARIAD_DB =
+ new MariaDBContainer("mariadb:" + System.getProperty("mariadb.docker.version", "10.3.6"))
+ .withUsername(MARIA_DB_USER)
+ .withPassword(MARIA_DB_PASSWORD)
+ .withDatabaseName("sessions");
+ MARIAD_DB.withLogConsumer(new Slf4jLogConsumer(MARIADB_LOG)).start();
+ String containerIpAddress = MARIAD_DB.getContainerIpAddress();
+ int mariadbPort = MARIAD_DB.getMappedPort(3306);
+ DEFAULT_CONNECTION_URL = MARIAD_DB.getJdbcUrl();
+ DRIVER_CLASS = MARIAD_DB.getDriverClassName();
+ LOG.info("Mariadb container started for {}:{} - {}ms", containerIpAddress, mariadbPort,
+ System.currentTimeMillis() - start);
+ DEFAULT_CONNECTION_URL = DEFAULT_CONNECTION_URL + "?user=" + MARIA_DB_USER +
+ "&password=" + MARIA_DB_PASSWORD;
+ LOG.info("DEFAULT_CONNECTION_URL: {}", DEFAULT_CONNECTION_URL);
+ }
+ catch (Exception e)
+ {
+ LOG.error(e.getMessage(), e);
+ throw new RuntimeException(e.getMessage(), e);
+ }
}
public static void shutdown(String connectionUrl)
throws Exception
{
- if (connectionUrl == null)
- connectionUrl = DEFAULT_SHUTDOWN_URL;
+ try (Connection connection = getConnection())
+ {
+ connection.prepareStatement("truncate table " + TABLE).executeUpdate();
+ }
+ }
- try
- {
- DriverManager.getConnection(connectionUrl);
- }
- catch (SQLException expected)
- {
- if (!"08006".equals(expected.getSQLState()))
- {
- throw expected;
- }
- }
+ public static DatabaseAdaptor buildDatabaseAdaptor()
+ {
+ DatabaseAdaptor da = new DatabaseAdaptor();
+ da.setDriverInfo(DRIVER_CLASS, DEFAULT_CONNECTION_URL);
+ return da;
+ }
+
+ public static Connection getConnection()
+ throws Exception
+ {
+ Class.forName(DRIVER_CLASS);
+ return DriverManager.getConnection(DEFAULT_CONNECTION_URL);
}
/**
@@ -89,9 +129,7 @@ public class JdbcTestHelper
*/
public static SessionDataStoreFactory newSessionDataStoreFactory()
{
- DatabaseAdaptor da = new DatabaseAdaptor();
- da.setDriverInfo(DRIVER_CLASS, DEFAULT_CONNECTION_URL);
- return newSessionDataStoreFactory(da);
+ return newSessionDataStoreFactory(buildDatabaseAdaptor());
}
public static SessionDataStoreFactory newSessionDataStoreFactory(DatabaseAdaptor da)
@@ -123,8 +161,7 @@ public class JdbcTestHelper
public static void prepareTables() throws SQLException
{
- DatabaseAdaptor da = new DatabaseAdaptor();
- da.setDriverInfo(DRIVER_CLASS, DEFAULT_CONNECTION_URL);
+ DatabaseAdaptor da = buildDatabaseAdaptor();
JDBCSessionDataStore.SessionTableSchema sessionTableSchema = newSessionTableSchema();
sessionTableSchema.setDatabaseAdaptor(da);
@@ -163,11 +200,8 @@ public class JdbcTestHelper
public static boolean existsInSessionTable(String id, boolean verbose)
throws Exception
{
- Class.forName(DRIVER_CLASS);
- Connection con = null;
- try
+ try (Connection con = getConnection())
{
- con = DriverManager.getConnection(DEFAULT_CONNECTION_URL);
PreparedStatement statement = con.prepareStatement("select * from " +
TABLE +
" where " + ID_COL + " = ?");
@@ -186,21 +220,15 @@ public class JdbcTestHelper
else
return result.next();
}
- finally
- {
- if (con != null)
- con.close();
- }
}
@SuppressWarnings("unchecked")
public static boolean checkSessionPersisted(SessionData data)
throws Exception
{
- Class.forName(DRIVER_CLASS);
PreparedStatement statement = null;
ResultSet result = null;
- try (Connection con = DriverManager.getConnection(DEFAULT_CONNECTION_URL);)
+ try (Connection con = getConnection())
{
statement = con.prepareStatement(
"select * from " + TABLE +
@@ -265,9 +293,7 @@ public class JdbcTestHelper
public static void insertSession(SessionData data) throws Exception
{
-
- Class.forName(DRIVER_CLASS);
- try (Connection con = DriverManager.getConnection(DEFAULT_CONNECTION_URL);)
+ try (Connection con = getConnection())
{
PreparedStatement statement = con.prepareStatement("insert into " + TABLE +
" (" + ID_COL + ", " + CONTEXT_COL + ", virtualHost, " + LAST_NODE_COL +
@@ -311,8 +337,7 @@ public class JdbcTestHelper
long cookieSet, long lastSaved)
throws Exception
{
- Class.forName(DRIVER_CLASS);
- try (Connection con = DriverManager.getConnection(DEFAULT_CONNECTION_URL);)
+ try (Connection con = getConnection())
{
PreparedStatement statement = con.prepareStatement("insert into " + TABLE +
" (" + ID_COL + ", " + CONTEXT_COL + ", virtualHost, " + LAST_NODE_COL +
@@ -344,12 +369,9 @@ public class JdbcTestHelper
public static Set getSessionIds()
throws Exception
{
- HashSet ids = new HashSet();
- Class.forName(DRIVER_CLASS);
- Connection con = null;
- try
+ HashSet ids = new HashSet<>();
+ try (Connection con = getConnection())
{
- con = DriverManager.getConnection(DEFAULT_CONNECTION_URL);
PreparedStatement statement = con.prepareStatement("select " + ID_COL + " from " + TABLE);
ResultSet result = statement.executeQuery();
while (result.next())
@@ -358,10 +380,5 @@ public class JdbcTestHelper
}
return ids;
}
- finally
- {
- if (con != null)
- con.close();
- }
}
}
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReloadedSessionMissingClassTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReloadedSessionMissingClassTest.java
index 17bcb26cb33..cc35bfad46c 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReloadedSessionMissingClassTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/ReloadedSessionMissingClassTest.java
@@ -36,6 +36,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.testcontainers.junit.jupiter.Testcontainers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -46,6 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* ReloadedSessionMissingClassTest
*/
@ExtendWith(WorkDirExtension.class)
+@Testcontainers(disabledWithoutDocker = true)
public class ReloadedSessionMissingClassTest
{
public WorkDir testdir;
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java
index 40ef5a5f0fe..e9deadf92fc 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/SessionTableSchemaTest.java
@@ -20,7 +20,6 @@ package org.eclipse.jetty.server.session;
import java.io.ByteArrayInputStream;
import java.sql.Connection;
-import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -28,6 +27,7 @@ import org.eclipse.jetty.server.handler.ContextHandler;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.testcontainers.junit.jupiter.Testcontainers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -39,6 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* Test the SessionTableSchema behaviour when the database treats "" as a NULL,
* like Oracle does.
*/
+@Testcontainers(disabledWithoutDocker = true)
public class SessionTableSchemaTest
{
DatabaseAdaptor _da;
@@ -81,8 +82,7 @@ public class SessionTableSchemaTest
public static void insertSessionWithoutAttributes(String id, String contextPath, String vhost)
throws Exception
{
- Class.forName(JdbcTestHelper.DRIVER_CLASS);
- try (Connection con = DriverManager.getConnection(JdbcTestHelper.DEFAULT_CONNECTION_URL);)
+ try (Connection con = JdbcTestHelper.getConnection())
{
PreparedStatement statement = con.prepareStatement("insert into " + JdbcTestHelper.TABLE +
" (" + JdbcTestHelper.ID_COL + ", " + JdbcTestHelper.CONTEXT_COL + ", virtualHost, " + JdbcTestHelper.LAST_NODE_COL +
@@ -116,8 +116,10 @@ public class SessionTableSchemaTest
_da.initialize();
_tableSchema.prepareTables();
+ String id = Long.toString(System.nanoTime());
+
//insert a fake session at the root context
- insertSessionWithoutAttributes("1234", "/", "0.0.0.0");
+ insertSessionWithoutAttributes(id, "/", "0.0.0.0");
//test if it can be seen
try (Connection con = _da.getConnection())
@@ -127,7 +129,7 @@ public class SessionTableSchemaTest
handler.setContextPath("/");
SessionContext sc = new SessionContext("0", handler.getServletContext());
//test the load statement
- PreparedStatement s = _tableSchema.getLoadStatement(con, "1234", sc);
+ PreparedStatement s = _tableSchema.getLoadStatement(con, id, sc);
ResultSet rs = s.executeQuery();
assertTrue(rs.next());
}
@@ -141,8 +143,10 @@ public class SessionTableSchemaTest
_da.initialize();
_tableSchema.prepareTables();
+ String id = Long.toString(System.nanoTime());
+
//insert a fake session at the root context
- insertSessionWithoutAttributes("1234", "/", "0.0.0.0");
+ insertSessionWithoutAttributes(id, "/", "0.0.0.0");
//test if it can be seen
try (Connection con = _da.getConnection())
@@ -151,7 +155,7 @@ public class SessionTableSchemaTest
handler.setContextPath("/");
SessionContext sc = new SessionContext("0", handler.getServletContext());
PreparedStatement s = _tableSchema.getCheckSessionExistsStatement(con, sc);
- s.setString(1, "1234");
+ s.setString(1, id);
ResultSet rs = s.executeQuery();
assertTrue(rs.next());
}
@@ -165,8 +169,10 @@ public class SessionTableSchemaTest
_da.initialize();
_tableSchema.prepareTables();
+ String id = Long.toString(System.nanoTime());
+
//insert a fake session at the root context
- insertSessionWithoutAttributes("1234", "/", "0.0.0.0");
+ insertSessionWithoutAttributes(id, "/", "0.0.0.0");
//test if it can be deleted
try (Connection con = _da.getConnection())
@@ -174,10 +180,10 @@ public class SessionTableSchemaTest
ContextHandler handler = new ContextHandler();
handler.setContextPath("/");
SessionContext sc = new SessionContext("0", handler.getServletContext());
- PreparedStatement s = _tableSchema.getDeleteStatement(con, "1234", sc);
+ PreparedStatement s = _tableSchema.getDeleteStatement(con, id, sc);
assertEquals(1, s.executeUpdate());
- assertFalse(JdbcTestHelper.existsInSessionTable("1234", false));
+ assertFalse(JdbcTestHelper.existsInSessionTable(id, false));
}
}
@@ -189,8 +195,10 @@ public class SessionTableSchemaTest
_da.initialize();
_tableSchema.prepareTables();
+ String id = Long.toString(System.nanoTime());
+
//insert a fake session at the root context
- insertSessionWithoutAttributes("1234", "/", "0.0.0.0");
+ insertSessionWithoutAttributes(id, "/", "0.0.0.0");
try (Connection con = _da.getConnection())
{
@@ -203,7 +211,7 @@ public class SessionTableSchemaTest
(System.currentTimeMillis() + 100L));
ResultSet rs = s.executeQuery();
assertTrue(rs.next());
- assertEquals("1234", rs.getString(1));
+ assertEquals(id, rs.getString(1));
}
}
@@ -215,8 +223,10 @@ public class SessionTableSchemaTest
_da.initialize();
_tableSchema.prepareTables();
+ String id = Long.toString(System.nanoTime());
+
//insert a fake session at the root context
- insertSessionWithoutAttributes("1234", "/", "0.0.0.0");
+ insertSessionWithoutAttributes(id, "/", "0.0.0.0");
try (Connection con = _da.getConnection())
{
@@ -228,7 +238,7 @@ public class SessionTableSchemaTest
(System.currentTimeMillis() + 100L));
ResultSet rs = s.executeQuery();
assertTrue(rs.next());
- assertEquals("1234", rs.getString(1));
+ assertEquals(id, rs.getString(1));
}
}
@@ -240,8 +250,10 @@ public class SessionTableSchemaTest
_da.initialize();
_tableSchema.prepareTables();
+ String id = Long.toString(System.nanoTime());
+
//insert a fake session at the root context
- insertSessionWithoutAttributes("1234", "/", "0.0.0.0");
+ insertSessionWithoutAttributes(id, "/", "0.0.0.0");
try (Connection con = _da.getConnection())
{
@@ -249,7 +261,7 @@ public class SessionTableSchemaTest
handler.setContextPath("/");
SessionContext sc = new SessionContext("0", handler.getServletContext());
PreparedStatement s = _tableSchema.getUpdateStatement(con,
- "1234",
+ id,
sc);
s.setString(1, "0");//should be my node id
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
index c3a2b12c3d4..75d21faf105 100644
--- a/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/java/org/eclipse/jetty/server/session/WebAppObjectInSessionTest.java
@@ -21,10 +21,12 @@ package org.eclipse.jetty.server.session;
import org.eclipse.jetty.util.resource.Resource;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
+import org.testcontainers.junit.jupiter.Testcontainers;
/**
* WebAppObjectInSessionTest
*/
+@Testcontainers(disabledWithoutDocker = true)
public class WebAppObjectInSessionTest extends AbstractWebAppObjectInSessionTest
{
diff --git a/tests/test-sessions/test-jdbc-sessions/src/test/resources/simplelogger.properties b/tests/test-sessions/test-jdbc-sessions/src/test/resources/simplelogger.properties
new file mode 100644
index 00000000000..6f00400db97
--- /dev/null
+++ b/tests/test-sessions/test-jdbc-sessions/src/test/resources/simplelogger.properties
@@ -0,0 +1,3 @@
+org.slf4j.simpleLogger.defaultLogLevel=info
+org.slf4j.simpleLogger.log.org.eclipse.jetty.server.session.MariaDbLogs=error
+org.slf4j.simpleLogger.log.org.eclipse.jetty.server.session.JdbcTestHelper=info
diff --git a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java
index c4cc8f31416..2cdb869a110 100644
--- a/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/test/java/org/eclipse/jetty/server/session/RemoveSessionTest.java
@@ -54,6 +54,7 @@ public class RemoveSessionTest
String servletMapping = "/server";
DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory();
+ cacheFactory.setFlushOnResponseCommit(true);
cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT);
SessionDataStoreFactory storeFactory = new TestSessionDataStoreFactory();
@@ -93,6 +94,9 @@ public class RemoveSessionTest
assertEquals(0, ((DefaultSessionCache)m.getSessionCache()).getSessionsCurrent());
assertEquals(1, ((DefaultSessionCache)m.getSessionCache()).getSessionsMax());
assertEquals(1, ((DefaultSessionCache)m.getSessionCache()).getSessionsTotal());
+
+ //check the session is no longer in the cache
+ assertFalse(((AbstractSessionCache)m.getSessionCache()).contains(TestServer.extractSessionId(sessionCookie)));
//check the session is not persisted any more
assertFalse(m.getSessionCache().getSessionDataStore().exists(TestServer.extractSessionId(sessionCookie)));
@@ -125,7 +129,8 @@ public class RemoveSessionTest
String action = request.getParameter("action");
if ("create".equals(action))
{
- request.getSession(true);
+ HttpSession s = request.getSession(true);
+ s.setAttribute("foo", "bar");
}
else if ("delete".equals(action))
{