Skip to content

Commit

Permalink
Issue #3514 using interpolation for mod files, fix unix socket mod fi…
Browse files Browse the repository at this point in the history
…les with adding a distribution test

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
  • Loading branch information
olamy committed Apr 1, 2019
1 parent 97ff7ed commit 4ad77b5
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 38 deletions.
Expand Up @@ -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/@hazelcast.version@|lib/hazelcast/hazelcast-@hazelcast.version@.jar

[xml]
etc/sessions/hazelcast/default.xml
Expand All @@ -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
Expand Up @@ -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/@hazelcast.version@|lib/hazelcast/hazelcast-@hazelcast.version@.jar
maven://com.hazelcast/hazelcast-client/@hazelcast.version@|lib/hazelcast/hazelcast-client-@hazelcast.version@.jar

[xml]
etc/sessions/hazelcast/remote.xml
Expand All @@ -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
6 changes: 3 additions & 3 deletions jetty-home/pom.xml
Expand Up @@ -78,7 +78,7 @@
<classifier>version</classifier>
<type>txt</type>
<overWrite>true</overWrite>
<outputDirectory>${assembly-directory}/</outputDirectory>
<outputDirectory>${assembly-directory}/</outputDirectory >
<destFileName>VERSION.txt</destFileName>
</artifactItem>
<artifactItem>
Expand Down Expand Up @@ -290,15 +290,15 @@
<version>3.1.0</version>
<overWrite>true</overWrite>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
<destFileName>servlet-api-3.1.jar</destFileName>
<destFileName>servlet-api-${servlet.api.distributed.version}.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-schemas</artifactId>
<version>3.1.M0</version>
<overWrite>true</overWrite>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
<destFileName>jetty-schemas-3.1.jar</destFileName>
<destFileName>jetty-schemas-${jetty.schema.distributed.version}.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
Expand Down
13 changes: 7 additions & 6 deletions jetty-memcached/jetty-memcached-sessions/pom.xml
Expand Up @@ -10,6 +10,11 @@
<artifactId>jetty-memcached-sessions</artifactId>
<name>Jetty :: Memcached :: Sessions</name>

<properties>
<bundle-symbolic-name>${project.groupId}.session</bundle-symbolic-name>
<memcache.version>2.4.5</memcache.version>
</properties>

