Skip to content

Commit c5c7be2

Browse files
committed
Merge branch 'jetty-9.4.x'
2 parents f5d215b + 5e57b95 commit c5c7be2

File tree

53 files changed

+1097
-798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1097
-798
lines changed

apache-jstl/src/test/java/org/eclipse/jetty/jstl/JstlTest.java

+32-17
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919
package org.eclipse.jetty.jstl;
2020

2121
import static org.hamcrest.Matchers.containsString;
22+
import static org.hamcrest.Matchers.is;
2223
import static org.hamcrest.Matchers.not;
2324
import static org.junit.Assert.assertThat;
2425

2526
import java.io.File;
2627
import java.io.IOException;
28+
import java.io.InputStream;
29+
import java.net.HttpURLConnection;
2730
import java.net.URI;
31+
import java.nio.charset.StandardCharsets;
2832

2933
import javax.servlet.jsp.JspException;
3034

@@ -34,7 +38,7 @@
3438
import org.eclipse.jetty.toolchain.test.FS;
3539
import org.eclipse.jetty.toolchain.test.JAR;
3640
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
37-
import org.eclipse.jetty.toolchain.test.SimpleRequest;
41+
import org.eclipse.jetty.util.IO;
3842
import org.eclipse.jetty.webapp.Configuration;
3943
import org.eclipse.jetty.webapp.WebAppContext;
4044
import org.junit.AfterClass;
@@ -100,32 +104,43 @@ public static void stopServer() throws Exception
100104
@Test
101105
public void testUrlsBasic() throws IOException
102106
{
103-
SimpleRequest req = new SimpleRequest(baseUri);
104-
String resp = req.getString("/urls.jsp");
105-
assertThat("Response should be JSP processed", resp, not(containsString("<c:url")));
106-
assertThat("Response", resp, containsString("[c:url value] = /ref.jsp;jsessionid="));
107-
assertThat("Response", resp, containsString("[c:url param] = ref.jsp;key=value;jsessionid="));
107+
HttpURLConnection http = (HttpURLConnection) baseUri.resolve("/urls.jsp").toURL().openConnection();
108+
assertThat("http response", http.getResponseCode(), is(200));
109+
try(InputStream input = http.getInputStream())
110+
{
111+
String resp = IO.toString(input, StandardCharsets.UTF_8);
112+
assertThat("Response should be JSP processed", resp, not(containsString("<c:url")));
113+
assertThat("Response", resp, containsString("[c:url value] = /ref.jsp;jsessionid="));
114+
assertThat("Response", resp, containsString("[c:url param] = ref.jsp;key=value;jsessionid="));
115+
}
108116
}
109117

110118
@Test
111119
public void testCatchBasic() throws IOException
112120
{
113-
SimpleRequest req = new SimpleRequest(baseUri);
114-
String resp = req.getString("/catch-basic.jsp");
115-
assertThat("Response should be JSP processed", resp, not(containsString("<c:catch")));
116-
assertThat("Response", resp, containsString("[c:catch] exception : " + JspException.class.getName()));
117-
assertThat("Response", resp, containsString("[c:catch] exception.message : In &lt;parseNumber&gt;"));
121+
HttpURLConnection http = (HttpURLConnection) baseUri.resolve("/catch-basic.jsp").toURL().openConnection();
122+
assertThat("http response", http.getResponseCode(), is(200));
123+
try(InputStream input = http.getInputStream())
124+
{
125+
String resp = IO.toString(input, StandardCharsets.UTF_8);
126+
assertThat("Response should be JSP processed", resp, not(containsString("<c:catch")));
127+
assertThat("Response", resp, containsString("[c:catch] exception : " + JspException.class.getName()));
128+
assertThat("Response", resp, containsString("[c:catch] exception.message : In &lt;parseNumber&gt;"));
129+
}
118130
}
119131

