Skip to content

Commit 3faa2bc

Browse files
Merge pull request #20 from janweinschenker/feature/jdk9
Feature/jdk9
2 parents 20408b6 + 97f117d commit 3faa2bc

File tree

10 files changed

+115
-16
lines changed

10 files changed

+115
-16
lines changed

client-jetty/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<plugin>
2929
<groupId>org.apache.maven.plugins</groupId>
3030
<artifactId>maven-surefire-plugin</artifactId>
31-
<version>2.19.1</version>
3231
<configuration>
3332
<!-- Sets the VM argument line used when unit tests are run. -->
3433
<argLine>${surefireArgLine}</argLine>

client-okhttp/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<plugin>
2929
<groupId>org.apache.maven.plugins</groupId>
3030
<artifactId>maven-surefire-plugin</artifactId>
31-
<version>2.19.1</version>
3231
<configuration>
3332
<!-- Sets the VM argument line used when unit tests are run. -->
3433
<argLine>${surefireArgLine}</argLine>

demo-util/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<plugin>
2323
<groupId>org.apache.maven.plugins</groupId>
2424
<artifactId>maven-surefire-plugin</artifactId>
25-
<version>2.19.1</version>
2625
<configuration>
2726
<!-- Sets the VM argument line used when unit tests are run. -->
2827
<argLine>${surefireArgLine}</argLine>

pom.xml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5959
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
6060
<java.version>9</java.version>
61+
62+
<!-- Dependency versions -->
6163
<jetty.version>9.4.7.v20170914</jetty.version>
6264
<spring-boot-starter.version>2.0.0.M5</spring-boot-starter.version>
6365
<lombok.version>1.16.18</lombok.version>
@@ -68,6 +70,16 @@
6870
<javax.servlet-api.version>4.0.0</javax.servlet-api.version>
6971
<httpclient5.version>5.0-alpha2</httpclient5.version>
7072
<tomcat-embed.version>9.0.1</tomcat-embed.version>
73+
<mockito-core.version>2.10.0</mockito-core.version>
74+
<assertj-core.version>3.8.0</assertj-core.version>
75+
76+
<!-- Plugin versions -->
77+
<dockerfile-maven-plugin.version>1.3.6</dockerfile-maven-plugin.version>
78+
<coveralls-maven-plugin.version>3.1.0</coveralls-maven-plugin.version>
79+
<maven-war-plugin.version>3.1.0</maven-war-plugin.version>
80+
<jacoco-maven-plugin.version>0.7.9</jacoco-maven-plugin.version>
81+
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
82+
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
7183

7284
<!-- server ports -->
7385
<server-jetty.https.port>8447</server-jetty.https.port>
@@ -76,8 +88,6 @@
7688
<server-tomcat.http.port>8089</server-tomcat.http.port>
7789
<server-undertow.https.port>8448</server-undertow.https.port>
7890
<server-undertow.http.port>8088</server-undertow.http.port>
79-
<mockito-core.version>2.10.0</mockito-core.version>
80-
<assertj-core.version>3.8.0</assertj-core.version>
8191
</properties>
8292

8393
<dependencyManagement>
@@ -256,7 +266,6 @@
256266
<plugin>
257267
<groupId>org.apache.maven.plugins</groupId>
258268
<artifactId>maven-compiler-plugin</artifactId>
259-
<version>3.7.0</version>
260269
<configuration>
261270
<source>9</source>
262271
<target>9</target>
@@ -266,7 +275,6 @@
266275
<plugin>
267276
<groupId>org.jacoco</groupId>
268277
<artifactId>jacoco-maven-plugin</artifactId>
269-
<version>0.7.9</version>
270278
<executions>
271279
<!--
272280
Prepares the property pointing to the JaCoCo runtime agent which
@@ -312,7 +320,6 @@
312320
<plugin>
313321
<groupId>org.eluder.coveralls</groupId>
314322
<artifactId>coveralls-maven-plugin</artifactId>
315-
<version>3.1.0</version>
316323
<configuration>
317324
<relativeReportDirs>
318325
<relativeReportDir>/jacoco-it</relativeReportDir>
@@ -331,7 +338,32 @@
331338
<plugin>
332339
<groupId>com.spotify</groupId>
333340
<artifactId>dockerfile-maven-plugin</artifactId>
334-
<version>1.3.6</version>
341+
<version>${dockerfile-maven-plugin.version}</version>
342+
</plugin>
343+
<plugin>
344+
<groupId>org.eluder.coveralls</groupId>
345+
<artifactId>coveralls-maven-plugin</artifactId>
346+
<version>${coveralls-maven-plugin.version}</version>
347+
</plugin>
348+
<plugin>
349+
<groupId>org.apache.maven.plugins</groupId>
350+
<artifactId>maven-war-plugin</artifactId>
351+
<version>${maven-war-plugin.version}</version>
352+
</plugin>
353+
<plugin>
354+
<groupId>org.jacoco</groupId>
355+
<artifactId>jacoco-maven-plugin</artifactId>
356+
<version>${jacoco-maven-plugin.version}</version>
357+
</plugin>
358+
<plugin>
359+
<groupId>org.apache.maven.plugins</groupId>
360+
<artifactId>maven-compiler-plugin</artifactId>
361+
<version>${maven-compiler-plugin.version}</version>
362+
</plugin>
363+
<plugin>
364+
<groupId>org.apache.maven.plugins</groupId>
365+
<artifactId>maven-surefire-plugin</artifactId>
366+
<version>${maven-surefire-plugin.version}</version>
335367
</plugin>
336368
</plugins>
337369
</pluginManagement>

server-glassfish/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
<plugin>
4444
<groupId>org.apache.maven.plugins</groupId>
4545
<artifactId>maven-compiler-plugin</artifactId>
46-
<version>3.7.0</version>
4746
<configuration>
4847
<verbose>true</verbose>
4948
<source>1.8</source>
@@ -74,7 +73,6 @@
7473
<plugin>
7574
<groupId>org.apache.maven.plugins</groupId>
7675
<artifactId>maven-surefire-plugin</artifactId>
77-
<version>2.19.1</version>
7876
<configuration>
7977
<!-- Sets the VM argument line used when unit tests are run. -->
8078
<argLine>${surefireArgLine}</argLine>
@@ -89,7 +87,6 @@
8987
<plugin>
9088
<groupId>org.apache.maven.plugins</groupId>
9189
<artifactId>maven-war-plugin</artifactId>
92-
<version>3.1.0</version>
9390
<configuration>
9491
<warName>Servlet4Push</warName>
9592
<failOnMissingWebXml>false</failOnMissingWebXml>

server-jetty/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
<plugin>
9999
<groupId>org.apache.maven.plugins</groupId>
100100
<artifactId>maven-surefire-plugin</artifactId>
101-
<version>2.19.1</version>
102101
<configuration>
103102
<!-- Sets the VM argument line used when unit tests are run. -->
104103
<argLine>${surefireArgLine}</argLine>

server-jetty/src/main/java/de/holisticon/servlet4demo/serverjetty/ApplicationConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import java.util.concurrent.TimeUnit;
66

7+
import org.assertj.core.util.VisibleForTesting;
78
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
89
import org.eclipse.jetty.http2.HTTP2Cipher;
910
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
@@ -46,6 +47,7 @@ public void addInterceptors(InterceptorRegistry registry) {
4647

4748
/**
4849
* Create the JettyServletWebServerFactory bean.
50+
*
4951
* @return JettyServletWebServerFactory
5052
*/
5153
@Bean
@@ -58,10 +60,12 @@ public JettyServletWebServerFactory jettyServletWebServerFactory() {
5860

5961
/**
6062
* Configure the http2 server.
63+
*
6164
* @param server the server
6265
* @return the server
6366
*/
64-
private Server configureServerForHttp2(Server server) {
67+
@VisibleForTesting
68+
Server configureServerForHttp2(Server server) {
6569
// HTTP Configuration
6670
HttpConfiguration http11Config = new HttpConfiguration();
6771
http11Config.setSecureScheme("https");
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package de.holisticon.servlet4demo.serverjetty;
2+
3+
import static org.mockito.ArgumentMatchers.any;
4+
import static org.mockito.Mockito.mock;
5+
import static org.mockito.Mockito.times;
6+
import static org.mockito.Mockito.verify;
7+
import static org.mockito.Mockito.when;
8+
9+
import org.eclipse.jetty.server.Server;
10+
import org.eclipse.jetty.server.ServerConnector;
11+
import org.eclipse.jetty.util.thread.ThreadPool;
12+
import org.junit.Before;
13+
import org.junit.Test;
14+
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
15+
import org.springframework.web.servlet.mvc.WebContentInterceptor;
16+
17+
public class ApplicationConfigTest {
18+
19+
private ApplicationConfig sut;
20+
21+
private InterceptorRegistry registry;
22+
23+
private Server server;
24+
25+
@Before
26+
public void setUp() {
27+
sut = new ApplicationConfig();
28+
server = mock(Server.class);
29+
registry = mock(InterceptorRegistry.class);
30+
when(server.getThreadPool()).thenReturn(new ThreadPool() {
31+
@Override
32+
public void join() throws InterruptedException {
33+
// Do nothing. This is just a unit test.
34+
}
35+
36+
@Override
37+
public int getThreads() {
38+
return 0;
39+
}
40+
41+
@Override
42+
public int getIdleThreads() {
43+
return 0;
44+
}
45+
46+
@Override
47+
public boolean isLowOnThreads() {
48+
return false;
49+
}
50+
51+
@Override
52+
public void execute(Runnable command) {
53+
// Do nothing. This is just a unit test.
54+
}
55+
});
56+
}
57+
58+
@Test
59+
public void testAddInterceptors() {
60+
sut.addInterceptors(registry);
61+
verify(registry, times(1)).addInterceptor(any(WebContentInterceptor.class));
62+
}
63+
64+
@Test
65+
public void testConfigureServerForHttp2() {
66+
sut.configureServerForHttp2(server);
67+
verify(server, times(1)).addConnector(any(ServerConnector.class));
68+
69+
}
70+
}
71+
72+

server-tomcat/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
<plugin>
8080
<groupId>org.apache.maven.plugins</groupId>
8181
<artifactId>maven-surefire-plugin</artifactId>
82-
<version>2.19.1</version>
8382
<configuration>
8483
<!-- Sets the VM argument line used when unit tests are run. -->
8584
<argLine>${surefireArgLine}</argLine>

server-undertow/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
<plugin>
7676
<groupId>org.apache.maven.plugins</groupId>
7777
<artifactId>maven-surefire-plugin</artifactId>
78-
<version>2.19.1</version>
7978
<configuration>
8079
<!-- Sets the VM argument line used when unit tests are run. -->
8180
<argLine>${surefireArgLine}</argLine>

0 commit comments

Comments
 (0)