<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
Expand All @@ -19,12 +24,12 @@
<dependency>
<groupId>com.googlecode.xmemcached</groupId>
<artifactId>xmemcached</artifactId>
<version>2.4.5</version>
<version>${memcache.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.9</version>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -46,10 +51,6 @@
</dependency>
</dependencies>

<properties>
<bundle-symbolic-name>${project.groupId}.session</bundle-symbolic-name>
</properties>

<build>
<plugins>
<plugin>
Expand Down
Expand Up @@ -11,7 +11,7 @@ session-store
slf4j-api

[files]
maven://com.googlecode.xmemcached/xmemcached/2.4.5|lib/xmemcached/xmemcached-2.4.5.jar
maven://com.googlecode.xmemcached/xmemcached/@memcache.version@|lib/xmemcached/xmemcached-@memcache.version@.jar

[lib]
lib/jetty-memcached-sessions-${jetty.version}.jar
Expand Down
3 changes: 2 additions & 1 deletion jetty-nosql/pom.xml
Expand Up @@ -10,6 +10,7 @@
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.nosql</bundle-symbolic-name>
<mongo.version>2.13.2</mongo.version>
</properties>
<build>
<defaultGoal>install</defaultGoal>
Expand All @@ -36,7 +37,7 @@
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.13.2</version>
<version>${mongo.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Expand Down
Expand Up @@ -14,7 +14,7 @@ sessions
sessions/mongo/${connection-type}

[files]
maven://org.mongodb/mongo-java-driver/2.13.2|lib/nosql/mongo-java-driver-2.13.2.jar
maven://org.mongodb/mongo-java-driver/@mongo.version@|lib/nosql/mongo-java-driver-@mongo.version@.jar

[lib]
lib/jetty-nosql-${jetty.version}.jar
Expand Down
6 changes: 3 additions & 3 deletions jetty-server/src/main/config/modules/server.mod
Expand Up @@ -14,8 +14,8 @@ threadpool
bytebufferpool

[lib]
lib/servlet-api-3.1.jar
lib/jetty-schemas-3.1.jar
lib/servlet-api-@servlet.api.distributed.version@.jar
lib/jetty-schemas-@jetty.schema.distributed.version@.jar
lib/jetty-http-${jetty.version}.jar
lib/jetty-server-${jetty.version}.jar
lib/jetty-xml-${jetty.version}.jar
Expand All @@ -26,7 +26,7 @@ lib/jetty-io-${jetty.version}.jar
etc/jetty.xml

[jpms]
patch-module: servlet.api=lib/jetty-schemas-3.1.jar
patch-module: servlet.api=lib/jetty-schemas-@jetty.schema.distributed.version@.jar

[ini-template]
### Common HTTP configuration
Expand Down
26 changes: 13 additions & 13 deletions jetty-unixsocket/src/main/config/modules/unixsocket.mod
Expand Up @@ -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/@jnr-unixsocket.version@|lib/jnr/jnr-unixsocket-@jnr-unixsocket.version@.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/@asm.version@|lib/jnr/asm-@asm.version@.jar
maven://org.ow2.asm/asm-commons/@asm.version@|lib/jnr/asm-commons-@asm.version@.jar
maven://org.ow2.asm/asm-analysis/@asm.version@|lib/jnr/asm-analysis-@asm.version@.jar
maven://org.ow2.asm/asm-tree/@asm.version@|lib/jnr/asm-tree-@asm.version@.jar
maven://org.ow2.asm/asm-util/@asm.version@|lib/jnr/asm-util-@asm.version@.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
Expand Down
2 changes: 1 addition & 1 deletion jetty-util/src/main/config/modules/log4j-impl.mod
Expand Up @@ -28,5 +28,5 @@ Log4j is released under the Apache 2.0 license.
http://www.apache.org/licenses/LICENSE-2.0.html

[ini]
log4j.version?=1.2.17
log4j.version?=@log4j.version@
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/log4j/
2 changes: 1 addition & 1 deletion jetty-util/src/main/config/modules/logback-impl.mod
Expand Up @@ -36,5 +36,5 @@ or (per the licensee's choosing) under
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
[ini]
logback.version?=1.2.3
logback.version?=@logback.version@
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/logback/
2 changes: 1 addition & 1 deletion jetty-util/src/main/config/modules/slf4j-api.mod
Expand Up @@ -16,7 +16,7 @@ maven://org.slf4j/slf4j-api/${slf4j.version}|lib/slf4j/slf4j-api-${slf4j.version
lib/slf4j/slf4j-api-${slf4j.version}.jar

[ini]
slf4j.version?=1.7.25
slf4j.version?=@slf4j.version@
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/slf4j/

[license]
Expand Down
36 changes: 34 additions & 2 deletions pom.xml
Expand Up @@ -21,11 +21,18 @@
<build-support.version>1.4</build-support.version>
<slf4j.version>1.7.25</slf4j.version>
<log4j2.version>2.11.1</log4j2.version>
<log4j.version>1.2.17</log4j.version>
<logback.version>1.2.3</logback.version>
<jetty-test-policy.version>1.2</jetty-test-policy.version>
<alpn.api.version>1.1.3.v20160715</alpn.api.version>
<jsp.version>8.5.35.1</jsp.version>
<infinispan.version>9.4.8.Final</infinispan.version>
<jnr-unixsocket.version>0.20</jnr-unixsocket.version>
<!-- for some reasons the version name of those files is different of the maven coordinates
see jetty-home pom where the transformation is done and server.mod file using it
-->
<servlet.api.distributed.version>3.1</servlet.api.distributed.version>
<jetty.schema.distributed.version>3.1</jetty.schema.distributed.version>
<!-- default values are unsupported, but required to be defined for reactor sanity reasons -->
<alpn.version>undefined</alpn.version>
<conscrypt.version>2.0.0</conscrypt.version>
Expand Down Expand Up @@ -442,7 +449,7 @@
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-assembly-descriptors</artifactId>
<version>1.0</version>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -1051,7 +1058,7 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
<version>0.20</version>
<version>${jnr-unixsocket.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -1145,6 +1152,31 @@
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/config</outputDirectory>
<resources>
<resource>
<directory>src/main/config</directory>
<filtering>true</filtering>
</resource>
</resources>
<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions tests/test-distribution/pom.xml
Expand Up @@ -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>
Expand Down
Expand Up @@ -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;

Expand All @@ -27,6 +29,9 @@
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;
Expand Down Expand Up @@ -204,4 +209,52 @@ public void testDemoBase() throws Exception
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);
}
}
}

0 comments on commit 4ad77b5

Please sign in to comment.