120132
@Test
121133
@Ignore
122134
public void testCatchTaglib() throws IOException
123135
{
124-
SimpleRequest req = new SimpleRequest(baseUri);
125-
String resp = req.getString("/catch-taglib.jsp");
126-
System.out.println("resp = " + resp);
127-
assertThat("Response should be JSP processed", resp, not(containsString("<c:catch>")));
128-
assertThat("Response should be JSP processed", resp, not(containsString("<jtest:errorhandler>")));
129-
assertThat("Response", resp, not(containsString("[jtest:errorhandler] exception is null")));
136+
HttpURLConnection http = (HttpURLConnection) baseUri.resolve("/catch-taglib.jsp").toURL().openConnection();
137+
assertThat("http response", http.getResponseCode(), is(200));
138+
try(InputStream input = http.getInputStream())
139+
{
140+
String resp = IO.toString(input, StandardCharsets.UTF_8);
141+
assertThat("Response should be JSP processed", resp, not(containsString("<c:catch>")));
142+
assertThat("Response should be JSP processed", resp, not(containsString("<jtest:errorhandler>")));
143+
assertThat("Response", resp, not(containsString("[jtest:errorhandler] exception is null")));
144+
}
130145
}
131146
}

jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationParser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public void testBasedirExclusion() throws Exception
171171
// Intentionally using a base director name that starts with a "."
172172
// This mimics what you see in jenkins, hudson, hadoop, solr, camel, and selenium for their
173173
// installed and/or managed webapps
174-
File basedir = testdir.getFile(".base/workspace/classes");
174+
File basedir = testdir.getPathFile(".base/workspace/classes").toFile();
175175
FS.ensureEmpty(basedir);
176176

177177
// Copy in class that is known to have annotations.

jetty-ant/src/test/java/org/eclipse/jetty/ant/AntBuild.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void run()
6464
Project antProject = new Project();
6565
try
6666
{
67-
antProject.setBaseDir(MavenTestingUtils.getBasedir());
67+
antProject.setBaseDir(MavenTestingUtils.getBaseDir());
6868
antProject.setUserProperty("ant.file",buildFile.getAbsolutePath());
6969
DefaultLogger logger = new DefaultLogger();
7070

jetty-cdi/cdi-servlet/src/test/java/org/eclipse/jetty/cdi/servlet/WeldInitializationTest.java

+21-16
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@
1919
package org.eclipse.jetty.cdi.servlet;
2020

2121
import static org.hamcrest.Matchers.containsString;
22+
import static org.hamcrest.Matchers.is;
2223
import static org.junit.Assert.assertThat;
2324

2425
import java.io.File;
26+
import java.io.InputStream;
27+
import java.net.HttpURLConnection;
2528
import java.net.URI;
2629

2730
import org.eclipse.jetty.server.Server;
2831
import org.eclipse.jetty.server.ServerConnector;
2932
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
30-
import org.eclipse.jetty.toolchain.test.SimpleRequest;
33+
import org.eclipse.jetty.util.IO;
3134
import org.eclipse.jetty.util.log.JettyLogHandler;
3235
import org.eclipse.jetty.util.log.Log;
3336
import org.eclipse.jetty.util.log.Logger;
@@ -91,25 +94,27 @@ public static void stopServer()
9194
@Test
9295
public void testRequestParamServletDefault() throws Exception
9396
{
94-
SimpleRequest req = new SimpleRequest(serverHttpURI);
95-
String resp = req.getString("req-info");
96-
97-
System.out.println(resp);
98-
99-
assertThat("Response",resp,containsString("request is PRESENT"));
100-
assertThat("Response",resp,containsString("parameters.size = [0]"));
97+
HttpURLConnection http = (HttpURLConnection) serverHttpURI.resolve("req-info").toURL().openConnection();
98+
assertThat("response code", http.getResponseCode(), is(200));
99+
try(InputStream inputStream = http.getInputStream())
100+
{
101+
String resp = IO.toString(inputStream);
102+
assertThat("Response", resp, containsString("request is PRESENT"));
103+
assertThat("Response", resp, containsString("parameters.size = [0]"));
104+
}
101105
}
102106

103107
@Test
104108
public void testRequestParamServletAbc() throws Exception
105109
{
106-
SimpleRequest req = new SimpleRequest(serverHttpURI);
107-
String resp = req.getString("req-info?abc=123");
108-
109-
System.out.println(resp);
110-
111-
assertThat("Response",resp,containsString("request is PRESENT"));
112-
assertThat("Response",resp,containsString("parameters.size = [1]"));
113-
assertThat("Response",resp,containsString(" param[abc] = [123]"));
110+
HttpURLConnection http = (HttpURLConnection) serverHttpURI.resolve("req-info?abc=123").toURL().openConnection();
111+
assertThat("response code", http.getResponseCode(), is(200));
112+
try(InputStream inputStream = http.getInputStream())
113+
{
114+
String resp = IO.toString(inputStream);
115+
assertThat("Response", resp, containsString("request is PRESENT"));
116+
assertThat("Response", resp, containsString("parameters.size = [1]"));
117+
assertThat("Response", resp, containsString(" param[abc] = [123]"));
118+
}
114119
}
115120
}

