Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-websocketProxy
This commit is contained in:
commit
ce11fb3e94
|
@ -12,7 +12,7 @@ pipeline {
|
|||
steps {
|
||||
container('jetty-build') {
|
||||
timeout( time: 120, unit: 'MINUTES' ) {
|
||||
mavenBuild( "jdk8", "clean install -T3 -Premote-session-tests -Pgcloud", "maven3",
|
||||
mavenBuild( "jdk8", "clean install -T3", "maven3",
|
||||
[[parserName: 'Maven'], [parserName: 'Java']])
|
||||
// Collect up the jacoco execution results (only on main build)
|
||||
jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class',
|
||||
|
@ -42,7 +42,7 @@ pipeline {
|
|||
steps {
|
||||
container( 'jetty-build' ) {
|
||||
timeout( time: 120, unit: 'MINUTES' ) {
|
||||
mavenBuild( "jdk11", "clean install -T3 -Djacoco.skip=true -Premote-session-tests -Pgcloud", "maven3",
|
||||
mavenBuild( "jdk11", "clean install -T3 -Djacoco.skip=true", "maven3",
|
||||
[[parserName: 'Maven'], [parserName: 'Java']])
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ pipeline {
|
|||
steps {
|
||||
container( 'jetty-build' ) {
|
||||
timeout( time: 120, unit: 'MINUTES' ) {
|
||||
mavenBuild( "jdk15", "clean install -T3 -Djacoco.skip=true -Premote-session-tests -Pgcloud", "maven3",
|
||||
mavenBuild( "jdk15", "clean install -T3 -Djacoco.skip=true", "maven3",
|
||||
[[parserName: 'Maven'], [parserName: 'Java']])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,7 +213,6 @@ The `JMXServiceURL` above specifies that the RMI server binds to the wildcard ad
|
|||
===== JMX Remote Access Authorization
|
||||
|
||||
The standard `JMXConnectorServer` provides several options to authorize access.
|
||||
For a complete guide to controlling authentication and authorization in JMX, see https://blogs.oracle.com/lmalventosa/entry/jmx_authentication_authorization[Authentication and Authorization in JMX RMI connectors].
|
||||
|
||||
To authorize access to the `JMXConnectorServer` you can use this configuration, where the `jmx.password` and `jmx.access` files have the format specified in the blog entry above:
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ $ java -jar start.jar --module=websocket --write-module-graph=modules.dot
|
|||
$ dot -Tpng -o modules.png modules.dot
|
||||
----
|
||||
+
|
||||
See http://graphviz.org/[graphviz.org] for details on http://graphviz.org/content/command-line-invocation[how to post-process this dotty file] into the output best suited for your needs.
|
||||
See http://graphviz.org/[graphviz.org] for details on how to post-process this dotty file into the output best suited for your needs.
|
||||
|
||||
--create-files::
|
||||
Create any missing files that are required by initialized modules.
|
||||
|
|
|
@ -713,7 +713,7 @@ This is _not_ a recommended usage.
|
|||
==== Conscrypt SSL
|
||||
|
||||
Jetty includes support for Google's https://github.com/google/conscrypt/[Conscrypt SSL], which is built on their fork of https://www.openssl.org/[OpenSSL], https://boringssl.googlesource.com/boringssl/[BoringSSL].
|
||||
Implementing Conscrypt for the link:{GITBROWSEURL}/jetty-alpn/jetty-alpn-conscrypt-server/src/test/java/org/eclipse/jetty/alpn/conscrypt/server/ConscryptHTTP2Server.java[server] or link:{GITBROWSEURL}/jetty-alpn/jetty-alpn-conscrypt-client/src/test/java/org/eclipse/jetty/alpn/java/client/ConscryptHTTP2Client.java[client] is very straightforward process - simply instantiate an instance of Conscrypt's `OpenSSLProvider` and set `Conscrypt` as a provider for Jetty's `SslContextFactory`:
|
||||
Implementing Conscrypt for the link:{GITBROWSEURL}/jetty-alpn/jetty-alpn-conscrypt-server/src/test/java/org/eclipse/jetty/alpn/conscrypt/server/ConscryptHTTP2ServerTest.java[server] or link:{GITBROWSEURL}/jetty-alpn/jetty-alpn-conscrypt-client/src/test/java/org/eclipse/jetty/alpn/java/client/ConscryptHTTP2ClientTest.java[client] is very straightforward process - simply instantiate an instance of Conscrypt's `OpenSSLProvider` and set `Conscrypt` as a provider for Jetty's `SslContextFactory`:
|
||||
|
||||
[source, java]
|
||||
----
|
||||
|
|
|
@ -239,7 +239,7 @@ The link:{GITBROWSEURL}/examples/embedded/src/main/java/org/eclipse/jetty/embedd
|
|||
* link:{GITBROWSEURL}/jetty-server/src/main/config/etc/jetty-stats.xml[jetty-stats.xml]
|
||||
* link:{GITBROWSEURL}/jetty-server/src/main/config/etc/jetty-requestlog.xml[jetty-requestlog.xml]
|
||||
* link:{GITBROWSEURL}/jetty-server/src/main/config/etc/jetty-lowresources.xml[jetty-lowresources.xml]
|
||||
* link:{GITBROWSEURL}/tests/test-webapps/test-jetty-webapp/src/main/config/etc/test-realm.xml[test-realm.xml]
|
||||
* link:{GITBROWSEURL}/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml[test-realm.xml]
|
||||
|
||||
[source, java]
|
||||
----
|
||||
|
|
|
@ -1153,6 +1153,6 @@ In addition, as the feature group includes websocket, you will need to download
|
|||
|=======================================================================
|
||||
|Jar |Bundle Symbolic Name |Location
|
||||
|javax.websocket-api |javax.websocket-api
|
||||
|https://repo1.maven.org/maven2/javax/websocket/websocket-api[Maven
|
||||
|https://repo1.maven.org/maven2/javax/websocket/[Maven
|
||||
central]
|
||||
|=======================================================================
|
||||
|
|
|
@ -67,7 +67,7 @@ Validator]
|
|||
|
||||
|http://jcp.org/en/jsr/detail?id=353[JSR 353] |Java API for JSON Processing 1.0 (JSON-P) |No |Yes, eg JSON-P https://java.net/projects/jsonp/[reference implementation]
|
||||
|
||||
|link:jcp.org/en/jsr/detail?id=318[JSR 318] |Interceptors 1.2 |No |Yes as part of a CDI implementation
|
||||
|http://jcp.org/en/jsr/detail?id=318[JSR 318] |Interceptors 1.2 |No |Yes as part of a CDI implementation
|
||||
|=======================================================================
|
||||
|
||||
[[jetty-javaee-6]]
|
||||
|
@ -102,7 +102,7 @@ Here is the matrix of JSRs for Java EE 6 Web Profile, and how they relate to Jet
|
|||
|
||||
|http://jcp.org/en/jsr/detail?id=250[JSR 250] |Common Annotations for the Java Platform |Yes |Partially (for non-core Servlet Spec annotations)
|
||||
|
||||
|http://jcp.org/en/jsr/detail?id=907[JSR 907] |Java Transaction API (JTA) |Yes |Implementations are pluggable, such as http://www.atomikos.com/[Atomikos], http://jotm.ow2.org/xwiki/bin/view/Main/WebHome[JOTM], http://jencks.codehaus.org/Transaction+Manager[Jencks (Geronimo Transaction Manager)]
|
||||
|http://jcp.org/en/jsr/detail?id=907[JSR 907] |Java Transaction API (JTA) |Yes |Implementations are pluggable, such as http://www.atomikos.com/[Atomikos], http://jotm.ow2.org/[JOTM], http://jencks.codehaus.org/Transaction+Manager[Jencks (Geronimo Transaction Manager)]
|
||||
|
||||
|http://jcp.org/en/jsr/detail?id=303[JSR 303] |Bean Validation 1.0 |No |Yes as part of another technology (JSF), or a stand-alone implementation such as http://www.hibernate.org/subprojects/validator/docs.html[Hiberate
|
||||
Validator]
|
||||
|
|
|
@ -37,7 +37,7 @@ You can specify a custom configuration file to use for specific webapps, or for
|
|||
====
|
||||
To ensure your `webdefault.xml` files are validated, you will need to set the `validateXml` attribute to true as described link:#jetty-xml-dtd[here.]
|
||||
====
|
||||
The `webdefault.xml` link:{GITBROWSURL}/jetty-webapp/src/main/config/etc/webdefault.xml[included with the Jetty Distribution] contains several configuration options, such as init params and servlet mappings, and is separated into sections for easy navigation.
|
||||
The `webdefault.xml` link:{GITBROWSEURLSURL}/jetty-webapp/src/main/config/etc/webdefault.xml[included with the Jetty Distribution] contains several configuration options, such as init params and servlet mappings, and is separated into sections for easy navigation.
|
||||
Some of the more common options include, but are not limited to:
|
||||
|
||||
dirAllowed::
|
||||
|
|
|
@ -23,4 +23,4 @@ As of Fedora 19, Jetty 9 is the version of Jetty available.
|
|||
This distribution of Jetty is not created or maintained by the Jetty project though we have had a fair amount of communication with the folks behind it and we are very pleased with how this Linux distribution has stayed current.
|
||||
Releases are kept largely in sync with our releases as there is a wonderful automatic notification mechanism in place for Fedora that detects our releases and immediately opens an issue for them to update.
|
||||
|
||||
* https://admin.fedoraproject.org/pkgdb/acls/name/jetty[Jetty on Fedora]
|
||||
* https://src.fedoraproject.org/rpms/jetty[Jetty on Fedora]
|
||||
|
|
|
@ -90,7 +90,9 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<systemPropertyVariables>
|
||||
<infinispan.docker.image.version>${infinispan.docker.image.version}</infinispan.docker.image.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -137,29 +139,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>remote-session-tests</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>hotrod.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>false</skipTests>
|
||||
<systemPropertyVariables>
|
||||
<infinispan.docker.image.version>${infinispan.docker.image.version}</infinispan.docker.image.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<assembly-directory>target/distribution</assembly-directory>
|
||||
<exam.version>4.13.1</exam.version>
|
||||
<url.version>2.6.1</url.version>
|
||||
<injection.bundle.version>1.0</injection.bundle.version>
|
||||
<injection.bundle.version>1.2</injection.bundle.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Pax Exam Dependencies -->
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jetty.util.ClassLoadingObjectInputStream;
|
||||
import org.eclipse.jetty.util.MultiException;
|
||||
|
@ -153,7 +154,7 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
public Set<String> doGetExpired(final Set<String> candidates)
|
||||
{
|
||||
final long now = System.currentTimeMillis();
|
||||
HashSet<String> expired = new HashSet<String>();
|
||||
HashSet<String> expired = new HashSet<>();
|
||||
|
||||
//iterate over the files and work out which have expired
|
||||
for (String filename : _sessionFileMap.values())
|
||||
|
@ -206,23 +207,12 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
long now = System.currentTimeMillis();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Sweeping {} for old session files", _storeDir);
|
||||
try
|
||||
try (Stream<Path> stream = Files.walk(_storeDir.toPath(), 1, FileVisitOption.FOLLOW_LINKS))
|
||||
{
|
||||
Files.walk(_storeDir.toPath(), 1, FileVisitOption.FOLLOW_LINKS)
|
||||
stream
|
||||
.filter(p -> !Files.isDirectory(p)).filter(p -> !isOurContextSessionFilename(p.getFileName().toString()))
|
||||
.filter(p -> isSessionFilename(p.getFileName().toString()))
|
||||
.forEach(p ->
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
sweepFile(now, p);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.warn(e);
|
||||
}
|
||||
});
|
||||
.forEach(p -> sweepFile(now, p));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -237,29 +227,35 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
*
|
||||
* @param now the time now in msec
|
||||
* @param p the file to check
|
||||
* @throws Exception indicating error in sweep
|
||||
*/
|
||||
public void sweepFile(long now, Path p)
|
||||
throws Exception
|
||||
{
|
||||
if (p == null)
|
||||
return;
|
||||
|
||||
try
|
||||
if (p != null)
|
||||
{
|
||||
long expiry = getExpiryFromFilename(p.getFileName().toString());
|
||||
//files with 0 expiry never expire
|
||||
if (expiry > 0 && ((now - expiry) >= (5 * TimeUnit.SECONDS.toMillis(_gracePeriodSec))))
|
||||
try
|
||||
{
|
||||
Files.deleteIfExists(p);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Sweep deleted {}", p.getFileName());
|
||||
long expiry = getExpiryFromFilename(p.getFileName().toString());
|
||||
//files with 0 expiry never expire
|
||||
if (expiry > 0 && ((now - expiry) >= (5 * TimeUnit.SECONDS.toMillis(_gracePeriodSec))))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Files.deleteIfExists(p))
|
||||
LOG.warn("Could not delete {}", p.getFileName());
|
||||
else if (LOG.isDebugEnabled())
|
||||
LOG.debug("Deleted {}", p.getFileName());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
LOG.warn("Could not delete {}", p.getFileName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
LOG.warn("Not valid session filename {}", p.getFileName());
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
LOG.warn("Not valid session filename {}", p.getFileName());
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,7 +307,7 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
@Override
|
||||
public void doStore(String id, SessionData data, long lastSaveTime) throws Exception
|
||||
{
|
||||
File file = null;
|
||||
File file;
|
||||
if (_storeDir != null)
|
||||
{
|
||||
delete(id);
|
||||
|
@ -328,8 +324,9 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (file != null)
|
||||
file.delete(); // No point keeping the file if we didn't save the whole session
|
||||
// No point keeping the file if we didn't save the whole session
|
||||
if (!file.delete())
|
||||
e.addSuppressed(new IOException("Could not delete " + file));
|
||||
throw new UnwriteableSessionDataException(id, _context, e);
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +350,10 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
throw new IllegalStateException("No file store specified");
|
||||
|
||||
if (!_storeDir.exists())
|
||||
_storeDir.mkdirs();
|
||||
{
|
||||
if (!_storeDir.mkdirs())
|
||||
throw new IllegalStateException("Could not create " + _storeDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(_storeDir.isDirectory() && _storeDir.canWrite() && _storeDir.canRead()))
|
||||
|
@ -365,70 +365,67 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
MultiException me = new MultiException();
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
Files.walk(_storeDir.toPath(), 1, FileVisitOption.FOLLOW_LINKS)
|
||||
.filter(p -> !Files.isDirectory(p)).filter(p -> isSessionFilename(p.getFileName().toString()))
|
||||
.forEach(p ->
|
||||
{
|
||||
//first get rid of all ancient files, regardless of which
|
||||
//context they are for
|
||||
try
|
||||
// Build session file map by walking directory
|
||||
try (Stream<Path> stream = Files.walk(_storeDir.toPath(), 1, FileVisitOption.FOLLOW_LINKS))
|
||||
{
|
||||
stream
|
||||
.filter(p -> !Files.isDirectory(p))
|
||||
.filter(p -> isSessionFilename(p.getFileName().toString()))
|
||||
.forEach(p ->
|
||||
{
|
||||
// first get rid of all ancient files
|
||||
sweepFile(now, p);
|
||||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
me.add(x);
|
||||
}
|
||||
|
||||
String filename = p.getFileName().toString();
|
||||
String context = getContextFromFilename(filename);
|
||||
//now process it if it wasn't deleted, and it is for our context
|
||||
if (Files.exists(p) && _contextString.equals(context))
|
||||
{
|
||||
//the session is for our context, populate the map with it
|
||||
String sessionIdWithContext = getIdWithContextFromFilename(filename);
|
||||
if (sessionIdWithContext != null)
|
||||
String filename = p.getFileName().toString();
|
||||
String context = getContextFromFilename(filename);
|
||||
//now process it if it wasn't deleted, and it is for our context
|
||||
if (Files.exists(p) && _contextString.equals(context))
|
||||
{
|
||||
//handle multiple session files existing for the same session: remove all
|
||||
//but the file with the most recent expiry time
|
||||
String existing = _sessionFileMap.putIfAbsent(sessionIdWithContext, filename);
|
||||
if (existing != null)
|
||||
//the session is for our context, populate the map with it
|
||||
String sessionIdWithContext = getIdWithContextFromFilename(filename);
|
||||
if (sessionIdWithContext != null)
|
||||
{
|
||||
//if there was a prior filename, work out which has the most
|
||||
//recent modify time
|
||||
try
|
||||
//handle multiple session files existing for the same session: remove all
|
||||
//but the file with the most recent expiry time
|
||||
String existing = _sessionFileMap.putIfAbsent(sessionIdWithContext, filename);
|
||||
if (existing != null)
|
||||
{
|
||||
long existingExpiry = getExpiryFromFilename(existing);
|
||||
long thisExpiry = getExpiryFromFilename(filename);
|
||||
//if there was a prior filename, work out which has the most
|
||||
//recent modify time
|
||||
try
|
||||
{
|
||||
long existingExpiry = getExpiryFromFilename(existing);
|
||||
long thisExpiry = getExpiryFromFilename(filename);
|
||||
|
||||
if (thisExpiry > existingExpiry)
|
||||
{
|
||||
//replace with more recent file
|
||||
Path existingPath = _storeDir.toPath().resolve(existing);
|
||||
//update the file we're keeping
|
||||
_sessionFileMap.put(sessionIdWithContext, filename);
|
||||
//delete the old file
|
||||
Files.delete(existingPath);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Replaced {} with {}", existing, filename);
|
||||
if (thisExpiry > existingExpiry)
|
||||
{
|
||||
//replace with more recent file
|
||||
Path existingPath = _storeDir.toPath().resolve(existing);
|
||||
//update the file we're keeping
|
||||
_sessionFileMap.put(sessionIdWithContext, filename);
|
||||
//delete the old file
|
||||
Files.delete(existingPath);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Replaced {} with {}", existing, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
//we found an older file, delete it
|
||||
Files.delete(p);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Deleted expired session file {}", filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (IOException e)
|
||||
{
|
||||
//we found an older file, delete it
|
||||
Files.delete(p);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Deleted expired session file {}", filename);
|
||||
me.add(e);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
me.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
me.ifExceptionThrow();
|
||||
});
|
||||
me.ifExceptionThrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,11 +508,11 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
|
||||
protected long getExpiryFromFilename(String filename)
|
||||
{
|
||||
if (StringUtil.isBlank(filename) || filename.indexOf("_") < 0)
|
||||
if (StringUtil.isBlank(filename) || !filename.contains("_"))
|
||||
throw new IllegalStateException("Invalid or missing filename");
|
||||
|
||||
String s = filename.substring(0, filename.indexOf('_'));
|
||||
return (s == null ? 0 : Long.parseLong(s));
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
|
||||
protected String getContextFromFilename(String filename)
|
||||
|
@ -592,11 +589,11 @@ public class FileSessionDataStore extends AbstractSessionDataStore
|
|||
protected SessionData load(InputStream is, String expectedId)
|
||||
throws Exception
|
||||
{
|
||||
String id = null; //the actual id from inside the file
|
||||
String id; //the actual id from inside the file
|
||||
|
||||
try
|
||||
{
|
||||
SessionData data = null;
|
||||
SessionData data;
|
||||
DataInputStream di = new DataInputStream(is);
|
||||
|
||||
id = di.readUTF();
|
||||
|
|
|
@ -146,9 +146,8 @@ public class CustomResourcesMonitorTest
|
|||
@Override
|
||||
public boolean isLowOnResources()
|
||||
{
|
||||
try
|
||||
try (Stream<Path> paths = Files.list(_pathToMonitor))
|
||||
{
|
||||
Stream<Path> paths = Files.list(_pathToMonitor);
|
||||
List<Path> content = paths.collect(Collectors.toList());
|
||||
if (!content.isEmpty())
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Stream;
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
import javax.servlet.ServletException;
|
||||
|
@ -1837,9 +1838,9 @@ public class RequestTest
|
|||
|
||||
private static long getFileCount(Path path)
|
||||
{
|
||||
try
|
||||
try (Stream<Path> s = Files.list(path))
|
||||
{
|
||||
return Files.list(path).count();
|
||||
return s.count();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.time.temporal.TemporalAccessor;
|
|||
import java.util.Arrays;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.FS;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
|
||||
|
@ -379,6 +379,9 @@ public class RolloverFileOutputStreamTest
|
|||
|
||||
private String[] ls(Path path) throws IOException
|
||||
{
|
||||
return Files.list(path).map(p -> p.getFileName().toString()).collect(Collectors.toList()).toArray(new String[0]);
|
||||
try (Stream<Path> s = Files.list(path))
|
||||
{
|
||||
return s.map(p -> p.getFileName().toString()).toArray(String[]::new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.FS;
|
||||
|
@ -264,7 +265,10 @@ public class JarResourceTest
|
|||
|
||||
private List<Path> listFiles(Path dir) throws IOException
|
||||
{
|
||||
return Files.list(dir).collect(Collectors.toList());
|
||||
try (Stream<Path> s = Files.list(dir))
|
||||
{
|
||||
return s.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
private List<Path> listFiles(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException
|
||||
|
|
|
@ -65,6 +65,7 @@ import org.junit.jupiter.api.AfterEach;
|
|||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
@ -73,6 +74,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
@Tag("large-disk-resource")
|
||||
public class HugeResourceTest
|
||||
{
|
||||
private static final long KB = 1024;
|
||||
|
|
|
@ -365,10 +365,14 @@ public class WebAppContextTest
|
|||
WebAppClassLoader webAppClassLoader = (WebAppClassLoader)contextClassLoader;
|
||||
Path extLibsDir = MavenTestingUtils.getTestResourcePathDir("ext");
|
||||
extLibsDir = extLibsDir.toAbsolutePath();
|
||||
List<Path> expectedPaths = Files.list(extLibsDir)
|
||||
.filter(Files::isRegularFile)
|
||||
.filter((path) -> path.toString().endsWith(".jar"))
|
||||
.collect(Collectors.toList());
|
||||
List<Path> expectedPaths;
|
||||
try (Stream<Path> s = Files.list(extLibsDir))
|
||||
{
|
||||
expectedPaths = s
|
||||
.filter(Files::isRegularFile)
|
||||
.filter((path) -> path.toString().endsWith(".jar"))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
List<Path> actualPaths = new ArrayList<>();
|
||||
for (URL url : webAppClassLoader.getURLs())
|
||||
{
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -595,7 +595,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -605,7 +605,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<version>3.14.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -1448,7 +1448,7 @@
|
|||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven.surefire.version}</version>
|
||||
<configuration>
|
||||
<excludedGroups>external</excludedGroups>
|
||||
<excludedGroups>external, large-disk-resource</excludedGroups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -27,10 +27,10 @@ import java.io.ObjectOutputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.FS;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
|
||||
|
@ -49,23 +49,28 @@ public class FileTestHelper
|
|||
|
||||
public static File getFile(WorkDir workDir, String sessionId) throws IOException
|
||||
{
|
||||
Optional<Path> sessionPath = Files.list(workDir.getPath())
|
||||
.filter((path) -> path.getFileName().toString().contains(sessionId))
|
||||
.findFirst();
|
||||
if (sessionPath.isPresent())
|
||||
return sessionPath.get().toFile();
|
||||
return null;
|
||||
try (Stream<Path> s = Files.list(workDir.getPath()))
|
||||
{
|
||||
return s
|
||||
.filter((path) -> path.getFileName().toString().contains(sessionId))
|
||||
.findFirst()
|
||||
.map(Path::toFile)
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertSessionExists(WorkDir workDir, String sessionId, boolean exists) throws IOException
|
||||
{
|
||||
Optional<Path> sessionPath = Files.list(workDir.getPath())
|
||||
.filter((path) -> path.getFileName().toString().contains(sessionId))
|
||||
.findFirst();
|
||||
if (exists)
|
||||
assertTrue(sessionPath.isPresent());
|
||||
else
|
||||
assertFalse(sessionPath.isPresent());
|
||||
try (Stream<Path> s = Files.list(workDir.getPath()))
|
||||
{
|
||||
Optional<Path> sessionPath = s
|
||||
.filter((path) -> path.getFileName().toString().contains(sessionId))
|
||||
.findFirst();
|
||||
if (exists)
|
||||
assertTrue(sessionPath.isPresent());
|
||||
else
|
||||
assertFalse(sessionPath.isPresent());
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertFileExists(WorkDir workDir, String filename, boolean exists)
|
||||
|
@ -170,14 +175,11 @@ public class FileTestHelper
|
|||
public static void deleteFile(WorkDir workDir, String sessionId) throws IOException
|
||||
{
|
||||
// Collect
|
||||
List<Path> matches = Files.list(workDir.getPath())
|
||||
.filter((path) -> path.getFileName().toString().contains(sessionId))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// Delete outside of lambda
|
||||
for (Path path : matches)
|
||||
try (Stream<Path> s = Files.list(workDir.getPath()))
|
||||
{
|
||||
FS.deleteFile(path);
|
||||
s.filter((path) -> path.getFileName().toString().contains(sessionId))
|
||||
.collect(Collectors.toList()) // Delete outside of list stream
|
||||
.forEach(FS::deleteFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,6 @@
|
|||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
|
@ -83,26 +76,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>gcloud</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>gcloud.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>false</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -30,8 +30,12 @@
|
|||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>org/eclipse/jetty/server/session/*.java</include>
|
||||
<include>**/*.java</include>
|
||||
</includes>
|
||||
<systemPropertyVariables>
|
||||
<infinispan.docker.image.version>${infinispan.docker.image.version}</infinispan.docker.image.version>
|
||||
<infinispan.docker.image.name>${infinispan.docker.image.name}</infinispan.docker.image.name>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -151,33 +155,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<!-- to test hotrod, configure a cache called "remote-session-test" -->
|
||||
<profile>
|
||||
<id>remote-session-tests</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>hotrod.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*.java</include>
|
||||
</includes>
|
||||
<systemPropertyVariables>
|
||||
<infinispan.docker.image.version>${infinispan.docker.image.version}</infinispan.docker.image.version>
|
||||
<infinispan.docker.image.name>${infinispan.docker.image.name}</infinispan.docker.image.name>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -22,13 +22,6 @@
|
|||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
|
@ -78,27 +71,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>remote-session-tests</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>memcached.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>false</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<systemPropertyVariables>
|
||||
<mongo.docker.version>${mongo.docker.version}</mongo.docker.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -112,29 +114,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>remote-session-tests</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>mongo.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<mongo.docker.version>${mongo.docker.version}</mongo.docker.version>
|
||||
</systemPropertyVariables>
|
||||
<skipTests>false</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-atinject_1.0_spec</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
|
|
Loading…
Reference in New Issue