Issue #5264 - Reworking test-distribution to use jetty-home

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2020-09-21 13:56:34 -05:00
parent ba78355bd6
commit 4ecff26022
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
8 changed files with 429 additions and 346 deletions

View File

@ -55,7 +55,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-distribution</artifactId>
<artifactId>jetty-home</artifactId>
<version>${project.version}</version>
<type>zip</type>
<scope>test</scope>

View File

@ -82,7 +82,7 @@ import org.slf4j.LoggerFactory;
* .build();
*
* // The first run initializes the Jetty Base.
* try (DistributionTester.Run run1 = distribution.start("--create-startd", "--add-to-start=http2c,jsp,deploy"))
* try (DistributionTester.Run run1 = distribution.start("--create-start-ini", "--add-modules=http2c,jsp,deploy"))
* {
* assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
* assertEquals(0, run1.getExitValue());
@ -107,13 +107,13 @@ import org.slf4j.LoggerFactory;
* }
* </pre>
*/
public class DistributionTester
public class JettyHomeTester
{
private static final Logger LOGGER = LoggerFactory.getLogger(DistributionTester.class);
private static final Logger LOGGER = LoggerFactory.getLogger(JettyHomeTester.class);
private Config config;
private DistributionTester(Config config)
private JettyHomeTester(Config config)
{
this.config = config;
}
@ -123,7 +123,7 @@ public class DistributionTester
*
* @param args arguments to use to start the distribution
*/
public DistributionTester.Run start(String... args) throws Exception
public JettyHomeTester.Run start(String... args) throws Exception
{
return start(Arrays.asList(args));
}
@ -143,7 +143,7 @@ public class DistributionTester
*
* @param args arguments to use to start the distribution
*/
public DistributionTester.Run start(List<String> args) throws Exception
public JettyHomeTester.Run start(List<String> args) throws Exception
{
File jettyBaseDir = config.jettyBase.toFile();
Path workDir = Files.createDirectories(jettyBaseDir.toPath().resolve("work"));
@ -245,11 +245,8 @@ public class DistributionTester
private void init() throws Exception
{
if (config.jettyDistro == null)
config.jettyDistro = resolveDistribution(config.jettyVersion);
if (config.jettyHome == null)
config.jettyHome = config.jettyDistro.resolve("jetty-home");
config.jettyHome = resolveHomeArtifact(config.jettyVersion);
if (config.jettyBase == null)
{
@ -260,7 +257,9 @@ public class DistributionTester
else
{
if (!config.jettyBase.isAbsolute())
config.jettyBase = config.jettyDistro.resolve(config.jettyBase);
{
throw new IllegalStateException("Jetty Base is not an absolute path: " + config.jettyBase);
}
}
}
@ -312,17 +311,19 @@ public class DistributionTester
}
}
private Path resolveDistribution(String version) throws Exception
private Path resolveHomeArtifact(String version) throws Exception
{
File artifactFile = resolveArtifact("org.eclipse.jetty:jetty-distribution:zip:" + version);
File artifactFile = resolveArtifact("org.eclipse.jetty:jetty-home:zip:" + version);
// create tmp directory to unzip distribution
Path tmp = Files.createTempDirectory("jetty_home_");
Path homes = MavenTestingUtils.getTargetTestingPath("homes");
FS.ensureDirExists(homes);
Path tmp = Files.createTempDirectory(homes, "jetty_home_");
File tmpFile = tmp.toFile();
unzip(artifactFile, tmpFile);
return tmp.resolve("jetty-distribution-" + version);
return tmp.resolve("jetty-home-" + version);
}
private RepositorySystem newRepositorySystem()
@ -373,7 +374,6 @@ public class DistributionTester
private static class Config
{
private Path jettyDistro;
private Path jettyBase;
private Path jettyHome;
private String jettyVersion;
@ -384,10 +384,9 @@ public class DistributionTester
@Override
public String toString()
{
return String.format("%s@%x{jettyDistro=%s, jettyBase=%s, jettyHome=%s, jettyVersion=%s, mavenLocalRepository=%s, mavenRemoteRepositories=%s}",
return String.format("%s@%x{jettyBase=%s, jettyHome=%s, jettyVersion=%s, mavenLocalRepository=%s, mavenRemoteRepositories=%s}",
getClass().getSimpleName(),
hashCode(),
jettyDistro,
jettyBase,
jettyHome,
jettyVersion,
@ -730,11 +729,11 @@ public class DistributionTester
}
/**
* @return a new configured instance of {@link DistributionTester}
* @return a new configured instance of {@link JettyHomeTester}
*/
public DistributionTester build() throws Exception
public JettyHomeTester build() throws Exception
{
DistributionTester tester = new DistributionTester(config);
JettyHomeTester tester = new JettyHomeTester(config);
tester.init();
return tester;
}

View File

@ -18,12 +18,17 @@
package org.eclipse.jetty.tests.distribution;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.function.Supplier;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.jupiter.api.AfterEach;
public class AbstractDistributionTest
public class AbstractJettyHomeTest
{
protected HttpClient client;
@ -38,6 +43,13 @@ public class AbstractDistributionTest
client.start();
}
public static Path newTestJettyBaseDirectory() throws IOException
{
Path bases = MavenTestingUtils.getTargetTestingPath("bases");
FS.ensureDirExists(bases);
return Files.createTempDirectory(bases, "jetty_base_");
}
@AfterEach
public void dispose() throws Exception
{

View File

@ -40,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests where the server is started with a Bad App that will fail in its init phase.
*/
public class BadAppTests extends AbstractDistributionTest
public class BadAppTests extends AbstractJettyHomeTest
{
/**
* Start a server where a bad webapp is being deployed.
@ -53,12 +53,12 @@ public class BadAppTests extends AbstractDistributionTest
public void testXmlThrowOnUnavailableTrue() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
try (DistributionTester.Run run1 = distribution.start("--add-to-start=http,deploy"))
try (JettyHomeTester.Run run1 = distribution.start("--add-modules=http,deploy"))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertThat(run1.getExitValue(), is(0));
@ -70,7 +70,7 @@ public class BadAppTests extends AbstractDistributionTest
"webapps/badapp.xml");
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitFor(5, TimeUnit.SECONDS), "Should have exited");
assertThat("Should have gotten a non-zero exit code", run2.getExitValue(), not(is(0)));
@ -90,12 +90,12 @@ public class BadAppTests extends AbstractDistributionTest
public void testXmlThrowOnUnavailableFalse() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
try (DistributionTester.Run run1 = distribution.start("--add-to-start=http,deploy"))
try (JettyHomeTester.Run run1 = distribution.start("--add-modules=http,deploy"))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertThat(run1.getExitValue(), is(0));
@ -107,7 +107,7 @@ public class BadAppTests extends AbstractDistributionTest
"webapps/badapp.xml");
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -132,12 +132,12 @@ public class BadAppTests extends AbstractDistributionTest
public void testNoXmlThrowOnUnavailableDefault() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
try (DistributionTester.Run run1 = distribution.start("--add-to-start=http,deploy"))
try (JettyHomeTester.Run run1 = distribution.start("--add-modules=http,deploy"))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertThat(run1.getExitValue(), is(0));
@ -147,7 +147,7 @@ public class BadAppTests extends AbstractDistributionTest
"webapps/badapp.war");
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -168,17 +168,16 @@ public class BadAppTests extends AbstractDistributionTest
public void testBadWebSocketWebapp(String arg) throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--approve-all-licenses",
"--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets,websocket"
"--add-modules=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets,websocket"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -189,7 +188,7 @@ public class BadAppTests extends AbstractDistributionTest
int port = distribution.freePort();
String[] args2 = {arg, "jetty.http.port=" + port};
try (DistributionTester.Run run2 = distribution.start(args2))
try (JettyHomeTester.Run run2 = distribution.start(args2))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
assertFalse(run2.getLogs().stream().anyMatch(s -> s.contains("LinkageError")));

View File

@ -1,243 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied:
// the Apache License v2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.tests.distribution;
import java.net.URI;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.util.FormRequestContent;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.util.Fields;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class DemoBaseTests extends AbstractDistributionTest
{
@Test
public void testJspDump() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(Paths.get("demo-base"))
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
String[] args = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (DistributionTester.Run run1 = distribution.start(args))
{
assertTrue(run1.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS));
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/jsp/dump.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("PathInfo"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
@Test
@Tag("external")
public void testAsyncRest() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(Paths.get("demo-base"))
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
String[] args = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (DistributionTester.Run run1 = distribution.start(args))
{
assertTrue(run1.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS));
startHttpClient();
ContentResponse response;
response = client.GET("http://localhost:" + httpPort + "/async-rest/testSerial?items=kayak");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Blocking: kayak"));
response = client.GET("http://localhost:" + httpPort + "/async-rest/testSerial?items=mouse,beer,gnome");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Blocking: mouse,beer,gnome"));
response = client.GET("http://localhost:" + httpPort + "/async-rest/testAsync?items=kayak");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Asynchronous: kayak"));
response = client.GET("http://localhost:" + httpPort + "/async-rest/testAsync?items=mouse,beer,gnome");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Asynchronous: mouse,beer,gnome"));
}
}
@Test
public void testSpec() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(Paths.get("demo-base"))
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
String[] args = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (DistributionTester.Run run1 = distribution.start(args))
{
assertTrue(run1.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS));
startHttpClient();
//test the async listener
ContentResponse response = client.POST("http://localhost:" + httpPort + "/test-spec/asy/xx").send();
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("<span class=\"pass\">PASS</span>"));
assertThat(response.getContentAsString(), not(containsString("<span class=\"fail\">FAIL</span>")));
//test the servlet 3.1/4 features
response = client.POST("http://localhost:" + httpPort + "/test-spec/test/xx").send();
assertThat(response.getContentAsString(), containsString("<span class=\"pass\">PASS</span>"));
assertThat(response.getContentAsString(), not(containsString("<span class=\"fail\">FAIL</span>")));
//test dynamic jsp
response = client.POST("http://localhost:" + httpPort + "/test-spec/dynamicjsp/xx").send();
assertThat(response.getContentAsString(), containsString("Programmatically Added Jsp File"));
}
}
@Test
public void testJPMS() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(Paths.get("demo-base"))
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
String[] args = {
"--jpms",
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (DistributionTester.Run run = distribution.start(args))
{
assertTrue(run.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/hello");
assertEquals(HttpStatus.OK_200, response.getStatus());
}
}
@Test
public void testSessionDump() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(Paths.get("demo-base"))
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
String[] args = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (DistributionTester.Run run = distribution.start(args))
{
assertTrue(run.awaitConsoleLogsFor("Started ", 10, TimeUnit.SECONDS));
startHttpClient();
client.setFollowRedirects(true);
ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/session/");
assertEquals(HttpStatus.OK_200, response.getStatus());
// Submit "New Session"
Fields form = new Fields();
form.add("Action", "New Session");
response = client.POST("http://localhost:" + httpPort + "/test/session/")
.body(new FormRequestContent(form))
.send();
assertEquals(HttpStatus.OK_200, response.getStatus());
String content = response.getContentAsString();
assertThat("Content", content, containsString("<b>test:</b> value<br/>"));
assertThat("Content", content, containsString("<b>WEBCL:</b> {}<br/>"));
// Last Location
URI location = response.getRequest().getURI();
// Submit a "Set" for a new entry in the cookie
form = new Fields();
form.add("Action", "Set");
form.add("Name", "Zed");
form.add("Value", "[alpha]");
response = client.POST(location)
.body(new FormRequestContent(form))
.send();
assertEquals(HttpStatus.OK_200, response.getStatus());
content = response.getContentAsString();
assertThat("Content", content, containsString("<b>Zed:</b> [alpha]<br/>"));
}
}
}

View File

@ -0,0 +1,321 @@
//
// ========================================================================
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied:
// the Apache License v2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.tests.distribution;
import java.net.URI;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.util.FormRequestContent;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.util.Fields;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class DemoModulesTests extends AbstractJettyHomeTest
{
@Test
public void testJspDump() throws Exception
{
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
String[] argsConfig = {
"--add-modules=demo-base"
};
try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
{
assertTrue(runConfig.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, runConfig.getExitValue());
String[] argsStart = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (JettyHomeTester.Run runStart = distribution.start(argsStart))
{
assertTrue(runStart.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS));
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/jsp/dump.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("PathInfo"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
}
@Test
@Tag("external")
public void testAsyncRest() throws Exception
{
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
String[] argsConfig = {
"--add-modules=demo-base"
};
try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
{
assertTrue(runConfig.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, runConfig.getExitValue());
String[] argsStart = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (JettyHomeTester.Run runStart = distribution.start(argsStart))
{
assertTrue(runStart.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS));
startHttpClient();
ContentResponse response;
response = client.GET("http://localhost:" + httpPort + "/async-rest/testSerial?items=kayak");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("Blocking: kayak"));
response = client.GET("http://localhost:" + httpPort + "/async-rest/testSerial?items=mouse,beer,gnome");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("Blocking: mouse,beer,gnome"));
response = client.GET("http://localhost:" + httpPort + "/async-rest/testAsync?items=kayak");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("Asynchronous: kayak"));
response = client.GET("http://localhost:" + httpPort + "/async-rest/testAsync?items=mouse,beer,gnome");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("Asynchronous: mouse,beer,gnome"));
}
}
}
@Test
public void testSpec() throws Exception
{
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
String[] argsConfig = {
"--add-modules=demo-base"
};
try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
{
assertTrue(runConfig.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, runConfig.getExitValue());
String[] argsStart = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (JettyHomeTester.Run runStart = distribution.start(argsStart))
{
assertTrue(runStart.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS));
startHttpClient();
//test the async listener
ContentResponse response = client.POST("http://localhost:" + httpPort + "/test-spec/asy/xx").send();
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("<span class=\"pass\">PASS</span>"));
assertThat(response.getContentAsString(), not(containsString("<span class=\"fail\">FAIL</span>")));
//test the servlet 3.1/4 features
response = client.POST("http://localhost:" + httpPort + "/test-spec/test/xx").send();
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("<span class=\"pass\">PASS</span>"));
assertThat(response.getContentAsString(), not(containsString("<span class=\"fail\">FAIL</span>")));
//test dynamic jsp
response = client.POST("http://localhost:" + httpPort + "/test-spec/dynamicjsp/xx").send();
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("Programmatically Added Jsp File"));
}
}
}
@Test
public void testJPMS() throws Exception
{
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] argsConfig = {
"--add-modules=demo-base"
};
try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
{
assertTrue(runConfig.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, runConfig.getExitValue());
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
String[] argsStart = {
"--jpms",
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (JettyHomeTester.Run runStart = distribution.start(argsStart))
{
assertTrue(runStart.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/hello");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
}
}
}
@Test
public void testSessionDump() throws Exception
{
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] argsConfig = {
"--add-modules=demo-base"
};
try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
{
assertTrue(runConfig.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, runConfig.getExitValue());
int httpPort = distribution.freePort();
int httpsPort = distribution.freePort();
String[] argsStart = {
"jetty.http.port=" + httpPort,
"jetty.httpConfig.port=" + httpsPort,
"jetty.ssl.port=" + httpsPort
};
try (JettyHomeTester.Run runStart = distribution.start(argsStart))
{
assertTrue(runStart.awaitConsoleLogsFor("Started ", 10, TimeUnit.SECONDS));
startHttpClient();
client.setFollowRedirects(true);
ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/session/");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
// Submit "New Session"
Fields form = new Fields();
form.add("Action", "New Session");
response = client.POST("http://localhost:" + httpPort + "/test/session/")
.body(new FormRequestContent(form))
.send();
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
String content = response.getContentAsString();
assertThat("Content", content, containsString("<b>test:</b> value<br/>"));
assertThat("Content", content, containsString("<b>WEBCL:</b> {}<br/>"));
// Last Location
URI location = response.getRequest().getURI();
// Submit a "Set" for a new entry in the cookie
form = new Fields();
form.add("Action", "Set");
form.add("Name", "Zed");
form.add("Value", "[alpha]");
response = client.POST(location)
.body(new FormRequestContent(form))
.send();
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
content = response.getContentAsString();
assertThat("Content", content, containsString("<b>Zed:</b> [alpha]<br/>"));
}
}
}
private class ResponseDetails implements Supplier<String>
{
private final ContentResponse response;
public ResponseDetails(ContentResponse response)
{
this.response = response;
}
@Override
public String get()
{
StringBuilder ret = new StringBuilder();
ret.append(response.toString()).append(System.lineSeparator());
ret.append(response.getHeaders().toString()).append(System.lineSeparator());
ret.append(response.getContentAsString()).append(System.lineSeparator());
return ret.toString();
}
}
}

View File

@ -63,24 +63,24 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class DistributionTests extends AbstractDistributionTest
public class DistributionTests extends AbstractJettyHomeTest
{
@Test
public void testStartStop() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
try (DistributionTester.Run run1 = distribution.start("--add-to-start=http"))
try (JettyHomeTester.Run run1 = distribution.start("--add-modules=http"))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -98,18 +98,17 @@ public class DistributionTests extends AbstractDistributionTest
public void testQuickStartGenerationAndRun() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--approve-all-licenses",
"--add-to-start=resources,server,http,webapp,deploy,jsp,servlet,servlets,quickstart"
"--add-modules=resources,server,http,webapp,deploy,jsp,servlet,servlets,quickstart"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -117,8 +116,7 @@ public class DistributionTests extends AbstractDistributionTest
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
try (DistributionTester.Run run2 = distribution.start("jetty.quickstart.mode=GENERATE"))
try (JettyHomeTester.Run run2 = distribution.start("jetty.quickstart.mode=GENERATE"))
{
assertTrue(run2.awaitConsoleLogsFor("QuickStartGeneratorConfiguration:main: Generated", 10, TimeUnit.SECONDS));
Path unpackedWebapp = distribution.getJettyBase().resolve("webapps").resolve("test");
@ -130,8 +128,8 @@ public class DistributionTests extends AbstractDistributionTest
assertNotEquals(0, Files.size(quickstartWebXml));
int port = distribution.freePort();
try (DistributionTester.Run run3 = distribution.start("jetty.http.port=" + port, "jetty.quickstart.mode=QUICKSTART"))
try (JettyHomeTester.Run run3 = distribution.start("jetty.http.port=" + port, "jetty.quickstart.mode=QUICKSTART"))
{
assertTrue(run3.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -148,27 +146,32 @@ public class DistributionTests extends AbstractDistributionTest
@Test
public void testSimpleWebAppWithJSP() throws Exception
{
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--create-start-ini",
"--approve-all-licenses",
"--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets"
"--add-modules=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
// Verify that --create-start-ini works
assertTrue(Files.exists(jettyBase.resolve("start.ini")));
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -186,17 +189,16 @@ public class DistributionTests extends AbstractDistributionTest
public void testSimpleWebAppWithJSPOnModulePath() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--approve-all-licenses",
"--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets"
"--add-modules=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -209,7 +211,7 @@ public class DistributionTests extends AbstractDistributionTest
"--jpms",
"jetty.http.port=" + port
};
try (DistributionTester.Run run2 = distribution.start(args2))
try (JettyHomeTester.Run run2 = distribution.start(args2))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -239,16 +241,15 @@ public class DistributionTests extends AbstractDistributionTest
private void testSimpleWebAppWithJSPOverHTTP2(boolean ssl) throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--add-to-start=jsp,deploy," + (ssl ? "http2,test-keystore" : "http2c")
"--add-modules=jsp,deploy," + (ssl ? "http2,test-keystore" : "http2c")
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -258,7 +259,7 @@ public class DistributionTests extends AbstractDistributionTest
int port = distribution.freePort();
String portProp = ssl ? "jetty.ssl.port" : "jetty.http.port";
try (DistributionTester.Run run2 = distribution.start(portProp + "=" + port))
try (JettyHomeTester.Run run2 = distribution.start(portProp + "=" + port))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -293,17 +294,16 @@ public class DistributionTests extends AbstractDistributionTest
assertTrue(Files.deleteIfExists(sockFile), "temp sock file cannot be deleted");
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--add-to-start=unixsocket-http,deploy,jsp",
"--add-modules=unixsocket-http,deploy,jsp",
"--approve-all-licenses"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
// Give it time to download the dependencies
assertTrue(run1.awaitFor(30, TimeUnit.SECONDS));
@ -312,7 +312,7 @@ public class DistributionTests extends AbstractDistributionTest
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.path=" + sockFile.toString()))
try (JettyHomeTester.Run run2 = distribution.start("jetty.unixsocket.path=" + sockFile.toString()))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -332,20 +332,19 @@ public class DistributionTests extends AbstractDistributionTest
@Test
public void testLog4j2ModuleWithSimpleWebAppWithJSP() throws Exception
{
Path jettyBase = Files.createTempDirectory("jetty_base");
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--approve-all-licenses",
"--add-to-start=resources,server,http,webapp,deploy,jsp,servlet,servlets,logging-log4j2"
"--add-modules=resources,server,http,webapp,deploy,jsp,servlet,servlets,logging-log4j2"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -355,7 +354,7 @@ public class DistributionTests extends AbstractDistributionTest
distribution.installWarFile(war, "test");
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -377,16 +376,15 @@ public class DistributionTests extends AbstractDistributionTest
public void testWebAppWithProxyAndJPMS() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--add-to-start=http,webapp,deploy,resources"
"--add-modules=http,webapp,deploy,resources"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -401,7 +399,7 @@ public class DistributionTests extends AbstractDistributionTest
distribution.installWarFile(war, "proxy");
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("--jpms", "jetty.http.port=" + port, "jetty.server.dumpAfterStart=true"))
try (JettyHomeTester.Run run2 = distribution.start("--jpms", "jetty.http.port=" + port, "jetty.server.dumpAfterStart=true"))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
@ -423,16 +421,15 @@ public class DistributionTests extends AbstractDistributionTest
public void testSimpleWebAppWithWebsocket(String arg) throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--approve-all-licenses",
"--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets,websocket"
"--add-modules=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets,websocket"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -448,7 +445,7 @@ public class DistributionTests extends AbstractDistributionTest
//"jetty.server.dumpAfterStart=true"
};
try (DistributionTester.Run run2 = distribution.start(args2))
try (JettyHomeTester.Run run2 = distribution.start(args2))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));
assertFalse(run2.getLogs().stream().anyMatch(s -> s.contains("LinkageError")));
@ -502,32 +499,31 @@ public class DistributionTests extends AbstractDistributionTest
@Test
public void testStartStopLog4j2Modules() throws Exception
{
Path jettyBase = Files.createTempDirectory("jetty_base");
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance() //
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance() //
.jettyVersion(jettyVersion) //
.jettyBase(jettyBase) //
.mavenLocalRepository(System.getProperty("mavenRepoPath")) //
.build();
String[] args = {
"--create-startd",
"--approve-all-licenses",
"--add-to-start=http,logging-log4j2"
"--add-modules=http,logging-log4j2"
};
try (DistributionTester.Run run1 = distribution.start(args))
try (JettyHomeTester.Run run1 = distribution.start(args))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
Files.copy(Paths.get("src/test/resources/log4j2.xml"), //
Paths.get(jettyBase.toString(),"resources").resolve("log4j2.xml"), //
StandardCopyOption.REPLACE_EXISTING);
Paths.get(jettyBase.toString(), "resources").resolve("log4j2.xml"), //
StandardCopyOption.REPLACE_EXISTING);
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitLogsFileFor(
jettyBase.resolve("logs").resolve("jetty.log"), //

View File

@ -36,25 +36,24 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class DynamicListenerTests
extends AbstractDistributionTest
extends AbstractJettyHomeTest
{
@Test
public void testSimpleWebAppWithJSP() throws Exception
{
Path jettyBase = Files.createTempDirectory("jetty_base");
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyBase(jettyBase)
.jettyVersion(jettyVersion)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args1 = {
"--create-startd",
"--approve-all-licenses",
"--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets,security,websocket"
"--add-modules=resources,server,http,webapp,deploy,jsp,jmx,servlet,servlets,security,websocket"
};
try (DistributionTester.Run run1 = distribution.start(args1))
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
@ -62,7 +61,7 @@ public class DynamicListenerTests
File war = distribution.resolveArtifact("org.eclipse.jetty:test-jetty-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
Path etc = Paths.get(jettyBase.toString(),"etc");
Path etc = Paths.get(jettyBase.toString(), "etc");
if (!Files.exists(etc))
{
Files.createDirectory(etc);
@ -76,7 +75,7 @@ public class DynamicListenerTests
etc.resolve("test-realm.xml"));
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitConsoleLogsFor("Started Server@", 10, TimeUnit.SECONDS));