jetty-deploy/src/test/java/org/eclipse/jetty/deploy/AppLifeCycleTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void testFindPathMultiple() throws IOException
176176
AppLifeCycle lifecycle = new AppLifeCycle();
177177
List<String> expected = new ArrayList<String>();
178178

179-
File outputDir = testdir.getEmptyDir();
179+
File outputDir = testdir.getEmptyPathDir().toFile();
180180

181181
// Modify graph to add new 'staging' -> 'staged' between 'deployed' and 'started'
182182
GraphOutputDot.write(lifecycle,new File(outputDir,"multiple-1.dot")); // before change

jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public XmlConfiguredJetty(TestingDir testdir) throws IOException
7070
_xmlConfigurations = new ArrayList<>();
7171
Properties properties = new Properties();
7272

73-
String jettyHomeBase = testdir.getDir().getAbsolutePath();
73+
String jettyHomeBase = testdir.getPath().toString();
7474
// Ensure we have a new (pristene) directory to work with.
7575
int idx = 0;
7676
_jettyHome = new File(jettyHomeBase + "#" + idx);
@@ -116,7 +116,7 @@ public XmlConfiguredJetty(TestingDir testdir) throws IOException
116116
System.setProperty("java.io.tmpdir",tmpDir.getAbsolutePath());
117117
properties.setProperty("jetty.home",_jettyHome.getAbsolutePath());
118118
System.setProperty("jetty.home",_jettyHome.getAbsolutePath());
119-
properties.setProperty("test.basedir",MavenTestingUtils.getBasedir().getAbsolutePath());
119+
properties.setProperty("test.basedir",MavenTestingUtils.getBaseDir().getAbsolutePath());
120120
properties.setProperty("test.resourcesdir",MavenTestingUtils.getTestResourcesDir().getAbsolutePath());
121121
properties.setProperty("test.webapps",webappsDir.getAbsolutePath());
122122
properties.setProperty("test.targetdir",MavenTestingUtils.getTargetDir().getAbsolutePath());

jetty-gcloud/jetty-gcloud-session-manager/pom.xml

+91
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>google-cloud-datastore</artifactId>
2222
<version>${gcloud.version}</version>
23+
<exclusions>
24+
<exclusion>
25+
<groupId>javax.servlet</groupId>
26+
<artifactId>servlet-api</artifactId>
27+
</exclusion>
28+
<exclusion>
29+
<groupId>javax.servlet</groupId>
30+
<artifactId>javax.servlet-api</artifactId>
31+
</exclusion>
32+
</exclusions>
33+
2334
</dependency>
2435
<dependency>
2536
<groupId>org.eclipse.jetty</groupId>
@@ -69,6 +80,86 @@
6980
</execution>
7081
</executions>
7182
</plugin>
83+
<plugin>
84+
<groupId>org.apache.maven.plugins</groupId>
85+
<artifactId>maven-dependency-plugin</artifactId>
86+
<version>3.0.0</version>
87+
<executions>
88+
<execution>
89+
<id>build-deps-file</id>
90+
<phase>generate-resources</phase>
91+
<goals>
92+
<goal>list</goal>
93+
</goals>
94+
<configuration>
95+
<appendOutput>false</appendOutput>
96+
<outputFile>${project.build.directory}/deps.txt</outputFile>
97+
<sort>true</sort>
98+
<prependGroupId>true</prependGroupId>
99+
<includeScope>runtime</includeScope>
100+
</configuration>
101+
</execution>
102+
</executions>
103+
</plugin>
104+
<plugin>
105+
<groupId>org.apache.maven.plugins</groupId>
106+
<artifactId>maven-antrun-plugin</artifactId>
107+
<executions>
108+
<execution>
109+
<id>process-deps</id>
110+
<phase>process-resources</phase>
111+
<goals>
112+
<goal>run</goal>
113+
</goals>
114+
<configuration>
115+
<tasks>
116+
<replaceregexp file="${project.build.directory}/deps.txt"
117+
match=" *(.*):(.*):jar:(.*):[a-z]*"
118+
replace="maven://\1/\2/\3|lib/gcloud/\2-\3.jar"
119+
byline="true"
120+
/>
121+
<replaceregexp file="${project.build.directory}/deps.txt"
122+
match="The following files have been resolved:"
123+
replace="[files]"
124+
/>
125+
</tasks>
126+
</configuration>
127+
</execution>
128+
<execution>
129+
<id>process-mod</id>
130+
<phase>process-resources</phase>
131+
<goals>
132+
<goal>run</goal>
133+
</goals>
134+
<configuration>
135+
<tasks>
136+
<concat destfile="${project.build.directory}/gcloud-datastore.mod">
137+
<fileset file="src/main/config-template/modules/gcloud-datastore.mod"/>
138+
<fileset file="${project.build.directory}/deps.txt"/>
139+
</concat>
140+
</tasks>
141+
</configuration>
142+
</execution>
143+
144+
</executions>
145+
</plugin>
146+
<plugin>
147+
<groupId>org.apache.maven.plugins</groupId>
148+
<artifactId>maven-assembly-plugin</artifactId>
149+
<executions>
150+
<execution>
151+
<phase>package</phase>
152+
<goals>
153+
<goal>single</goal>
154+
</goals>
155+
<configuration>
156+
<descriptors>
157+
<descriptor>src/main/assembly/config.xml</descriptor>
158+
</descriptors>
159+
</configuration>
160+
</execution>
161+
</executions>
162+
</plugin>
72163
</plugins>
73164
</build>
74165

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<assembly>
3+
<id>config</id>
4+
<includeBaseDirectory>false</includeBaseDirectory>
5+
<formats>
6+
<format>jar</format>
7+
</formats>
8+
<fileSets>
9+
<fileSet>
10+
<directory>src/main/config-template</directory>
11+
<outputDirectory></outputDirectory>
12+
<includes>
13+
<include>**</include>
14+
</includes>
15+
<excludes>
16+
<exclude>**/gcloud-datastore.mod</exclude>
17+
</excludes>
18+
</fileSet>
19+
<fileSet>
20+
<directory>target</directory>
21+
<outputDirectory>modules</outputDirectory>
22+
<includes>
23+
<include>gcloud-datastore.mod</include>
24+
</includes>
25+
</fileSet>
26+
</fileSets>
27+
</assembly>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[description]
2+
Enables GCloud Datastore API and implementation
3+
4+
[tags]
5+
3rdparty
6+
gcloud
7+
8+
[depends]
9+
gcloud
10+
jcl-slf4j
11+
jul-impl
12+

jetty-gcloud/jetty-gcloud-session-manager/src/main/config/modules/gcloud-datastore.mod

-58
This file was deleted.

0 commit comments

Comments
 (0)