fix some mod files and add a distribution test for unixsocket
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
9d45e1bfc7
commit
2b39c7e406
|
@ -1,26 +0,0 @@
|
|||
#
|
||||
# Jetty Hazelcast module
|
||||
#
|
||||
|
||||
[depend]
|
||||
annotations
|
||||
webapp
|
||||
|
||||
[files]
|
||||
maven://com.hazelcast/hazelcast-all/3.8.2|lib/hazelcast/hazelcast-all-3.8.2.jar
|
||||
maven://com.hazelcast/hazelcast-jetty9-sessionmanager/1.0.2|lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar
|
||||
maven://org.eclipse.jetty/jetty-nosql/${jetty.version}|lib/hazelcast/jetty-nosql-${jetty.version}.jar
|
||||
|
||||
[xml]
|
||||
etc/sessions/hazelcast/default.xml
|
||||
|
||||
[lib]
|
||||
lib/hazelcast/*.jar
|
||||
|
||||
[license]
|
||||
Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license.
|
||||
https://hazelcast.org/
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
[ini-template]
|
||||
#jetty.session.hazelcast.configurationLocation=
|
|
@ -1,26 +0,0 @@
|
|||
#
|
||||
# Jetty Hazelcast module
|
||||
#
|
||||
|
||||
[depend]
|
||||
annotations
|
||||
webapp
|
||||
|
||||
[files]
|
||||
maven://com.hazelcast/hazelcast-all/3.8.2|lib/hazelcast/hazelcast-all-3.8.2.jar
|
||||
maven://com.hazelcast/hazelcast-jetty9-sessionmanager/1.0.2|lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar
|
||||
maven://org.eclipse.jetty/jetty-nosql/${jetty.version}|lib/hazelcast/jetty-nosql-${jetty.version}.jar
|
||||
|
||||
[xml]
|
||||
etc/sessions/hazelcast/remote.xml
|
||||
|
||||
[lib]
|
||||
lib/hazelcast/*.jar
|
||||
|
||||
[license]
|
||||
Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license.
|
||||
https://hazelcast.org/
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
[ini-template]
|
||||
#jetty.session.hazelcast.configurationLocation=
|
|
@ -13,7 +13,7 @@ session-store
|
|||
sessions
|
||||
|
||||
[files]
|
||||
maven://com.hazelcast/hazelcast/3.8.2|lib/hazelcast/hazelcast-3.8.2.jar
|
||||
maven://com.hazelcast/hazelcast/3.9.3|lib/hazelcast/hazelcast-3.9.3.jar
|
||||
|
||||
[xml]
|
||||
etc/sessions/hazelcast/default.xml
|
||||
|
@ -33,4 +33,4 @@ jetty.session.hazelcast.mapName=jetty-distributed-session-map
|
|||
jetty.session.hazelcast.hazelcastInstanceName=JETTY_DISTRIBUTED_SESSION_INSTANCE
|
||||
#jetty.session.hazelcast.configurationLocation=
|
||||
jetty.session.gracePeriod.seconds=3600
|
||||
jetty.session.savePeriod.seconds=0
|
||||
jetty.session.savePeriod.seconds=0
|
||||
|
|
|
@ -13,8 +13,8 @@ session-store
|
|||
sessions
|
||||
|
||||
[files]
|
||||
maven://com.hazelcast/hazelcast/3.8.2|lib/hazelcast/hazelcast-3.8.2.jar
|
||||
maven://com.hazelcast/hazelcast-client/3.8.2|lib/hazelcast/hazelcast-client-3.8.2.jar
|
||||
maven://com.hazelcast/hazelcast/3.9.3|lib/hazelcast/hazelcast-3.9.3.jar
|
||||
maven://com.hazelcast/hazelcast-client/3.9.3|lib/hazelcast/hazelcast-client-3.9.3.jar
|
||||
|
||||
[xml]
|
||||
etc/sessions/hazelcast/remote.xml
|
||||
|
@ -35,4 +35,4 @@ jetty.session.hazelcast.hazelcastInstanceName=JETTY_DISTRIBUTED_SESSION_INSTANCE
|
|||
jetty.session.hazelcast.onlyClient=true
|
||||
#jetty.session.hazelcast.configurationLocation=
|
||||
jetty.session.gracePeriod.seconds=3600
|
||||
jetty.session.savePeriod.seconds=0
|
||||
jetty.session.savePeriod.seconds=0
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.9</version>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -19,26 +19,26 @@ server
|
|||
etc/jetty-unixsocket.xml
|
||||
|
||||
[files]
|
||||
maven://com.github.jnr/jnr-unixsocket/0.8|lib/jnr/jnr-unixsocket-0.8.jar
|
||||
maven://com.github.jnr/jnr-ffi/2.0.3|lib/jnr/jnr-ffi-2.0.3.jar
|
||||
maven://com.github.jnr/jffi/1.2.9|lib/jnr/jffi-1.2.9.jar
|
||||
maven://com.github.jnr/jffi/1.2.9/jar/native|lib/jnr/jffi-1.2.9-native.jar
|
||||
maven://org.ow2.asm/asm/5.0.1|lib/jnr/asm-5.0.1.jar
|
||||
maven://org.ow2.asm/asm-commons/5.0.1|lib/jnr/asm-commons-5.0.1.jar
|
||||
maven://org.ow2.asm/asm-analysis/5.0.3|lib/jnr/asm-analysis-5.0.3.jar
|
||||
maven://org.ow2.asm/asm-tree/5.0.3|lib/jnr/asm-tree-5.0.3.jar
|
||||
maven://org.ow2.asm/asm-util/5.0.3|lib/jnr/asm-util-5.0.3.jar
|
||||
maven://com.github.jnr/jnr-unixsocket/0.20|lib/jnr/jnr-unixsocket-0.20.jar
|
||||
maven://com.github.jnr/jnr-ffi/2.1.9|lib/jnr/jnr-ffi-2.1.9.jar
|
||||
maven://com.github.jnr/jffi/1.2.17|lib/jnr/jffi-1.2.17.jar
|
||||
maven://com.github.jnr/jffi/1.2.16/jar/native|lib/jnr/jffi-1.2.16-native.jar
|
||||
maven://org.ow2.asm/asm/7.0|lib/jnr/asm-7.0.jar
|
||||
maven://org.ow2.asm/asm-commons/7.0|lib/jnr/asm-commons-7.0.jar
|
||||
maven://org.ow2.asm/asm-analysis/7.0|lib/jnr/asm-analysis-7.0.jar
|
||||
maven://org.ow2.asm/asm-tree/7.0|lib/jnr/asm-tree-7.0.jar
|
||||
maven://org.ow2.asm/asm-util/7.0|lib/jnr/asm-util-7.0.jar
|
||||
maven://com.github.jnr/jnr-x86asm/1.0.2|lib/jnr/jnr-x86asm-1.0.2.jar
|
||||
maven://com.github.jnr/jnr-constants/0.8.7|lib/jnr/jnr-constants-0.8.7.jar
|
||||
maven://com.github.jnr/jnr-enxio/0.9|lib/jnr/jnr-enxio-0.9.jar
|
||||
maven://com.github.jnr/jnr-posix/3.0.12|lib/jnr/jnr-posix-3.0.12.jar
|
||||
maven://com.github.jnr/jnr-constants/0.9.11|lib/jnr/jnr-constants-0.9.11.jar
|
||||
maven://com.github.jnr/jnr-enxio/0.18|lib/jnr/jnr-enxio-0.18.jar
|
||||
maven://com.github.jnr/jnr-posix/3.0.46|lib/jnr/jnr-posix-3.0.46.jar
|
||||
|
||||
[lib]
|
||||
lib/jetty-unixsocket-${jetty.version}.jar
|
||||
lib/jnr/*.jar
|
||||
|
||||
[license]
|
||||
Jetty UnixSockets is implmented using the Java Native Runtime, which is an
|
||||
Jetty UnixSockets is implemented using the Java Native Runtime, which is an
|
||||
open source project hosted on Github and released under the Apache 2.0 license.
|
||||
https://github.com/jnr/jnr-unixsocket
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
|
@ -80,6 +80,12 @@
|
|||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-unixsocket</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
package org.eclipse.jetty.tests.distribution;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -27,6 +29,9 @@ import org.eclipse.jetty.client.api.ContentResponse;
|
|||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.http2.client.HTTP2Client;
|
||||
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
|
||||
import org.eclipse.jetty.toolchain.test.FS;
|
||||
import org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledOnJre;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
|
@ -204,4 +209,53 @@ public class DistributionTests extends AbstractDistributionTest
|
|||
assertThat(response.getContentAsString(), not(containsString("<%")));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unixSocket() throws Exception
|
||||
{
|
||||
Path sockFile;
|
||||
String unixSocketTmp = System.getProperty("unix.socket.tmp");
|
||||
if( StringUtil.isNotBlank(unixSocketTmp))
|
||||
{
|
||||
sockFile = Files.createTempFile(Paths.get(unixSocketTmp), "unix", ".sock");
|
||||
} else {
|
||||
sockFile = Files.createTempFile("unix", ".sock");
|
||||
}
|
||||
assertTrue(Files.deleteIfExists(sockFile), "temp sock file cannot be deleted");
|
||||
|
||||
|
||||
String jettyVersion = System.getProperty("jettyVersion");
|
||||
DistributionTester distribution = DistributionTester.Builder.newInstance()
|
||||
.jettyVersion(jettyVersion)
|
||||
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
|
||||
.build();
|
||||
|
||||
String[] args1 = {
|
||||
"--create-startd",
|
||||
"--add-to-start=unixsocket-http,deploy,jsp",
|
||||
"--approve-all-licenses"
|
||||
};
|
||||
try (DistributionTester.Run run1 = distribution.start(args1))
|
||||
{
|
||||
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
|
||||
assertEquals(0, run1.getExitValue());
|
||||
|
||||
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
|
||||
distribution.installWarFile(war, "test");
|
||||
|
||||
try (DistributionTester.Run run2 = distribution.start("jetty.unixsocket="+sockFile.toString()))
|
||||
{
|
||||
assertTrue(run2.awaitConsoleLogsFor("Started @", 10, TimeUnit.SECONDS));
|
||||
|
||||
startHttpClient(() -> new HttpClient( new HttpClientTransportOverUnixSockets(sockFile.toString()), null));
|
||||
ContentResponse response = client.GET("http://localhost/test/index.jsp");
|
||||
assertEquals(HttpStatus.OK_200, response.getStatus());
|
||||
assertThat(response.getContentAsString(), containsString("Hello"));
|
||||
assertThat(response.getContentAsString(), not(containsString("<%")));
|
||||
}
|
||||
} finally {
|
||||
FS.delete(sockFile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue