mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-01 11:29:29 +00:00
Merge branch 'jetty-9.4.x' of github.com:eclipse/jetty.project into jetty-9.4.x
This commit is contained in:
commit
1f2ed754f3
@ -52,3 +52,13 @@ Create a new bug
|
||||
Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!
|
||||
|
||||
- [https://github.com/eclipse/jetty.project/issues](https://github.com/eclipse/jetty.project/issues)
|
||||
|
||||
Reporting Security Issues
|
||||
-----------------
|
||||
There are a number of avenues for reporting security issues to the Jetty project available.
|
||||
If the issue is directly related to Jetty itself then reporting to the Jetty developers is encouraged.
|
||||
The most direct method is to mail [security@webtide.com](mailto:security@webtide.com).
|
||||
Webtide is comprised of the active committers of the Jetty project is our preferred reporting method.
|
||||
We are flexible in how we work with reporters of security issues but we reserve the right to act in the interests of the Jetty project in all circumstances.
|
||||
|
||||
If the issue is related to Eclipse or its Jetty integration then we encourage you to reach out to [security@eclipse.org](mailto:security@eclipse.org).
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
|
||||
/**
|
||||
* {@link ContentDecoder} for the "gzip" encoding.
|
||||
@ -26,14 +27,21 @@ package org.eclipse.jetty.client;
|
||||
public class GZIPContentDecoder extends org.eclipse.jetty.http.GZIPContentDecoder implements ContentDecoder
|
||||
{
|
||||
|
||||
private static final int DEFAULT_BUFFER_SIZE = 2048;
|
||||
|
||||
public GZIPContentDecoder()
|
||||
{
|
||||
this(2048);
|
||||
this(DEFAULT_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public GZIPContentDecoder(int bufferSize)
|
||||
{
|
||||
super(null,bufferSize);
|
||||
this(null,bufferSize);
|
||||
}
|
||||
|
||||
public GZIPContentDecoder(ByteBufferPool byteBufferPool, int bufferSize)
|
||||
{
|
||||
super(byteBufferPool, bufferSize);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,22 +50,34 @@ public class GZIPContentDecoder extends org.eclipse.jetty.http.GZIPContentDecode
|
||||
public static class Factory extends ContentDecoder.Factory
|
||||
{
|
||||
private final int bufferSize;
|
||||
private final ByteBufferPool byteBufferPool;
|
||||
|
||||
public Factory()
|
||||
{
|
||||
this(2048);
|
||||
this(DEFAULT_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public Factory(int bufferSize)
|
||||
{
|
||||
this(null, bufferSize);
|
||||
}
|
||||
|
||||
public Factory(ByteBufferPool byteBufferPool)
|
||||
{
|
||||
this(byteBufferPool, DEFAULT_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public Factory(ByteBufferPool byteBufferPool, int bufferSize)
|
||||
{
|
||||
super("gzip");
|
||||
this.byteBufferPool = byteBufferPool;
|
||||
this.bufferSize = bufferSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContentDecoder newContentDecoder()
|
||||
{
|
||||
return new GZIPContentDecoder(bufferSize);
|
||||
return new GZIPContentDecoder(byteBufferPool, bufferSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class HttpClient extends ContainerLifeCycle
|
||||
handlers.put(new WWWAuthenticationProtocolHandler(this));
|
||||
handlers.put(new ProxyAuthenticationProtocolHandler(this));
|
||||
|
||||
decoderFactories.add(new GZIPContentDecoder.Factory());
|
||||
decoderFactories.add(new GZIPContentDecoder.Factory(byteBufferPool));
|
||||
|
||||
cookieManager = newCookieManager();
|
||||
cookieStore = cookieManager.getCookieStore();
|
||||
|
@ -23,8 +23,8 @@ This section provides a tutorial that shows how you can quickly develop embedded
|
||||
==== Downloading the Jars
|
||||
|
||||
Jetty is decomposed into many jars and dependencies to achieve a minimal footprint by selecting the minimal set of jars.
|
||||
Typically it is best to use something like Maven to manage jars, however this tutorial uses an aggregate Jar that contains all of the Jetty classes in one Jar.
|
||||
You can manually download the aggregate link:http://central.maven.org/maven2/org/eclipse/jetty/aggregate/jetty-all/{VERSION}/jetty-all-{VERSION}-uber.jar[`jetty-all.jar`] using `curl`) or a browser.
|
||||
Typically it is best to use something like link:#jetty-maven-helloworld[Maven] to manage jars, however this tutorial uses an aggregate Jar that contains all of the required Jetty classes in one Jar.
|
||||
You can manually download the aggregate link:http://central.maven.org/maven2/org/eclipse/jetty/aggregate/jetty-all/{VERSION}/jetty-all-{VERSION}-uber.jar[`jetty-all.jar`] using `curl` or a browser.
|
||||
|
||||
____
|
||||
[NOTE]
|
||||
@ -32,6 +32,12 @@ The central Maven repository has started to aggressively reject/deny access to t
|
||||
The administrators of the central maven repository have stated that the recommended command line download tool is now curl.
|
||||
____
|
||||
|
||||
____
|
||||
[IMPORTANT]
|
||||
The `jetty-all` jar referenced in this section is for example purposes only and should not be used outside of this context.
|
||||
Please consider using link:#jetty-maven-helloworld[Maven] to manage your project dependencies.
|
||||
____
|
||||
|
||||
Use curl as follows:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
|
@ -422,9 +422,9 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
if (!_dsProvided)
|
||||
{
|
||||
if (!StringUtil.isBlank(getNamespace()))
|
||||
_datastore = DatastoreOptions.builder().namespace(getNamespace()).build().service();
|
||||
_datastore = DatastoreOptions.newBuilder().setNamespace(getNamespace()).build().getService();
|
||||
else
|
||||
_datastore = DatastoreOptions.defaultInstance().service();
|
||||
_datastore = DatastoreOptions.getDefaultInstance().getService();
|
||||
}
|
||||
|
||||
if (_model == null)
|
||||
@ -433,7 +433,7 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
addBean(_model,true);
|
||||
}
|
||||
|
||||
_keyFactory = _datastore.newKeyFactory().kind(_model.getKind());
|
||||
_keyFactory = _datastore.newKeyFactory().setKind(_model.getKind());
|
||||
|
||||
_indexesPresent = checkIndexes();
|
||||
if (!_indexesPresent)
|
||||
@ -566,9 +566,9 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
{
|
||||
try
|
||||
{
|
||||
Query<Key> q = Query.keyQueryBuilder()
|
||||
.kind(_model.getKind())
|
||||
.filter(PropertyFilter.eq(_model.getId(), s))
|
||||
Query<Key> q = Query.newKeyQueryBuilder()
|
||||
.setKind(_model.getKind())
|
||||
.setFilter(PropertyFilter.eq(_model.getId(), s))
|
||||
.build();
|
||||
QueryResults<Key> res = _datastore.run(q);
|
||||
if (!res.hasNext())
|
||||
@ -604,10 +604,10 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
Set<ExpiryInfo> info = new HashSet<>();
|
||||
|
||||
//get up to maxResult number of sessions that have expired
|
||||
Query<Entity> query = Query.entityQueryBuilder()
|
||||
.kind(_model.getKind())
|
||||
.filter(CompositeFilter.and(PropertyFilter.gt(_model.getExpiry(), 0), PropertyFilter.le(_model.getExpiry(), System.currentTimeMillis())))
|
||||
.limit(_maxResults)
|
||||
Query<Entity> query = Query.newEntityQueryBuilder()
|
||||
.setKind(_model.getKind())
|
||||
.setFilter(CompositeFilter.and(PropertyFilter.gt(_model.getExpiry(), 0), PropertyFilter.le(_model.getExpiry(), System.currentTimeMillis())))
|
||||
.setLimit(_maxResults)
|
||||
.build();
|
||||
|
||||
QueryResults<Entity> results;
|
||||
@ -637,11 +637,11 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
protected Set<ExpiryInfo> queryExpiryByIndex () throws Exception
|
||||
{
|
||||
Set<ExpiryInfo> info = new HashSet<>();
|
||||
Query<ProjectionEntity> query = Query.projectionEntityQueryBuilder()
|
||||
.kind(_model.getKind())
|
||||
.projection(_model.getId(), _model.getLastNode(), _model.getExpiry())
|
||||
.filter(CompositeFilter.and(PropertyFilter.gt(_model.getExpiry(), 0), PropertyFilter.le(_model.getExpiry(), System.currentTimeMillis())))
|
||||
.limit(_maxResults)
|
||||
Query<ProjectionEntity> query = Query.newProjectionEntityQueryBuilder()
|
||||
.setKind(_model.getKind())
|
||||
.setProjection(_model.getId(), _model.getLastNode(), _model.getExpiry())
|
||||
.setFilter(CompositeFilter.and(PropertyFilter.gt(_model.getExpiry(), 0), PropertyFilter.le(_model.getExpiry(), System.currentTimeMillis())))
|
||||
.setLimit(_maxResults)
|
||||
.build();
|
||||
|
||||
QueryResults<ProjectionEntity> presults;
|
||||
@ -674,10 +674,10 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
{
|
||||
if (_indexesPresent)
|
||||
{
|
||||
Query<ProjectionEntity> query = Query.projectionEntityQueryBuilder()
|
||||
.kind(_model.getKind())
|
||||
.projection(_model.getExpiry())
|
||||
.filter(PropertyFilter.eq(_model.getId(), id))
|
||||
Query<ProjectionEntity> query = Query.newProjectionEntityQueryBuilder()
|
||||
.setKind(_model.getKind())
|
||||
.setProjection(_model.getExpiry())
|
||||
.setFilter(PropertyFilter.eq(_model.getId(), id))
|
||||
.build();
|
||||
|
||||
QueryResults<ProjectionEntity> presults;
|
||||
@ -700,9 +700,9 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
}
|
||||
else
|
||||
{
|
||||
Query<Entity> query = Query.entityQueryBuilder()
|
||||
.kind(_model.getKind())
|
||||
.filter(PropertyFilter.eq(_model.getId(), id))
|
||||
Query<Entity> query = Query.newEntityQueryBuilder()
|
||||
.setKind(_model.getKind())
|
||||
.setFilter(PropertyFilter.eq(_model.getId(), id))
|
||||
.build();
|
||||
|
||||
QueryResults<Entity> results;
|
||||
@ -761,7 +761,7 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
}
|
||||
catch (DatastoreException e)
|
||||
{
|
||||
if (e.retryable())
|
||||
if (e.isRetryable())
|
||||
{
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Datastore put retry {} waiting {}ms", attempts, backoff);
|
||||
|
||||
@ -814,12 +814,14 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
*/
|
||||
protected boolean checkIndexes ()
|
||||
{
|
||||
long start =0;
|
||||
|
||||
try
|
||||
{
|
||||
Query<ProjectionEntity> query = Query.projectionEntityQueryBuilder()
|
||||
.kind(_model.getKind())
|
||||
.projection(_model.getExpiry())
|
||||
.filter(PropertyFilter.eq(_model.getId(), "-"))
|
||||
Query<ProjectionEntity> query = Query.newProjectionEntityQueryBuilder()
|
||||
.setKind(_model.getKind())
|
||||
.setProjection(_model.getExpiry())
|
||||
.setFilter(PropertyFilter.eq(_model.getId(), "-"))
|
||||
.build();
|
||||
_datastore.run(query);
|
||||
return true;
|
||||
@ -855,7 +857,7 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
oos.flush();
|
||||
|
||||
//turn a session into an entity
|
||||
entity = Entity.builder(key)
|
||||
entity = Entity.newBuilder(key)
|
||||
.set(_model.getId(), session.getId())
|
||||
.set(_model.getContextPath(), session.getContextPath())
|
||||
.set(_model.getVhost(), session.getVhost())
|
||||
@ -866,7 +868,7 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
|
||||
.set(_model.getLastNode(),session.getLastNode())
|
||||
.set(_model.getExpiry(), session.getExpiry())
|
||||
.set(_model.getMaxInactive(), session.getMaxInactiveMs())
|
||||
.set(_model.getAttributes(), BlobValue.builder(Blob.copyFrom(baos.toByteArray())).excludeFromIndexes(true).build()).build();
|
||||
.set(_model.getAttributes(), BlobValue.newBuilder(Blob.copyFrom(baos.toByteArray())).setExcludeFromIndexes(true).build()).build();
|
||||
|
||||
|
||||
return entity;
|
||||
|
@ -13,7 +13,7 @@
|
||||
<name>Jetty :: GCloud</name>
|
||||
|
||||
<properties>
|
||||
<gcloud.version>0.7.0</gcloud.version>
|
||||
<gcloud.version>0.9.2-beta</gcloud.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
|
@ -150,6 +150,24 @@ readConfig()
|
||||
source "$1"
|
||||
}
|
||||
|
||||
dumpEnv()
|
||||
{
|
||||
echo "JAVA = $JAVA"
|
||||
echo "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}"
|
||||
echo "JETTY_HOME = $JETTY_HOME"
|
||||
echo "JETTY_BASE = $JETTY_BASE"
|
||||
echo "START_D = $START_D"
|
||||
echo "START_INI = $START_INI"
|
||||
echo "JETTY_START = $JETTY_START"
|
||||
echo "JETTY_CONF = $JETTY_CONF"
|
||||
echo "JETTY_ARGS = ${JETTY_ARGS[*]}"
|
||||
echo "JETTY_RUN = $JETTY_RUN"
|
||||
echo "JETTY_PID = $JETTY_PID"
|
||||
echo "JETTY_START_LOG= $JETTY_START_LOG"
|
||||
echo "JETTY_STATE = $JETTY_STATE"
|
||||
echo "RUN_CMD = ${RUN_CMD[*]}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
##################################################
|
||||
@ -278,6 +296,14 @@ then
|
||||
[ -d "$JETTY_RUN" ] || mkdir $JETTY_RUN
|
||||
fi
|
||||
|
||||
#####################################################
|
||||
# define start log location
|
||||
#####################################################
|
||||
if [ -z "$JETTY_START_LOG" ]
|
||||
then
|
||||
JETTY_START_LOG="$JETTY_RUN/$NAME-start.log"
|
||||
fi
|
||||
|
||||
#####################################################
|
||||
# Find a pid and state file
|
||||
#####################################################
|
||||
@ -401,17 +427,7 @@ RUN_CMD=("$JAVA" ${RUN_ARGS[@]})
|
||||
#####################################################
|
||||
if (( DEBUG ))
|
||||
then
|
||||
echo "START_INI = $START_INI"
|
||||
echo "START_D = $START_D"
|
||||
echo "JETTY_HOME = $JETTY_HOME"
|
||||
echo "JETTY_BASE = $JETTY_BASE"
|
||||
echo "JETTY_CONF = $JETTY_CONF"
|
||||
echo "JETTY_PID = $JETTY_PID"
|
||||
echo "JETTY_START = $JETTY_START"
|
||||
echo "JETTY_ARGS = ${JETTY_ARGS[*]}"
|
||||
echo "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}"
|
||||
echo "JAVA = $JAVA"
|
||||
echo "RUN_CMD = ${RUN_CMD[*]}"
|
||||
dumpEnv
|
||||
fi
|
||||
|
||||
##################################################
|
||||
@ -434,7 +450,7 @@ case "$ACTION" in
|
||||
CH_USER="-c$JETTY_USER"
|
||||
fi
|
||||
|
||||
start-stop-daemon -S -p"$JETTY_PID" $CH_USER -d"$JETTY_BASE" -b -m -a "$JAVA" -- "${RUN_ARGS[@]}" start-log-file="$JETTY_RUN/start.log"
|
||||
start-stop-daemon -S -p"$JETTY_PID" $CH_USER -d"$JETTY_BASE" -b -m -a "$JAVA" -- "${RUN_ARGS[@]}" start-log-file="$JETTY_START_LOG"
|
||||
|
||||
else
|
||||
|
||||
@ -456,7 +472,7 @@ case "$ACTION" in
|
||||
chown "$JETTY_USER" "$JETTY_PID"
|
||||
# FIXME: Broken solution: wordsplitting, pathname expansion, arbitrary command execution, etc.
|
||||
su - "$JETTY_USER" $SU_SHELL -c "
|
||||
exec ${RUN_CMD[*]} start-log-file="$JETTY_RUN/start.log" > /dev/null &
|
||||
exec ${RUN_CMD[*]} start-log-file="$JETTY_START_LOG" > /dev/null &
|
||||
disown \$!
|
||||
echo \$! > '$JETTY_PID'"
|
||||
else
|
||||
@ -569,20 +585,7 @@ case "$ACTION" in
|
||||
echo "Jetty NOT running"
|
||||
fi
|
||||
echo
|
||||
echo "START_INI = $START_INI"
|
||||
echo "START_D = $START_D"
|
||||
echo "JETTY_HOME = $JETTY_HOME"
|
||||
echo "JETTY_BASE = $JETTY_BASE"
|
||||
echo "JETTY_CONF = $JETTY_CONF"
|
||||
echo "JETTY_PID = $JETTY_PID"
|
||||
echo "JETTY_START = $JETTY_START"
|
||||
echo "JETTY_LOGS = $JETTY_LOGS"
|
||||
echo "JETTY_STATE = $JETTY_STATE"
|
||||
echo "CLASSPATH = $CLASSPATH"
|
||||
echo "JAVA = $JAVA"
|
||||
echo "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}"
|
||||
echo "JETTY_ARGS = ${JETTY_ARGS[*]}"
|
||||
echo "RUN_CMD = ${RUN_CMD[*]}"
|
||||
dumpEnv
|
||||
echo
|
||||
|
||||
if running "$JETTY_PID"
|
||||
|
@ -55,8 +55,25 @@ public class HttpGenerator
|
||||
new MetaData.Response(HttpVersion.HTTP_1_1,INTERNAL_SERVER_ERROR_500,null,new HttpFields(){{put(HttpHeader.CONNECTION,HttpHeaderValue.CLOSE);}},0);
|
||||
|
||||
// states
|
||||
public enum State { START, COMMITTED, COMPLETING, COMPLETING_1XX, END }
|
||||
public enum Result { NEED_CHUNK,NEED_INFO,NEED_HEADER,NEED_CHUNK_TRAILER, FLUSH,CONTINUE,SHUTDOWN_OUT,DONE}
|
||||
public enum State
|
||||
{
|
||||
START,
|
||||
COMMITTED,
|
||||
COMPLETING,
|
||||
COMPLETING_1XX,
|
||||
END
|
||||
}
|
||||
public enum Result
|
||||
{
|
||||
NEED_CHUNK, // Need a small chunk buffer of CHUNK_SIZE
|
||||
NEED_INFO, // Need the request/response metadata info
|
||||
NEED_HEADER, // Need a buffer to build HTTP headers into
|
||||
NEED_CHUNK_TRAILER, // Need a large chunk buffer for last chunk and trailers
|
||||
FLUSH, // The buffers previously generated should be flushed
|
||||
CONTINUE, // Continue generating the message
|
||||
SHUTDOWN_OUT, // Need EOF to be signaled
|
||||
DONE // Message generation complete
|
||||
}
|
||||
|
||||
// other statics
|
||||
public static final int CHUNK_SIZE = 12;
|
||||
|
@ -88,8 +88,6 @@ public abstract class FillInterest
|
||||
|
||||
try
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} register {}",this,callback);
|
||||
needsFillInterest();
|
||||
}
|
||||
catch (Throwable e)
|
||||
|
@ -125,7 +125,7 @@ public class AsyncProxyServlet extends ProxyServlet
|
||||
return delegate.rewriteTarget(clientRequest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected class StreamReader extends IteratingCallback implements ReadListener
|
||||
{
|
||||
private final byte[] buffer = new byte[getHttpClient().getRequestBufferSize()];
|
||||
@ -133,6 +133,7 @@ public class AsyncProxyServlet extends ProxyServlet
|
||||
private final HttpServletResponse response;
|
||||
private final Request proxyRequest;
|
||||
private final DeferredContentProvider provider;
|
||||
|
||||
|
||||
protected StreamReader(HttpServletRequest request, HttpServletResponse response, Request proxyRequest, DeferredContentProvider provider)
|
||||
{
|
||||
@ -168,9 +169,7 @@ public class AsyncProxyServlet extends ProxyServlet
|
||||
int requestId = _log.isDebugEnabled() ? getRequestId(request) : 0;
|
||||
ServletInputStream input = request.getInputStream();
|
||||
|
||||
// First check for isReady() because it has
|
||||
// side effects, and then for isFinished().
|
||||
while (input.isReady() && !input.isFinished())
|
||||
while (input.isReady())
|
||||
{
|
||||
int read = input.read(buffer);
|
||||
if (_log.isDebugEnabled())
|
||||
@ -182,20 +181,17 @@ public class AsyncProxyServlet extends ProxyServlet
|
||||
onRequestContent(request, proxyRequest, provider, buffer, 0, read, this);
|
||||
return Action.SCHEDULED;
|
||||
}
|
||||
else if (read < 0)
|
||||
{
|
||||
if (_log.isDebugEnabled())
|
||||
_log.debug("{} asynchronous read complete on {}", requestId, input);
|
||||
return Action.SUCCEEDED;
|
||||
}
|
||||
}
|
||||
|
||||
if (input.isFinished())
|
||||
{
|
||||
if (_log.isDebugEnabled())
|
||||
_log.debug("{} asynchronous read complete on {}", requestId, input);
|
||||
return Action.SUCCEEDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_log.isDebugEnabled())
|
||||
_log.debug("{} asynchronous read pending on {}", requestId, input);
|
||||
return Action.IDLE;
|
||||
}
|
||||
if (_log.isDebugEnabled())
|
||||
_log.debug("{} asynchronous read pending on {}", requestId, input);
|
||||
return Action.IDLE;
|
||||
}
|
||||
|
||||
protected void onRequestContent(HttpServletRequest request, Request proxyRequest, DeferredContentProvider provider, byte[] buffer, int offset, int length, Callback callback)
|
||||
|
@ -52,18 +52,19 @@ import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class AsyncProxyServletLoadTest
|
||||
public class ProxyServletLoadTest
|
||||
{
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<Object[]> data()
|
||||
{
|
||||
return Arrays.asList(new Object[][]{
|
||||
{ProxyServlet.class},
|
||||
{AsyncProxyServlet.class},
|
||||
{AsyncMiddleManServlet.class}
|
||||
});
|
||||
}
|
||||
|
||||
private static final Logger LOG = Log.getLogger(AsyncProxyServletLoadTest.class);
|
||||
private static final Logger LOG = Log.getLogger(ProxyServletLoadTest.class);
|
||||
private static final String PROXIED_HEADER = "X-Proxied";
|
||||
|
||||
private HttpClient client;
|
||||
@ -73,7 +74,7 @@ public class AsyncProxyServletLoadTest
|
||||
private Server server;
|
||||
private ServerConnector serverConnector;
|
||||
|
||||
public AsyncProxyServletLoadTest(Class<?> proxyServletClass) throws Exception
|
||||
public ProxyServletLoadTest(Class<?> proxyServletClass) throws Exception
|
||||
{
|
||||
proxyServlet = (AbstractProxyServlet)proxyServletClass.newInstance();
|
||||
}
|
||||
@ -170,7 +171,7 @@ public class AsyncProxyServletLoadTest
|
||||
thread.start();
|
||||
}
|
||||
|
||||
Assert.assertTrue(activeClientLatch.await(clientCount * iterations * 10, TimeUnit.MILLISECONDS));
|
||||
Assert.assertTrue(activeClientLatch.await(Math.max(clientCount * iterations * 10, 5000), TimeUnit.MILLISECONDS));
|
||||
Assert.assertTrue(success.get());
|
||||
}
|
||||
|
||||
@ -211,7 +212,7 @@ public class AsyncProxyServletLoadTest
|
||||
|
||||
if (response.getStatus() != 200)
|
||||
{
|
||||
LOG.warn("Got response <{}>, expecting <{}>", response.getStatus(), 200);
|
||||
LOG.warn("Got response <{}>, expecting <{}> iteration=", response.getStatus(), 200,iterations);
|
||||
// allow all ClientLoops to finish
|
||||
success.set(false);
|
||||
}
|
||||
@ -224,7 +225,7 @@ public class AsyncProxyServletLoadTest
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
LOG.warn("Error processing request", x);
|
||||
LOG.warn("Error processing request "+iterations, x);
|
||||
success.set(false);
|
||||
}
|
||||
finally
|
@ -417,7 +417,12 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
||||
status == HttpStatus.NO_CONTENT_204 ||
|
||||
status == HttpStatus.NOT_MODIFIED_304);
|
||||
if (hasContent && !_response.isContentComplete(_response.getHttpOutput().getWritten()))
|
||||
_transport.abort(new IOException("insufficient content written"));
|
||||
{
|
||||
if (isCommitted())
|
||||
_transport.abort(new IOException("insufficient content written"));
|
||||
else
|
||||
_response.sendError(HttpStatus.INTERNAL_SERVER_ERROR_500,"insufficient content written");
|
||||
}
|
||||
}
|
||||
_response.closeOutput();
|
||||
_request.setHandled(true);
|
||||
|
@ -18,10 +18,6 @@
|
||||
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import static javax.servlet.RequestDispatcher.ERROR_EXCEPTION;
|
||||
import static javax.servlet.RequestDispatcher.ERROR_MESSAGE;
|
||||
import static javax.servlet.RequestDispatcher.ERROR_STATUS_CODE;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -42,6 +38,10 @@ import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Locker;
|
||||
import org.eclipse.jetty.util.thread.Scheduler;
|
||||
|
||||
import static javax.servlet.RequestDispatcher.ERROR_EXCEPTION;
|
||||
import static javax.servlet.RequestDispatcher.ERROR_MESSAGE;
|
||||
import static javax.servlet.RequestDispatcher.ERROR_STATUS_CODE;
|
||||
|
||||
/**
|
||||
* Implementation of AsyncContext interface that holds the state of request-response cycle.
|
||||
*/
|
||||
@ -87,7 +87,7 @@ public class HttpChannelState
|
||||
/**
|
||||
* The state of the servlet async API.
|
||||
*/
|
||||
public enum Async
|
||||
private enum Async
|
||||
{
|
||||
NOT_ASYNC,
|
||||
STARTED, // AsyncContext.startAsync() has been called
|
||||
@ -99,17 +99,31 @@ public class HttpChannelState
|
||||
ERRORED // The error has been processed
|
||||
}
|
||||
|
||||
private final boolean DEBUG=LOG.isDebugEnabled();
|
||||
private enum Interest
|
||||
{
|
||||
NONE(false),
|
||||
NEEDED(true),
|
||||
REGISTERED(true);
|
||||
|
||||
private final boolean _interested;
|
||||
|
||||
Interest(boolean interest)
|
||||
{
|
||||
_interested = interest;
|
||||
}
|
||||
|
||||
private boolean isInterested() { return _interested;}
|
||||
}
|
||||
|
||||
private final Locker _locker=new Locker();
|
||||
private final HttpChannel _channel;
|
||||
|
||||
private List<AsyncListener> _asyncListeners;
|
||||
private State _state;
|
||||
private Async _async;
|
||||
private boolean _initial;
|
||||
private boolean _asyncReadPossible;
|
||||
private boolean _asyncReadUnready;
|
||||
private boolean _asyncWrite; // TODO refactor same as read
|
||||
private Interest _asyncRead=Interest.NONE;
|
||||
private boolean _asyncWritePossible;
|
||||
private long _timeoutMs=DEFAULT_TIMEOUT;
|
||||
private AsyncContextEvent _event;
|
||||
|
||||
@ -174,9 +188,15 @@ public class HttpChannelState
|
||||
|
||||
public String toStringLocked()
|
||||
{
|
||||
return String.format("%s@%x{s=%s a=%s i=%b r=%s w=%b}",getClass().getSimpleName(),hashCode(),_state,_async,_initial,
|
||||
_asyncReadPossible?(_asyncReadUnready?"PU":"P!U"):(_asyncReadUnready?"!PU":"!P!U"),
|
||||
_asyncWrite);
|
||||
return String.format("%s@%x{s=%s a=%s i=%b r=%s/%s w=%b}",
|
||||
getClass().getSimpleName(),
|
||||
hashCode(),
|
||||
_state,
|
||||
_async,
|
||||
_initial,
|
||||
_asyncRead,
|
||||
_asyncReadPossible,
|
||||
_asyncWritePossible);
|
||||
}
|
||||
|
||||
|
||||
@ -200,7 +220,7 @@ public class HttpChannelState
|
||||
{
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("handling {}",toStringLocked());
|
||||
|
||||
switch(_state)
|
||||
@ -215,17 +235,17 @@ public class HttpChannelState
|
||||
return Action.TERMINATED;
|
||||
|
||||
case ASYNC_WOKEN:
|
||||
if (_asyncReadPossible)
|
||||
if (_asyncRead.isInterested() && _asyncReadPossible)
|
||||
{
|
||||
_state=State.ASYNC_IO;
|
||||
_asyncReadUnready=false;
|
||||
_asyncRead=Interest.NONE;
|
||||
return Action.READ_CALLBACK;
|
||||
}
|
||||
|
||||
if (_asyncWrite)
|
||||
if (_asyncWritePossible)
|
||||
{
|
||||
_state=State.ASYNC_IO;
|
||||
_asyncWrite=false;
|
||||
_asyncWritePossible=false;
|
||||
return Action.WRITE_CALLBACK;
|
||||
}
|
||||
|
||||
@ -275,7 +295,7 @@ public class HttpChannelState
|
||||
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("startAsync {}",toStringLocked());
|
||||
if (_state!=State.DISPATCHED || _async!=Async.NOT_ASYNC)
|
||||
throw new IllegalStateException(this.getStatusStringLocked());
|
||||
@ -317,7 +337,6 @@ public class HttpChannelState
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void asyncError(Throwable failure)
|
||||
{
|
||||
AsyncContextEvent event = null;
|
||||
@ -371,7 +390,7 @@ public class HttpChannelState
|
||||
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("unhandle {}",toStringLocked());
|
||||
|
||||
switch(_state)
|
||||
@ -409,24 +428,29 @@ public class HttpChannelState
|
||||
break;
|
||||
|
||||
case STARTED:
|
||||
if (_asyncReadUnready && _asyncReadPossible)
|
||||
// If a read is possible and either we are interested in reads or we have
|
||||
// to call onAllDataRead, then we need a READ_CALLBACK
|
||||
if (_asyncReadPossible && (_asyncRead.isInterested() || _channel.getRequest().getHttpInput().isAsyncEOF()))
|
||||
{
|
||||
_state=State.ASYNC_IO;
|
||||
_asyncReadUnready=false;
|
||||
action = Action.READ_CALLBACK;
|
||||
_asyncRead=Interest.NONE;
|
||||
action=Action.READ_CALLBACK;
|
||||
}
|
||||
else if (_asyncWrite) // TODO refactor same as read
|
||||
else if (_asyncWritePossible)
|
||||
{
|
||||
_asyncWrite=false;
|
||||
_state=State.ASYNC_IO;
|
||||
_asyncWritePossible=false;
|
||||
action=Action.WRITE_CALLBACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
_state=State.ASYNC_WAIT;
|
||||
action=Action.WAIT;
|
||||
if (_asyncReadUnready)
|
||||
if (_asyncRead==Interest.NEEDED)
|
||||
{
|
||||
_asyncRead=Interest.REGISTERED;
|
||||
read_interested=true;
|
||||
}
|
||||
Scheduler scheduler=_channel.getScheduler();
|
||||
if (scheduler!=null && _timeoutMs>0)
|
||||
_event.setTimeoutTask(scheduler.schedule(_event,_timeoutMs,TimeUnit.MILLISECONDS));
|
||||
@ -477,7 +501,7 @@ public class HttpChannelState
|
||||
AsyncContextEvent event;
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("dispatch {} -> {}",toStringLocked(),path);
|
||||
|
||||
boolean started=false;
|
||||
@ -531,7 +555,7 @@ public class HttpChannelState
|
||||
AsyncContextEvent event;
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onTimeout {}",toStringLocked());
|
||||
|
||||
if (_async!=Async.STARTED)
|
||||
@ -630,7 +654,7 @@ public class HttpChannelState
|
||||
AsyncContextEvent event;
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("complete {}",toStringLocked());
|
||||
|
||||
boolean started=false;
|
||||
@ -668,7 +692,7 @@ public class HttpChannelState
|
||||
{
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("error complete {}",toStringLocked());
|
||||
|
||||
_async=Async.COMPLETE;
|
||||
@ -703,7 +727,7 @@ public class HttpChannelState
|
||||
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onError {} {}",toStringLocked(),failure);
|
||||
|
||||
// Set error on request.
|
||||
@ -713,8 +737,7 @@ public class HttpChannelState
|
||||
_event.getSuppliedRequest().setAttribute(ERROR_STATUS_CODE,code);
|
||||
_event.getSuppliedRequest().setAttribute(ERROR_EXCEPTION,failure);
|
||||
_event.getSuppliedRequest().setAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE,failure==null?null:failure.getClass());
|
||||
|
||||
_event.getSuppliedRequest().setAttribute(ERROR_MESSAGE,reason!=null?reason:null);
|
||||
_event.getSuppliedRequest().setAttribute(ERROR_MESSAGE,reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -724,7 +747,7 @@ public class HttpChannelState
|
||||
baseRequest.setAttribute(ERROR_STATUS_CODE,code);
|
||||
baseRequest.setAttribute(ERROR_EXCEPTION,failure);
|
||||
baseRequest.setAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE,failure==null?null:failure.getClass());
|
||||
baseRequest.setAttribute(ERROR_MESSAGE,reason!=null?reason:null);
|
||||
baseRequest.setAttribute(ERROR_MESSAGE,reason);
|
||||
}
|
||||
|
||||
// Are we blocking?
|
||||
@ -821,7 +844,7 @@ public class HttpChannelState
|
||||
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onComplete {}",toStringLocked());
|
||||
|
||||
switch(_state)
|
||||
@ -878,7 +901,7 @@ public class HttpChannelState
|
||||
cancelTimeout();
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("recycle {}",toStringLocked());
|
||||
|
||||
switch(_state)
|
||||
@ -895,8 +918,9 @@ public class HttpChannelState
|
||||
_state=State.IDLE;
|
||||
_async=Async.NOT_ASYNC;
|
||||
_initial=true;
|
||||
_asyncReadPossible=_asyncReadUnready=false;
|
||||
_asyncWrite=false;
|
||||
_asyncReadPossible=false;
|
||||
_asyncRead=Interest.NONE;
|
||||
_asyncWritePossible=false;
|
||||
_timeoutMs=DEFAULT_TIMEOUT;
|
||||
_event=null;
|
||||
}
|
||||
@ -907,7 +931,7 @@ public class HttpChannelState
|
||||
cancelTimeout();
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("upgrade {}",toStringLocked());
|
||||
|
||||
switch(_state)
|
||||
@ -922,8 +946,9 @@ public class HttpChannelState
|
||||
_state=State.UPGRADED;
|
||||
_async=Async.NOT_ASYNC;
|
||||
_initial=true;
|
||||
_asyncReadPossible=_asyncReadUnready=false;
|
||||
_asyncWrite=false;
|
||||
_asyncReadPossible=false;
|
||||
_asyncRead=Interest.NONE;
|
||||
_asyncWritePossible=false;
|
||||
_timeoutMs=DEFAULT_TIMEOUT;
|
||||
_event=null;
|
||||
}
|
||||
@ -1096,9 +1121,8 @@ public class HttpChannelState
|
||||
_channel.getRequest().setAttribute(name,attribute);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Called to signal async read isReady() has returned false.
|
||||
/**
|
||||
* Called to signal async read isReady() has returned false.
|
||||
* This indicates that there is no content available to be consumed
|
||||
* and that once the channel enteres the ASYNC_WAIT state it will
|
||||
* register for read interest by calling {@link HttpChannel#asyncReadFillInterested()}
|
||||
@ -1109,16 +1133,20 @@ public class HttpChannelState
|
||||
boolean interested=false;
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onReadUnready {}",toStringLocked());
|
||||
|
||||
// We were already unready, this is not a state change, so do nothing
|
||||
if (!_asyncReadUnready)
|
||||
if (_asyncRead!=Interest.REGISTERED)
|
||||
{
|
||||
_asyncReadUnready=true;
|
||||
_asyncReadPossible=false; // Assumes this has been checked in isReady() with lock held
|
||||
if (_state==State.ASYNC_WAIT)
|
||||
{
|
||||
interested=true;
|
||||
_asyncRead=Interest.REGISTERED;
|
||||
}
|
||||
else
|
||||
_asyncRead=Interest.NEEDED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1126,8 +1154,8 @@ public class HttpChannelState
|
||||
_channel.asyncReadFillInterested();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Called to signal that content is now available to read.
|
||||
/**
|
||||
* Called to signal that content is now available to read.
|
||||
* If the channel is in ASYNC_WAIT state and unready (ie isReady() has
|
||||
* returned false), then the state is changed to ASYNC_WOKEN and true
|
||||
* is returned.
|
||||
@ -1138,11 +1166,11 @@ public class HttpChannelState
|
||||
boolean woken=false;
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onReadPossible {}",toStringLocked());
|
||||
|
||||
_asyncReadPossible=true;
|
||||
if (_state==State.ASYNC_WAIT && _asyncReadUnready)
|
||||
if (_state==State.ASYNC_WAIT && _asyncRead.isInterested())
|
||||
{
|
||||
woken=true;
|
||||
_state=State.ASYNC_WOKEN;
|
||||
@ -1151,8 +1179,8 @@ public class HttpChannelState
|
||||
return woken;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Called to signal that the channel is ready for a callback.
|
||||
/**
|
||||
* Called to signal that the channel is ready for a callback.
|
||||
* This is similar to calling {@link #onReadUnready()} followed by
|
||||
* {@link #onReadPossible()}, except that as content is already
|
||||
* available, read interest is never set.
|
||||
@ -1163,10 +1191,10 @@ public class HttpChannelState
|
||||
boolean woken=false;
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onReadReady {}",toStringLocked());
|
||||
|
||||
_asyncReadUnready=true;
|
||||
_asyncRead=Interest.REGISTERED;
|
||||
_asyncReadPossible=true;
|
||||
if (_state==State.ASYNC_WAIT)
|
||||
{
|
||||
@ -1177,8 +1205,8 @@ public class HttpChannelState
|
||||
return woken;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Called to signal that a read has read -1.
|
||||
/**
|
||||
* Called to signal that a read has read -1.
|
||||
* Will wake if the read was called while in ASYNC_WAIT state
|
||||
* @return true if woken
|
||||
*/
|
||||
@ -1187,21 +1215,20 @@ public class HttpChannelState
|
||||
boolean woken=false;
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onReadEof {}",toStringLocked());
|
||||
|
||||
|
||||
if (_state==State.ASYNC_WAIT)
|
||||
{
|
||||
_state=State.ASYNC_WOKEN;
|
||||
_asyncReadUnready=true;
|
||||
_asyncReadPossible=true;
|
||||
woken=true;
|
||||
_state=State.ASYNC_WOKEN;
|
||||
_asyncRead=Interest.REGISTERED;
|
||||
_asyncReadPossible=true;
|
||||
}
|
||||
}
|
||||
return woken;
|
||||
}
|
||||
|
||||
|
||||
public boolean isReadPossible()
|
||||
{
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
@ -1216,10 +1243,10 @@ public class HttpChannelState
|
||||
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if(DEBUG)
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onWritePossible {}",toStringLocked());
|
||||
|
||||
_asyncWrite=true;
|
||||
_asyncWritePossible=true;
|
||||
if (_state==State.ASYNC_WAIT)
|
||||
{
|
||||
_state=State.ASYNC_WOKEN;
|
||||
@ -1229,5 +1256,4 @@ public class HttpChannelState
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||
{
|
||||
int filled = fillRequestBuffer();
|
||||
handled = parseRequestBuffer();
|
||||
if (handled || filled<=0 || _channel.getRequest().getHttpInput().hasContent())
|
||||
if (handled || filled<=0 || _input.hasContent())
|
||||
break;
|
||||
}
|
||||
return handled;
|
||||
@ -398,7 +398,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||
else if (_parser.inContentState() && _generator.isPersistent())
|
||||
{
|
||||
// If we are async, then we have problems to complete neatly
|
||||
if (_channel.getRequest().getHttpInput().isAsync())
|
||||
if (_input.isAsync())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("unconsumed async input {}", this);
|
||||
@ -409,7 +409,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("unconsumed input {}", this);
|
||||
// Complete reading the request
|
||||
if (!_channel.getRequest().getHttpInput().consumeAll())
|
||||
if (!_input.consumeAll())
|
||||
_channel.abort(new IOException("unconsumed input"));
|
||||
}
|
||||
}
|
||||
@ -627,7 +627,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||
{
|
||||
if (fillAndParseForContent())
|
||||
_channel.handle();
|
||||
else if (!_input.isFinished())
|
||||
else if (!_input.isFinished() && !_input.hasContent())
|
||||
asyncReadFillInterested();
|
||||
}
|
||||
|
||||
|
@ -709,6 +709,14 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAsyncEOF()
|
||||
{
|
||||
synchronized (_inputQ)
|
||||
{
|
||||
return _state == AEOF;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady()
|
||||
{
|
||||
@ -1121,4 +1129,5 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||
return "AEOF";
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1215,7 +1215,9 @@ public class Response implements HttpServletResponse
|
||||
|
||||
protected MetaData.Response newResponseMetaData()
|
||||
{
|
||||
return new MetaData.Response(_channel.getRequest().getHttpVersion(), getStatus(), getReason(), _fields, getLongContentLength());
|
||||
MetaData.Response info = new MetaData.Response(_channel.getRequest().getHttpVersion(), getStatus(), getReason(), _fields, getLongContentLength());
|
||||
// TODO info.setTrailerSupplier(trailers);
|
||||
return info;
|
||||
}
|
||||
|
||||
/** Get the MetaData.Response committed for this response.
|
||||
|
@ -300,8 +300,6 @@ public class ServerConnector extends AbstractNetworkConnector
|
||||
_localPort = serverChannel.socket().getLocalPort();
|
||||
if (_localPort <= 0)
|
||||
throw new IOException("Server channel not bound");
|
||||
|
||||
addBean(serverChannel);
|
||||
}
|
||||
|
||||
serverChannel.configureBlocking(true);
|
||||
|
@ -761,7 +761,18 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||
throw new IllegalStateException("Null contextPath");
|
||||
|
||||
if (_logger==null)
|
||||
_logger = Log.getLogger(getDisplayName() == null?getContextPath():getDisplayName());
|
||||
{
|
||||
String log_name = getDisplayName();
|
||||
if (log_name == null || log_name.isEmpty())
|
||||
{
|
||||
log_name = getContextPath();
|
||||
if (log_name!=null || log_name.startsWith("/"))
|
||||
log_name = log_name.substring(1);
|
||||
if (log_name==null || log_name.isEmpty())
|
||||
log_name = Integer.toHexString(hashCode());
|
||||
}
|
||||
_logger = Log.getLogger("org.eclipse.jetty.ContextHandler."+log_name);
|
||||
}
|
||||
ClassLoader old_classloader = null;
|
||||
Thread current_thread = null;
|
||||
Context old_context = null;
|
||||
|
@ -20,20 +20,20 @@
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
/**
|
||||
* EvictionFailureTest
|
||||
* NullSessionDataStoreFactory
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class EvictionFailureTest extends AbstractSessionEvictionFailureTest
|
||||
public class NullSessionDataStoreFactory extends AbstractSessionDataStoreFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.SessionDataStoreFactory#getSessionDataStore(org.eclipse.jetty.server.session.SessionHandler)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactive, int scavengeInterval, int evictionPolicy) throws Exception
|
||||
public SessionDataStore getSessionDataStore(SessionHandler handler) throws Exception
|
||||
{
|
||||
return new HashTestServer(port, maxInactive, scavengeInterval, evictionPolicy);
|
||||
return new NullSessionDataStore();
|
||||
}
|
||||
|
||||
}
|
@ -844,36 +844,14 @@ public class Session implements SessionHandler.SessionIf
|
||||
if (_handler == null)
|
||||
throw new IllegalStateException ("No session manager for session "+ _sessionData.getId());
|
||||
|
||||
boolean result = false;
|
||||
|
||||
try (Lock lock = _lock.lockIfNotHeld())
|
||||
{
|
||||
switch (_state)
|
||||
{
|
||||
case INVALID:
|
||||
{
|
||||
throw new IllegalStateException(); //spec does not allow invalidate of already invalid session
|
||||
}
|
||||
case VALID:
|
||||
{
|
||||
//only first change from valid to invalidating should be actionable
|
||||
result = true;
|
||||
_state = State.INVALIDATING;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOG.info("Session {} already being invalidated", _sessionData.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean result = beginInvalidate();
|
||||
|
||||
try
|
||||
{
|
||||
//if the session was not already invalid, or in process of being invalidated, do invalidate
|
||||
if (result)
|
||||
{
|
||||
//tell id mgr to remove session from all other contexts
|
||||
//tell id mgr to remove session from all contexts
|
||||
_handler.getSessionIdManager().invalidateAll(_sessionData.getId());
|
||||
}
|
||||
}
|
||||
@ -901,6 +879,39 @@ public class Session implements SessionHandler.SessionIf
|
||||
{
|
||||
return _lock.lockIfNotHeld();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/**
|
||||
* @return true if the session is not already invalid or being invalidated.
|
||||
*/
|
||||
protected boolean beginInvalidate()
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
try (Lock lock = _lock.lockIfNotHeld())
|
||||
{
|
||||
switch (_state)
|
||||
{
|
||||
case INVALID:
|
||||
{
|
||||
throw new IllegalStateException(); //spec does not allow invalidate of already invalid session
|
||||
}
|
||||
case VALID:
|
||||
{
|
||||
//only first change from valid to invalidating should be actionable
|
||||
result = true;
|
||||
_state = State.INVALIDATING;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOG.info("Session {} already being invalidated", _sessionData.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/** Call HttpSessionAttributeListeners as part of invalidating
|
||||
@ -908,7 +919,20 @@ public class Session implements SessionHandler.SessionIf
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
*/
|
||||
@Deprecated
|
||||
protected void doInvalidate() throws IllegalStateException
|
||||
{
|
||||
finishInvalidate();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/** Call HttpSessionAttributeListeners as part of invalidating
|
||||
* a Session.
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
*/
|
||||
protected void finishInvalidate() throws IllegalStateException
|
||||
{
|
||||
try (Lock lock = _lock.lockIfNotHeld())
|
||||
{
|
||||
|
@ -1048,6 +1048,8 @@ public class SessionHandler extends ScopedHandler
|
||||
{
|
||||
if (invalidate)
|
||||
{
|
||||
session.beginInvalidate();
|
||||
|
||||
if (_sessionListeners!=null)
|
||||
{
|
||||
HttpSessionEvent event=new HttpSessionEvent(session);
|
||||
@ -1214,8 +1216,7 @@ public class SessionHandler extends ScopedHandler
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Called either when a session has expired, or the app has
|
||||
* invalidated it.
|
||||
* Called when a session has expired.
|
||||
*
|
||||
* @param id the id to invalidate
|
||||
*/
|
||||
@ -1232,7 +1233,7 @@ public class SessionHandler extends ScopedHandler
|
||||
if (session != null)
|
||||
{
|
||||
_sessionTimeStats.set(round((System.currentTimeMillis() - session.getSessionData().getCreated())/1000.0));
|
||||
session.doInvalidate();
|
||||
session.finishInvalidate();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -1242,7 +1243,11 @@ public class SessionHandler extends ScopedHandler
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Called periodically by the HouseKeeper to handle the list of
|
||||
* sessions that have expired since the last call to scavenge.
|
||||
*/
|
||||
public void scavenge ()
|
||||
{
|
||||
//don't attempt to scavenge if we are shutting down
|
||||
@ -1279,7 +1284,7 @@ public class SessionHandler extends ScopedHandler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Each session has a timer that is configured to go off
|
||||
* when either the session has not been accessed for a
|
||||
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.server;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@ -442,10 +443,22 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
||||
server.start();
|
||||
|
||||
HttpTester.Response response = executeRequest();
|
||||
assertThat("response has no status", response.getStatus(), is(0));
|
||||
assertThat("response is error", response.getStatus(), is(500));
|
||||
assertFalse("response not eof", response.isEarlyEOF());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetContentLengthAndFlushWriteInsufficientBytes() throws Exception
|
||||
{
|
||||
server.setHandler(new SetContentLengthAndWriteInsufficientBytesHandler(true));
|
||||
server.start();
|
||||
|
||||
HttpTester.Response response = executeRequest();
|
||||
assertThat("response has no status", response.getStatus(), is(200));
|
||||
assertTrue("response eof", response.isEarlyEOF());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSetContentLengthAndWriteExactlyThatAmountOfBytes() throws Exception
|
||||
{
|
||||
|
@ -19,8 +19,10 @@
|
||||
package org.eclipse.jetty.util;
|
||||
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.JDK;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TypeUtilTest
|
||||
@ -124,8 +126,18 @@ public class TypeUtilTest
|
||||
@Test
|
||||
public void testLoadedFrom() throws Exception
|
||||
{
|
||||
Assume.assumeFalse(JDK.IS_9);
|
||||
Assert.assertThat(TypeUtil.getLoadedFrom(String.class).toString(),Matchers.containsString("/rt.jar"));
|
||||
Assert.assertThat(TypeUtil.getLoadedFrom(Assert.class).toString(),Matchers.containsString(".jar"));
|
||||
Assert.assertThat(TypeUtil.getLoadedFrom(TypeUtil.class).toString(),Matchers.containsString("/classes/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadedFrom9() throws Exception
|
||||
{
|
||||
Assume.assumeTrue(JDK.IS_9);
|
||||
Assert.assertThat(TypeUtil.getLoadedFrom(String.class).toString(),Matchers.containsString("jrt:/java.base/java/lang/String.clas"));
|
||||
Assert.assertThat(TypeUtil.getLoadedFrom(Assert.class).toString(),Matchers.containsString(".jar"));
|
||||
Assert.assertThat(TypeUtil.getLoadedFrom(TypeUtil.class).toString(),Matchers.containsString("/classes/"));
|
||||
}
|
||||
}
|
||||
|
@ -18,15 +18,21 @@
|
||||
|
||||
package org.eclipse.jetty.http.client;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Deque;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@ -49,6 +55,7 @@ import org.eclipse.jetty.client.api.Result;
|
||||
import org.eclipse.jetty.client.http.HttpConnectionOverHTTP;
|
||||
import org.eclipse.jetty.client.util.BufferingResponseListener;
|
||||
import org.eclipse.jetty.client.util.DeferredContentProvider;
|
||||
import org.eclipse.jetty.client.util.InputStreamContentProvider;
|
||||
import org.eclipse.jetty.client.util.StringContentProvider;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
@ -135,7 +142,7 @@ public class AsyncIOServletTest extends AbstractTest
|
||||
scope.set(null);
|
||||
}
|
||||
|
||||
private void sleep(long ms) throws IOException
|
||||
private void sleep(long ms)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -143,7 +150,7 @@ public class AsyncIOServletTest extends AbstractTest
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
throw new InterruptedIOException();
|
||||
throw new UncheckedIOException(new InterruptedIOException());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1245,7 +1252,7 @@ public class AsyncIOServletTest extends AbstractTest
|
||||
@Override
|
||||
public void onDataAvailable() throws IOException
|
||||
{
|
||||
while (input.isReady() && !input.isFinished())
|
||||
while (input.isReady())
|
||||
{
|
||||
int b = input.read();
|
||||
if (b>0)
|
||||
@ -1253,8 +1260,8 @@ public class AsyncIOServletTest extends AbstractTest
|
||||
// System.err.printf("0x%2x %s %n", b, Character.isISOControl(b)?"?":(""+(char)b));
|
||||
out.write(b);
|
||||
}
|
||||
else
|
||||
onAllDataRead();
|
||||
else if (b<0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1324,5 +1331,136 @@ public class AsyncIOServletTest extends AbstractTest
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testWriteListenerFromOtherThread() throws Exception
|
||||
{
|
||||
start(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
AsyncContext asyncContext = request.startAsync();
|
||||
asyncContext.setTimeout(0);
|
||||
request.getInputStream().setReadListener(new Listener(asyncContext));
|
||||
}
|
||||
});
|
||||
|
||||
int cores = 4;
|
||||
int iterations = 10;
|
||||
CountDownLatch latch = new CountDownLatch(cores * iterations);
|
||||
Deque<Throwable> failures = new LinkedBlockingDeque<>();
|
||||
for (int i = 0; i < cores; ++i)
|
||||
{
|
||||
client.getExecutor().execute(() ->
|
||||
{
|
||||
for (int j = 0; j < iterations; ++j)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentResponse response = client.newRequest(newURI())
|
||||
.method(HttpMethod.POST)
|
||||
.path(servletPath)
|
||||
.content(new InputStreamContentProvider(new ByteArrayInputStream(new byte[16 * 1024])
|
||||
{
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len)
|
||||
{
|
||||
sleep(5);
|
||||
return super.read(b, off, Math.min(len, 4242));
|
||||
}
|
||||
}))
|
||||
.send();
|
||||
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
|
||||
latch.countDown();
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
failures.offer(x);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Assert.assertTrue(latch.await(30, TimeUnit.SECONDS));
|
||||
Assert.assertTrue(failures.isEmpty());
|
||||
}
|
||||
|
||||
private class Listener implements ReadListener, WriteListener
|
||||
{
|
||||
private final Executor executor = Executors.newFixedThreadPool(32);
|
||||
private final CompletableFuture<?> inputComplete = new CompletableFuture<>();
|
||||
private final CompletableFuture<?> outputComplete = new CompletableFuture<>();
|
||||
private final AtomicBoolean responseWritten = new AtomicBoolean();
|
||||
private final AsyncContext asyncContext;
|
||||
private final HttpServletResponse response;
|
||||
private final ServletInputStream input;
|
||||
private final ServletOutputStream output;
|
||||
|
||||
public Listener(AsyncContext asyncContext) throws IOException
|
||||
{
|
||||
this.asyncContext = asyncContext;
|
||||
this.response = (HttpServletResponse)asyncContext.getResponse();
|
||||
this.input = asyncContext.getRequest().getInputStream();
|
||||
this.output = response.getOutputStream();
|
||||
CompletableFuture.allOf(inputComplete, outputComplete)
|
||||
.whenComplete((ignoredResult, ignoredThrowable) -> asyncContext.complete());
|
||||
// Dispatch setting the write listener to another thread.
|
||||
executor.execute(() -> output.setWriteListener(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataAvailable() throws IOException
|
||||
{
|
||||
byte[] buffer = new byte[16 * 1024];
|
||||
while (input.isReady())
|
||||
{
|
||||
if (input.read(buffer) < 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAllDataRead() throws IOException
|
||||
{
|
||||
inputComplete.complete(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWritePossible() throws IOException
|
||||
{
|
||||
// Dispatch OWP to another thread.
|
||||
executor.execute(() ->
|
||||
{
|
||||
while (output.isReady())
|
||||
{
|
||||
if (responseWritten.compareAndSet(false, true))
|
||||
{
|
||||
try
|
||||
{
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.setContentType("text/plain;charset=utf-8");
|
||||
output.write("Hello world".getBytes());
|
||||
}
|
||||
catch (IOException x)
|
||||
{
|
||||
throw new UncheckedIOException(x);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outputComplete.complete(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t)
|
||||
{
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
asyncContext.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(final int port, final int max, final int scavenge, final int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
}
|
@ -23,27 +23,32 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* OrphanedSessionTest
|
||||
* ClusteredOrphanedSessionTest
|
||||
*/
|
||||
public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
||||
public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessionTest
|
||||
{
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
FileTestHelper.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
FileTestHelper.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return FileTestHelper.newSessionDataStoreFactory();
|
||||
}
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOrphanedSession() throws Exception
|
||||
{
|
@ -19,19 +19,19 @@
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.server.SessionIdManager;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
|
||||
/**
|
||||
* @version $Revision$ $Date$
|
||||
* FileTestHelper
|
||||
*
|
||||
*/
|
||||
public class FileTestServer extends AbstractTestServer
|
||||
public class FileTestHelper
|
||||
{
|
||||
static int __workers=0;
|
||||
static File _tmpDir;
|
||||
@ -118,34 +118,11 @@ public class FileTestServer extends AbstractTestServer
|
||||
assertTrue(f.delete());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public FileTestServer(int port, int maxInactivePeriod, int scavengePeriod, int idlePassivatePeriod) throws Exception
|
||||
|
||||
public static FileSessionDataStoreFactory newSessionDataStoreFactory()
|
||||
{
|
||||
super(port, maxInactivePeriod, scavengePeriod, idlePassivatePeriod);
|
||||
FileSessionDataStoreFactory storeFactory = new FileSessionDataStoreFactory();
|
||||
storeFactory.setStoreDir(_tmpDir);
|
||||
return storeFactory;
|
||||
}
|
||||
|
||||
|
||||
public SessionIdManager newSessionIdManager(Object config)
|
||||
{
|
||||
DefaultSessionIdManager mgr = new DefaultSessionIdManager(_server);
|
||||
mgr.setWorkerName("worker"+(__workers++));
|
||||
return mgr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler handler = new TestSessionHandler();
|
||||
DefaultSessionCache ss = new DefaultSessionCache(handler);
|
||||
handler.setSessionCache(ss);
|
||||
FileSessionDataStore ds = new FileSessionDataStore();
|
||||
ds.setStoreDir(_tmpDir);
|
||||
ss.setSessionDataStore(ds);
|
||||
return handler;
|
||||
}
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ForwardedSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
||||
{
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(final int port, final int max, final int scavenge, final int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testSessionCreateInForward() throws Exception
|
||||
{
|
||||
super.testSessionCreateInForward();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
/**
|
||||
* IdleSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class IdleSessionTest extends AbstractIdleSessionTest
|
||||
{
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractIdleSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(final int port, final int max, final int scavenge, final int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractIdleSessionTest#checkSessionIdled(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void checkSessionIdled(String sessionId)
|
||||
{
|
||||
FileTestServer.assertStoreDirEmpty(false);
|
||||
FileTestServer.assertFileExists(sessionId, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractIdleSessionTest#checkSessionDeIdled(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void checkSessionDeIdled(String sessionId)
|
||||
{
|
||||
//Can't check absence of file to indicate session is de-idled
|
||||
//because the FileSessionDataStore writes out the session to a file if anything changes.
|
||||
//The test changes an attribute so the file will probably exist.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractIdleSessionTest#deleteSessionData(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void deleteSessionData(String sessionId)
|
||||
{
|
||||
FileTestServer.deleteFile(sessionId);
|
||||
FileTestServer.assertFileExists(sessionId, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ImmediateSaveTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ImmediateSaveTest extends AbstractImmediateSaveTest
|
||||
{
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{ return new FileTestServer(port, max, scavenge, evictionPolicy)
|
||||
{
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler h = super.newSessionHandler();
|
||||
h.getSessionCache().setSaveOnCreate(true);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
}
|
@ -23,26 +23,32 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* NewSessionTest
|
||||
* NonClusteredSessionScavengingTest
|
||||
*/
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
public class NonClusteredSessionScavengingTest extends AbstractNonClusteredSessionScavengingTest
|
||||
{
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
System.setProperty("org.eclipse.jetty.server.session.LEVEL", "DEBUG");
|
||||
FileTestServer.setup();
|
||||
FileTestHelper.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
FileTestHelper.teardown();
|
||||
}
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge,evictionPolicy);
|
||||
return FileTestHelper.newSessionDataStoreFactory();
|
||||
}
|
||||
|
||||
@Test
|
@ -19,10 +19,7 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -38,25 +35,25 @@ public class ProxySerializationTest extends AbstractProxySerializationTest
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
FileTestHelper.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
FileTestHelper.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractProxySerializationTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy ) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge, evictionPolicy);
|
||||
return FileTestHelper.newSessionDataStoreFactory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ReentrantRequestSessionTest
|
||||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port, max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReentrantRequestSession() throws Exception
|
||||
{
|
||||
super.testReentrantRequestSession();
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RemoveSessionTest extends AbstractRemoveSessionTest
|
||||
{
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveSession() throws Exception
|
||||
{
|
||||
super.testRemoveSession();
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ScatterGunLoadTest
|
||||
*/
|
||||
public class ScatterGunLoadTest extends AbstractScatterGunLoadTest
|
||||
{
|
||||
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(final int port, final int max, final int scavenge, final int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testLightLoad() throws Exception
|
||||
{
|
||||
super.testLightLoad();
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
|
||||
{
|
||||
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(final int port, final int max, final int scavenge, final int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
public class SessionCookieTest extends AbstractSessionCookieTest
|
||||
{
|
||||
|
||||
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port, max, scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
}
|
@ -22,25 +22,29 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAndCreateTest
|
||||
public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalidateCreateScavengeTest
|
||||
{
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
FileTestHelper.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
FileTestHelper.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge,evictionPolicy);
|
||||
return FileTestHelper.newSessionDataStoreFactory();
|
||||
}
|
||||
|
||||
@Test
|
@ -1,66 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SessionRenewTest extends AbstractSessionRenewTest
|
||||
{
|
||||
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port, max, scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSessionRenewal() throws Exception
|
||||
{
|
||||
super.testSessionRenewal();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionRenewTest#verifyChange(WebAppContext, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean verifyChange(WebAppContext context, String oldSessionId, String newSessionId)
|
||||
{
|
||||
((FileTestServer)_server).assertFileExists(oldSessionId, false);
|
||||
((FileTestServer)_server).assertFileExists(newSessionId, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
public class SessionValueSharedSaving extends AbstractSessionValueSavingTest
|
||||
{
|
||||
|
||||
@Before
|
||||
public void before() throws Exception
|
||||
{
|
||||
FileTestServer.setup();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
FileTestServer.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new FileTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractClientCrossContextSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ClientCrossContextSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
}
|
@ -19,18 +19,17 @@
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractLastAccessTimeTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredLastAccessTimeTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* LastAccessTimeTest
|
||||
* ClusteredLastAccessTimeTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
public class ClusteredLastAccessTimeTest extends AbstractClusteredLastAccessTimeTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
@ -38,13 +37,15 @@ public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractLastAccessTimeTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
@Test
|
@ -19,18 +19,17 @@
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractOrphanedSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredOrphanedSessionTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* OrphanedSessionTest
|
||||
* ClusteredOrphanedSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
||||
public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessionTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
@ -40,14 +39,16 @@ public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractOrphanedSessionTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Override
|
@ -19,18 +19,17 @@
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSessionMigrationTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredSessionMigrationTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* SessionMigrationTest
|
||||
* ClusteredSessionMigrationTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionMigrationTest extends AbstractSessionMigrationTest
|
||||
public class ClusteredSessionMigrationTest extends AbstractClusteredSessionMigrationTest
|
||||
{
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
@ -38,14 +37,14 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionMigrationTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy);
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
@Test
|
@ -19,18 +19,17 @@
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractLocalSessionScavengingTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredSessionScavengingTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* LocalSessionScavengingTest
|
||||
* ClusteredSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTest
|
||||
public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
@ -39,13 +38,14 @@ public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTe
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractLocalSessionScavengingTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
@Test
|
@ -27,6 +27,10 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.server.session.SessionDataStore;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import com.google.cloud.datastore.Datastore;
|
||||
import com.google.cloud.datastore.DatastoreOptions;
|
||||
import com.google.cloud.datastore.Entity;
|
||||
@ -47,7 +51,31 @@ public class GCloudSessionTestSupport
|
||||
LocalDatastoreHelper _helper = LocalDatastoreHelper.create(1.0);
|
||||
Datastore _ds;
|
||||
|
||||
|
||||
public static class TestGCloudSessionDataStoreFactory extends GCloudSessionDataStoreFactory
|
||||
{
|
||||
Datastore _d;
|
||||
|
||||
public TestGCloudSessionDataStoreFactory(Datastore d)
|
||||
{
|
||||
_d = d;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.gcloud.session.GCloudSessionDataStoreFactory#getSessionDataStore(org.eclipse.jetty.server.session.SessionHandler)
|
||||
*/
|
||||
@Override
|
||||
public SessionDataStore getSessionDataStore(SessionHandler handler) throws Exception
|
||||
{
|
||||
GCloudSessionDataStore ds = new GCloudSessionDataStore();
|
||||
ds.setDatastore(_d);
|
||||
return ds;
|
||||
}
|
||||
|
||||
}
|
||||
public static GCloudSessionDataStoreFactory newSessionDataStoreFactory(Datastore d)
|
||||
{
|
||||
return new TestGCloudSessionDataStoreFactory(d);
|
||||
}
|
||||
|
||||
public GCloudSessionTestSupport ()
|
||||
{
|
||||
@ -73,10 +101,15 @@ public class GCloudSessionTestSupport
|
||||
public void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
_helper.stop();
|
||||
_helper.stop(Duration.standardMinutes(1)); //wait up to 1min for shutdown
|
||||
}
|
||||
|
||||
|
||||
public void reset() throws Exception
|
||||
{
|
||||
_helper.reset();
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getSessionIds () throws Exception
|
||||
{
|
||||
|
@ -1,65 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.DefaultSessionCache;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.eclipse.jetty.server.session.TestSessionHandler;
|
||||
|
||||
/**
|
||||
* GCloudTestServer
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class GCloudTestServer extends AbstractTestServer
|
||||
{
|
||||
|
||||
/**
|
||||
* @param port
|
||||
* @param maxInactivePeriod
|
||||
* @param scavengePeriod
|
||||
* @param evictionPolicy
|
||||
* @throws Exception TODO
|
||||
*/
|
||||
public GCloudTestServer(int port, int maxInactivePeriod, int scavengePeriod, int evictionPolicy) throws Exception
|
||||
{
|
||||
super(port, maxInactivePeriod, scavengePeriod, evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestServer#newSessionHandler()
|
||||
*/
|
||||
@Override
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler handler = new TestSessionHandler();
|
||||
handler.setSessionIdManager(_sessionIdManager);
|
||||
GCloudSessionDataStore ds = new GCloudSessionDataStore();
|
||||
ds.setDatastore(GCloudTestSuite.__testSupport.getDatastore());
|
||||
DefaultSessionCache ss = new DefaultSessionCache(handler);
|
||||
ss.setSessionDataStore(ds);
|
||||
handler.setSessionCache(ss);
|
||||
return handler;
|
||||
}
|
||||
|
||||
}
|
@ -31,25 +31,15 @@ import org.junit.runners.Suite;
|
||||
*/
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
ClientCrossContextSessionTest.class,
|
||||
ForwardedSessionTest.class,
|
||||
ImmediateSaveTest.class,
|
||||
ImmortalSessionTest.class,
|
||||
InvalidationSessionTest.class,
|
||||
LastAccessTimeTest.class,
|
||||
LocalSessionScavengingTest.class,
|
||||
NewSessionTest.class,
|
||||
OrphanedSessionTest.class,
|
||||
ReentrantRequestSessionTest.class,
|
||||
RemoveSessionTest.class,
|
||||
SameNodeLoadTest.class,
|
||||
ServerCrossContextSessionTest.class,
|
||||
ClusteredLastAccessTimeTest.class,
|
||||
ClusteredSessionScavengingTest.class,
|
||||
NonClusteredSessionScavengingTest.class,
|
||||
ClusteredOrphanedSessionTest.class,
|
||||
SessionExpiryTest.class,
|
||||
SessionInvalidateAndCreateTest.class,
|
||||
SessionMigrationTest.class,
|
||||
SessionRenewTest.class,
|
||||
SessionValueSavingTest.class,
|
||||
StopSessionManagerPreserveSessionTest.class
|
||||
SessionInvalidateCreateScavengeTest.class,
|
||||
ClusteredSessionMigrationTest.class,
|
||||
ModifyMaxInactiveIntervalTest.class
|
||||
})
|
||||
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractImmediateSaveTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ImmediateSaveTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ImmediateSaveTest extends AbstractImmediateSaveTest
|
||||
{
|
||||
|
||||
@After
|
||||
public void deleteSessions () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy)
|
||||
{
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler h = super.newSessionHandler();
|
||||
h.getSessionCache().setSaveOnCreate(true);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractImmortalSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ImmortalSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractImmortalSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testImmortalSession() throws Exception
|
||||
{
|
||||
super.testImmortalSession();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -20,19 +20,16 @@
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractInvalidationSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredInvalidationSessionTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
* InvalidationSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
||||
public class InvalidationSessionTest extends AbstractClusteredInvalidationSessionTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
@ -40,28 +37,13 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractInvalidationSessionTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactive, int scavengeInterval, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
GCloudTestServer server = new GCloudTestServer(port, maxInactive, scavengeInterval, evictionPolicy)
|
||||
{
|
||||
/**
|
||||
* @see org.eclipse.jetty.gcloud.session.GCloudTestServer#newSessionHandler()
|
||||
*/
|
||||
@Override
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler handler = super.newSessionHandler();
|
||||
handler.getSessionCache().setEvictionPolicy(evictionPolicy);
|
||||
return handler;
|
||||
}
|
||||
|
||||
};
|
||||
return server;
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,30 +19,32 @@
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractForwardedSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.eclipse.jetty.server.session.AbstractModifyMaxInactiveIntervalTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.After;
|
||||
|
||||
/**
|
||||
* ForwardedSessionTest
|
||||
* ModifyMaxInactiveIntervalTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
||||
public class ModifyMaxInactiveIntervalTest extends AbstractModifyMaxInactiveIntervalTest
|
||||
{
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
@After
|
||||
public void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy);
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
}
|
@ -19,23 +19,17 @@
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractNewSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.AbstractNonClusteredSessionScavengingTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* NewSessionTest
|
||||
* NonClusteredSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
public class NonClusteredSessionScavengingTest extends AbstractNonClusteredSessionScavengingTest
|
||||
{
|
||||
|
||||
|
||||
@ -46,14 +40,16 @@ public class NewSessionTest extends AbstractNewSessionTest
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractNewSessionTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNewSession() throws Exception
|
@ -1,60 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractReentrantRequestSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ReentrantRequestSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractReentrantRequestSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port,int max, int scavengePeriod,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavengePeriod, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testReentrantRequestSession() throws Exception
|
||||
{
|
||||
super.testReentrantRequestSession();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractRemoveSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* RemoveSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoveSessionTest extends AbstractRemoveSessionTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractRemoveSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testRemoveSession() throws Exception
|
||||
{
|
||||
super.testRemoveSession();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSameNodeLoadTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* SameNodeLoadTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SameNodeLoadTest extends AbstractSameNodeLoadTest
|
||||
{
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSameNodeLoadTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testLoad() throws Exception
|
||||
{
|
||||
super.testLoad();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractServerCrossContextSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ServerCrossContextSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
|
||||
{
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -20,13 +20,11 @@
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSessionExpiryTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.After;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
@ -37,42 +35,24 @@ import org.junit.Assert;
|
||||
public class SessionExpiryTest extends AbstractSessionExpiryTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
@After
|
||||
public void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionExpiryTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSessionNotExpired() throws Exception
|
||||
{
|
||||
super.testSessionNotExpired();
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionExpiryTest#testSessionExpiry()
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Test
|
||||
@Override
|
||||
public void testSessionExpiry() throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
super.testSessionExpiry();
|
||||
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void verifySessionCreated(TestHttpSessionListener listener, String sessionId)
|
||||
{
|
||||
@ -80,6 +60,9 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
||||
try {GCloudTestSuite.__testSupport.assertSessions(1);}catch(Exception e){ Assert.fail(e.getMessage());}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void verifySessionDestroyed(TestHttpSessionListener listener, String sessionId)
|
||||
{
|
||||
|
@ -19,18 +19,17 @@
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSessionInvalidateAndCreateTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.AbstractSessionInvalidateCreateScavengeTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* SessionInvalidateAndCreateTest
|
||||
* SessionInvalidateCreateScavengeTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAndCreateTest
|
||||
public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalidateCreateScavengeTest
|
||||
{
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
@ -40,12 +39,12 @@ public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAnd
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionInvalidateAndCreateTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
return GCloudSessionTestSupport.newSessionDataStoreFactory(GCloudTestSuite.__testSupport.getDatastore());
|
||||
}
|
||||
|
||||
@Test
|
@ -1,82 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSessionRenewTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* SessionRenewTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionRenewTest extends AbstractSessionRenewTest
|
||||
{
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionRenewTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port,max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSessionRenewal() throws Exception
|
||||
{
|
||||
super.testSessionRenewal();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionRenewTest#verifyChange(WebAppContext, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean verifyChange(WebAppContext context, String oldSessionId, String newSessionId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Set<String> ids = GCloudTestSuite.__testSupport.getSessionIds();
|
||||
return (!ids.contains(oldSessionId) && ids.contains(newSessionId));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
fail(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSessionValueSavingTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* SessionValueSavingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionValueSavingTest extends AbstractSessionValueSavingTest
|
||||
{
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionValueSavingTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSessionValueSaving() throws Exception
|
||||
{
|
||||
super.testSessionValueSaving();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.gcloud.session;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import org.eclipse.jetty.server.session.AbstractStopSessionManagerPreserveSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* StopSessionManagerPreserveSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionManagerPreserveSessionTest
|
||||
{
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
GCloudTestSuite.__testSupport.deleteSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractStopSessionManagerPreserveSessionTest#checkSessionPersisted(String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void checkSessionPersisted(String id, boolean expected)
|
||||
{
|
||||
try
|
||||
{
|
||||
GCloudTestSuite.__testSupport.assertSessions(1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs,int evictionPolicy) throws Exception
|
||||
{
|
||||
return new GCloudTestServer(port, maxInactiveMs, scavengeMs, evictionPolicy);
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractStopSessionManagerPreserveSessionTest#configureSessionManagement(org.eclipse.jetty.servlet.ServletContextHandler)
|
||||
*/
|
||||
@Override
|
||||
public void configureSessionManagement(ServletContextHandler context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testStopSessionManagerPreserveSession() throws Exception
|
||||
{
|
||||
super.testStopSessionManagerPreserveSession();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
|
||||
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
}
|
@ -18,13 +18,16 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
public class SessionCookieTest extends AbstractSessionCookieTest
|
||||
/**
|
||||
* HashTestHelper
|
||||
*
|
||||
*/
|
||||
public class HashTestHelper
|
||||
{
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public static SessionDataStoreFactory newSessionDataStoreFactory()
|
||||
{
|
||||
return new HashTestServer(port, max, scavenge, evictionPolicy);
|
||||
return new NullSessionDataStoreFactory();
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
/**
|
||||
* @version $Revision$ $Date$
|
||||
*/
|
||||
public class HashTestServer extends AbstractTestServer
|
||||
{
|
||||
|
||||
|
||||
public HashTestServer(int port, int maxInactivePeriod, int scavengePeriod, int evictionPolicy) throws Exception
|
||||
{
|
||||
super(port, maxInactivePeriod, scavengePeriod, evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler handler = new TestSessionHandler();
|
||||
DefaultSessionCache ss = new DefaultSessionCache(handler);
|
||||
handler.setSessionCache(ss);
|
||||
ss.setSessionDataStore(new NullSessionDataStore());
|
||||
return handler;
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
}
|
@ -21,19 +21,25 @@ package org.eclipse.jetty.server.session;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* NewSessionTest
|
||||
* NonClusteredSessionScavengingTest
|
||||
*/
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
public class NonClusteredSessionScavengingTest extends AbstractNonClusteredSessionScavengingTest
|
||||
{
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNewSession() throws Exception
|
||||
{
|
||||
super.testNewSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return HashTestHelper.newSessionDataStoreFactory();
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ReentrantRequestSessionTest
|
||||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractReentrantRequestSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer(port, max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReentrantRequestSession() throws Exception
|
||||
{
|
||||
super.testReentrantRequestSession();
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class RemoveSessionTest extends AbstractRemoveSessionTest
|
||||
{
|
||||
|
||||
|
||||
@Test
|
||||
public void testRemoveSession() throws Exception
|
||||
{
|
||||
super.testRemoveSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractRemoveSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer (port, max, scavenge, evictionPolicy);
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ServerCrossContextSessionTest extends AbstractServerCrossContextSessionTest
|
||||
{
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
}
|
@ -20,13 +20,15 @@ package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAndCreateTest
|
||||
public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalidateCreateScavengeTest
|
||||
{
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new HashTestServer(port,max,scavenge,evictionPolicy);
|
||||
return HashTestHelper.newSessionDataStoreFactory();
|
||||
}
|
||||
|
||||
@Test
|
@ -1,55 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SessionRenewTest extends AbstractSessionRenewTest
|
||||
{
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer(port, max, scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSessionRenewal() throws Exception
|
||||
{
|
||||
super.testSessionRenewal();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionRenewTest#verifyChange(WebAppContext, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean verifyChange(WebAppContext context ,String oldSessionId, String newSessionId)
|
||||
{
|
||||
return true; //no other tests possible, sessions only in memory
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
public class SessionValueSharedSaving extends AbstractSessionValueSavingTest
|
||||
{
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new HashTestServer(port,max,scavenge,evictionPolicy);
|
||||
}
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
}
|
@ -18,10 +18,11 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
public class ClusteredLastAccessTimeTest extends AbstractClusteredLastAccessTimeTest
|
||||
{
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
@ -39,18 +40,23 @@ public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testLastAccessTime() throws Exception
|
||||
{
|
||||
super.testLastAccessTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
}
|
@ -19,15 +19,16 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* SessionMigrationTest
|
||||
* ClusteredSessionMigrationTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionMigrationTest extends AbstractSessionMigrationTest
|
||||
public class ClusteredSessionMigrationTest extends AbstractClusteredSessionMigrationTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
@ -47,10 +48,15 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
@ -19,15 +19,16 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* LocalSessionScavengingTest
|
||||
* ClusteredSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTest
|
||||
public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
@ -43,17 +44,18 @@ public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTe
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractLocalSessionScavengingTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* ForwardedSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSessionCreateInForward() throws Exception
|
||||
{
|
||||
super.testSessionCreateInForward();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* RemoteImmediateSaveTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ImmediateSaveTest extends AbstractImmediateSaveTest
|
||||
{
|
||||
InfinispanTestSessionServer _server;
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
_server = new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache())
|
||||
{
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler h = super.newSessionHandler();
|
||||
h.getSessionCache().setSaveOnCreate(true);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
return _server;
|
||||
}
|
||||
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.infinispan.Cache;
|
||||
import org.infinispan.configuration.cache.ConfigurationBuilder;
|
||||
import org.infinispan.manager.DefaultCacheManager;
|
||||
import org.infinispan.manager.EmbeddedCacheManager;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* ImmortalSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractImmortalSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testImmortalSession() throws Exception
|
||||
{
|
||||
super.testImmortalSession();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.server.SessionIdManager;
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStore;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.infinispan.Cache;
|
||||
import org.infinispan.commons.api.BasicCache;
|
||||
import org.infinispan.commons.util.CloseableIteratorSet;
|
||||
|
||||
public class InfinispanTestSessionServer extends AbstractTestServer
|
||||
{
|
||||
|
||||
|
||||
|
||||
public InfinispanTestSessionServer(int port, int maxInactivePeriod, int scavengePeriod, int evictionPolicy, BasicCache config) throws Exception
|
||||
{
|
||||
super(port, maxInactivePeriod, scavengePeriod, evictionPolicy, config);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler handler = new TestSessionHandler();
|
||||
InfinispanSessionDataStore sds = new InfinispanSessionDataStore();
|
||||
sds.setCache((BasicCache)_config);
|
||||
DefaultSessionCache ss = new DefaultSessionCache(handler);
|
||||
ss.setSessionDataStore(sds);
|
||||
handler.setSessionCache(ss);
|
||||
return handler;
|
||||
}
|
||||
|
||||
public boolean exists (WebAppContext context, String id)
|
||||
{
|
||||
BasicCache cache = (BasicCache)_config;
|
||||
if (cache != null)
|
||||
{
|
||||
return cache.containsKey(((InfinispanSessionDataStore)(context.getSessionHandler().getSessionCache().getSessionDataStore())).getCacheKey(id));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object get (WebAppContext context, String id)
|
||||
{
|
||||
BasicCache cache = (BasicCache)_config;
|
||||
if (cache != null)
|
||||
{
|
||||
return cache.get(((InfinispanSessionDataStore)(context.getSessionHandler().getSessionCache().getSessionDataStore())).getCacheKey(id));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void dumpCache ()
|
||||
{
|
||||
BasicCache cache = (BasicCache)_config;
|
||||
if (cache != null)
|
||||
{
|
||||
System.err.println(cache.getName()+" contains "+cache.size()+" entries");
|
||||
}
|
||||
}
|
||||
|
||||
public void clearCache ()
|
||||
{
|
||||
BasicCache cache = (BasicCache)_config;
|
||||
|
||||
if (cache != null)
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
}
|
@ -57,6 +57,9 @@ public class InfinispanTestSupport
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public InfinispanTestSupport ()
|
||||
{
|
||||
this (null);
|
||||
|
@ -16,16 +16,21 @@
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RemoveSessionTest extends AbstractRemoveSessionTest
|
||||
/**
|
||||
* ModifyMaxInactiveIntervalTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ModifyMaxInactiveIntervalTest extends AbstractModifyMaxInactiveIntervalTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
@ -42,17 +47,15 @@ public class RemoveSessionTest extends AbstractRemoveSessionTest
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanTestSessionServer s = new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
return s;
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveSession() throws Exception
|
||||
{
|
||||
super.testRemoveSession();
|
||||
}
|
||||
|
||||
}
|
@ -19,15 +19,16 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* NewSessionTest
|
||||
* NonClusteredSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class NewSessionTest extends AbstractNewSessionTest
|
||||
public class NonClusteredSessionScavengingTest extends AbstractNonClusteredSessionScavengingTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
@ -46,15 +47,18 @@ public class NewSessionTest extends AbstractNewSessionTest
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractNewSessionTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void testNewSession() throws Exception
|
@ -1,64 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* ReentrantRequestSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ReentrantRequestSessionTest extends AbstractReentrantRequestSessionTest
|
||||
{
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractReentrantRequestSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port,int maxInactive, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactive, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testReentrantRequestSession() throws Exception
|
||||
{
|
||||
super.testReentrantRequestSession();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* SameNodeLoadTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SameNodeLoadTest extends AbstractSameNodeLoadTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSameNodeLoadTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port,int maxInactive, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
InfinispanTestSessionServer server = new InfinispanTestSessionServer(port,maxInactive, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
return server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testLoad() throws Exception
|
||||
{
|
||||
super.testLoad();
|
||||
}
|
||||
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@ -41,13 +42,18 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
InfinispanTestSessionServer server = new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testSessionNotExpired() throws Exception
|
||||
|
@ -19,15 +19,16 @@
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* SessionInvalidateAndCreateTest
|
||||
* SessionInvalidateCreateScavengeTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAndCreateTest
|
||||
public class SessionInvalidateCreateScavengeTest extends AbstractSessionInvalidateCreateScavengeTest
|
||||
{
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
@ -46,13 +47,16 @@ public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAnd
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionInvalidateAndCreateTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
@ -1,83 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* SessionRenewTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SessionRenewTest extends AbstractSessionRenewTest
|
||||
{
|
||||
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionRenewTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSessionRenewal() throws Exception
|
||||
{
|
||||
super.testSessionRenewal();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractSessionRenewTest#verifyChange(WebAppContext, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean verifyChange(WebAppContext context, String oldSessionId, String newSessionId)
|
||||
{
|
||||
assertTrue(((InfinispanTestSessionServer)_server).exists(context, newSessionId));
|
||||
assertFalse(((InfinispanTestSessionServer)_server).exists(context, oldSessionId));
|
||||
return (!((InfinispanTestSessionServer)_server).exists(context, oldSessionId)) && ((InfinispanTestSessionServer)_server).exists(context, newSessionId);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -16,18 +16,22 @@
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractRemoveSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.eclipse.jetty.server.session.AbstractModifyMaxInactiveIntervalTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RemoteRemoveSessionTest extends AbstractRemoveSessionTest
|
||||
/**
|
||||
* ModifyMaxInactiveIntervalTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ModifyMaxInactiveIntervalTest extends AbstractModifyMaxInactiveIntervalTest
|
||||
{
|
||||
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
@ -45,17 +49,15 @@ public class RemoteRemoveSessionTest extends AbstractRemoveSessionTest
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanTestSessionServer s = new InfinispanTestSessionServer(port, max, scavenge,evictionPolicy, __testSupport.getCache());
|
||||
return s;
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveSession() throws Exception
|
||||
{
|
||||
super.testRemoveSession();
|
||||
}
|
||||
|
||||
}
|
@ -19,18 +19,18 @@
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractNewSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.eclipse.jetty.server.session.AbstractNonClusteredSessionScavengingTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* NewSessionTest
|
||||
* NonClusteredSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteNewSessionTest extends AbstractNewSessionTest
|
||||
public class NonClusteredSessionScavengingTest extends AbstractNonClusteredSessionScavengingTest
|
||||
{
|
||||
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
@ -48,14 +48,16 @@ public class RemoteNewSessionTest extends AbstractNewSessionTest
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractNewSessionTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractClientCrossContextSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* RemoteClientCrossContextSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteClientCrossContextSessionTest extends AbstractClientCrossContextSessionTest
|
||||
{
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new RemoteInfinispanTestSupport("remote-session-test");
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCrossContextDispatch() throws Exception
|
||||
{
|
||||
super.testCrossContextDispatch();
|
||||
}
|
||||
|
||||
}
|
@ -19,19 +19,18 @@
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractInvalidationSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredInvalidationSessionTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
* InvalidationSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteInvalidationSessionTest extends AbstractInvalidationSessionTest
|
||||
public class RemoteClusteredInvalidationSessionTest extends AbstractClusteredInvalidationSessionTest
|
||||
{
|
||||
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
@ -52,15 +51,17 @@ public class RemoteInvalidationSessionTest extends AbstractInvalidationSessionTe
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractInvalidationSessionTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInterval, int scavengeInterval, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInterval, scavengeInterval, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -18,21 +18,13 @@
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractLastAccessTimeTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.infinispan.Cache;
|
||||
import org.infinispan.configuration.cache.Configuration;
|
||||
import org.infinispan.configuration.cache.ConfigurationBuilder;
|
||||
import org.infinispan.manager.DefaultCacheManager;
|
||||
import org.infinispan.manager.EmbeddedCacheManager;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredLastAccessTimeTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class RemoteLastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
public class RemoteClusteredLastAccessTimeTest extends AbstractClusteredLastAccessTimeTest
|
||||
{
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
|
||||
@ -51,10 +43,16 @@ public class RemoteLastAccessTimeTest extends AbstractLastAccessTimeTest
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
@ -19,18 +19,18 @@
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSessionMigrationTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredSessionMigrationTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* RemoteSessionMigrationTest
|
||||
* RemoteClusteredSessionMigrationTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteSessionMigrationTest extends AbstractSessionMigrationTest
|
||||
public class RemoteClusteredSessionMigrationTest extends AbstractClusteredSessionMigrationTest
|
||||
{
|
||||
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
@ -50,11 +50,17 @@ public class RemoteSessionMigrationTest extends AbstractSessionMigrationTest
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testSessionMigration() throws Exception
|
||||
{
|
@ -19,18 +19,18 @@
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractLocalSessionScavengingTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.eclipse.jetty.server.session.AbstractClusteredSessionScavengingTest;
|
||||
import org.eclipse.jetty.server.session.SessionDataStoreFactory;
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* LocalSessionScavengingTest
|
||||
* ClusteredSessionScavengingTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteLocalSessionScavengingTest extends AbstractLocalSessionScavengingTest
|
||||
public class RemoteClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest
|
||||
{
|
||||
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
@ -49,13 +49,16 @@ public class RemoteLocalSessionScavengingTest extends AbstractLocalSessionScaven
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractLocalSessionScavengingTest#createServer(int, int, int, int)
|
||||
* @see org.eclipse.jetty.server.session.AbstractTestBase#createSessionDataStoreFactory()
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractForwardedSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* RemoteForwardedSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteForwardedSessionTest extends AbstractForwardedSessionTest
|
||||
{
|
||||
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new RemoteInfinispanTestSupport("remote-session-test");
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSessionCreateInForward() throws Exception
|
||||
{
|
||||
super.testSessionCreateInForward();
|
||||
}
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractImmediateSaveTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* RemoteImmediateSaveTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteImmediateSaveTest extends AbstractImmediateSaveTest
|
||||
{
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new RemoteInfinispanTestSupport("remote-session-test");
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
public AbstractTestServer createServer(int port, int max, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, max, scavenge, evictionPolicy, __testSupport.getCache())
|
||||
{
|
||||
public SessionHandler newSessionHandler()
|
||||
{
|
||||
SessionHandler h = super.newSessionHandler();
|
||||
h.getSessionCache().setSaveOnCreate(true);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.session.remote;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractImmortalSessionTest;
|
||||
import org.eclipse.jetty.server.session.AbstractTestServer;
|
||||
import org.eclipse.jetty.server.session.InfinispanTestSessionServer;
|
||||
import org.infinispan.Cache;
|
||||
import org.infinispan.configuration.cache.ConfigurationBuilder;
|
||||
import org.infinispan.manager.DefaultCacheManager;
|
||||
import org.infinispan.manager.EmbeddedCacheManager;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* ImmortalSessionTest
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RemoteImmortalSessionTest extends AbstractImmortalSessionTest
|
||||
{
|
||||
|
||||
|
||||
public static RemoteInfinispanTestSupport __testSupport;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
__testSupport = new RemoteInfinispanTestSupport("remote-session-test");
|
||||
__testSupport.setup();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardown () throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.server.session.AbstractImmortalSessionTest#createServer(int, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
public AbstractTestServer createServer(int port, int maxInactiveMs, int scavenge, int evictionPolicy) throws Exception
|
||||
{
|
||||
return new InfinispanTestSessionServer(port, maxInactiveMs, scavenge, evictionPolicy, __testSupport.getCache());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testImmortalSession() throws Exception
|
||||
{
|
||||
super.testImmortalSession();
|
||||
}
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user