Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
commit
02bb5affd9
|
@ -69,6 +69,7 @@
|
|||
</includes>
|
||||
<systemPropertyVariables>
|
||||
<jetty.port.file>${jetty.port.file}</jetty.port.file>
|
||||
<context.path>/setbycontextxml</context.path>
|
||||
<pingServlet>true</pingServlet>
|
||||
<helloServlet>true</helloServlet>
|
||||
<contentCheck>Counter accessed 1 times.</contentCheck>
|
||||
|
@ -91,6 +92,7 @@
|
|||
<goal>start</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<contextXml>${basedir}/src/config/context.xml</contextXml>
|
||||
<systemProperties>
|
||||
<jetty.port.file>${jetty.port.file}</jetty.port.file>
|
||||
<jetty.deployMode>EMBED</jetty.deployMode>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
|
||||
<Set name="contextPath">/setbycontextxml</Set>
|
||||
|
||||
</Configure>
|
|
@ -43,6 +43,10 @@ public class IntegrationTestGetContent
|
|||
{
|
||||
int port = getPort();
|
||||
assertTrue(port > 0);
|
||||
String contextPath = getContextPath();
|
||||
if (contextPath.endsWith("/"))
|
||||
contextPath = contextPath.substring(0, contextPath.lastIndexOf('/'));
|
||||
|
||||
HttpClient httpClient = new HttpClient();
|
||||
try
|
||||
{
|
||||
|
@ -50,16 +54,16 @@ public class IntegrationTestGetContent
|
|||
|
||||
if (Boolean.getBoolean("helloServlet"))
|
||||
{
|
||||
String response = httpClient.GET("http://localhost:" + port + "/hello?name=beer").getContentAsString();
|
||||
String response = httpClient.GET("http://localhost:" + port + contextPath + "/hello?name=beer").getContentAsString();
|
||||
assertEquals("Hello beer", response.trim(), "it test " + System.getProperty("maven.it.name"));
|
||||
response = httpClient.GET("http://localhost:" + port + "/hello?name=foo").getContentAsString();
|
||||
response = httpClient.GET("http://localhost:" + port + contextPath + "/hello?name=foo").getContentAsString();
|
||||
assertEquals("Hello foo", response.trim(), "it test " + System.getProperty("maven.it.name"));
|
||||
System.out.println("helloServlet");
|
||||
}
|
||||
if (Boolean.getBoolean("pingServlet"))
|
||||
{
|
||||
System.out.println("pingServlet");
|
||||
String response = httpClient.GET("http://localhost:" + port + "/ping?name=beer").getContentAsString();
|
||||
String response = httpClient.GET("http://localhost:" + port + contextPath + "/ping?name=beer").getContentAsString();
|
||||
assertEquals("pong beer", response.trim(), "it test " + System.getProperty("maven.it.name"));
|
||||
System.out.println("pingServlet ok");
|
||||
}
|
||||
|
@ -67,7 +71,7 @@ public class IntegrationTestGetContent
|
|||
String pathToCheck = System.getProperty("pathToCheck");
|
||||
if (StringUtils.isNotBlank(contentCheck))
|
||||
{
|
||||
String url = "http://localhost:" + port;
|
||||
String url = "http://localhost:" + port + contextPath;
|
||||
if (pathToCheck != null)
|
||||
{
|
||||
url += pathToCheck;
|
||||
|
@ -79,9 +83,9 @@ public class IntegrationTestGetContent
|
|||
}
|
||||
if (Boolean.getBoolean("helloTestServlet"))
|
||||
{
|
||||
String response = httpClient.GET("http://localhost:" + port + "/testhello?name=beer").getContentAsString();
|
||||
String response = httpClient.GET("http://localhost:" + port + contextPath + "/testhello?name=beer").getContentAsString();
|
||||
assertEquals("Hello from test beer", response.trim(), "it test " + System.getProperty("maven.it.name"));
|
||||
response = httpClient.GET("http://localhost:" + port + "/testhello?name=foo").getContentAsString();
|
||||
response = httpClient.GET("http://localhost:" + port + contextPath + "/testhello?name=foo").getContentAsString();
|
||||
assertEquals("Hello from test foo", response.trim(), "it test " + System.getProperty("maven.it.name"));
|
||||
System.out.println("helloServlet");
|
||||
}
|
||||
|
@ -92,6 +96,11 @@ public class IntegrationTestGetContent
|
|||
}
|
||||
}
|
||||
|
||||
public static String getContextPath()
|
||||
{
|
||||
return System.getProperty("context.path", "/");
|
||||
}
|
||||
|
||||
public static int getPort()
|
||||
throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue