diff --git a/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionRunner.java b/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionTester.java similarity index 96% rename from tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionRunner.java rename to tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionTester.java index c0f4d66f45e..31f74f46e0d 100644 --- a/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionRunner.java +++ b/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionTester.java @@ -83,7 +83,7 @@ import org.eclipse.jetty.util.log.Logger; * So API can change without any further notice. *

*/ -public class DistributionRunner { +public class DistributionTester { private Process pid; @@ -105,7 +105,7 @@ public class DistributionRunner { private String jettyHome; private String mavenLocalRepository = System.getProperty("user.home") + "/.m2/repository"; - private static final Logger LOGGER = Log.getLogger(DistributionRunner.class); + private static final Logger LOGGER = Log.getLogger(DistributionTester.class); private List logs = new ArrayList<>(); @@ -113,17 +113,17 @@ public class DistributionRunner { private Map mavenRemoteRepositories = new HashMap<>(); - private DistributionRunner(Path jettyBase) + private DistributionTester(Path jettyBase) throws Exception { this.jettyBase = jettyBase; } /** * - * @return DistributionRunner setup jettyHome directory and start httpClient. + * @return DistributionTester setup jettyHome directory and start httpClient. * @throws Exception */ - private DistributionRunner initialise() throws Exception { + private DistributionTester initialise() throws Exception { if (StringUtils.isNotEmpty(jettyHome)) { jettyHomeDir = Paths.get(jettyHome).toFile(); @@ -261,7 +261,7 @@ public class DistributionRunner { // using LOGGER generates too long lines.. //LOGGER.info("[{}] {}",mode, line); System.out.println("[" + mode + "] " + line); - DistributionRunner.this.logs.add(line); + DistributionTester.this.logs.add(line); } } catch (IOException ignore) { // ignore @@ -698,25 +698,25 @@ public class DistributionRunner { /** * - * @return a new configured instance of {@link DistributionRunner} + * @return a new configured instance of {@link DistributionTester} * @throws Exception */ - public DistributionRunner build() + public DistributionTester build() throws Exception { if (jettyBase == null) { this.jettyBase = Files.createTempDirectory("jetty_base_test"); this.jettyBase.toFile().deleteOnExit(); } - DistributionRunner distributionRunner = new DistributionRunner(jettyBase); - distributionRunner.jettyVersion = jettyVersion; - distributionRunner.jettyHome = jettyHome; - distributionRunner.mavenLocalRepository = mavenLocalRepository; - distributionRunner.waitStartTime = waitStartTime; - distributionRunner.maxWaitToStop = maxWaitToStop; + DistributionTester distributionTester = new DistributionTester(jettyBase); + distributionTester.jettyVersion = jettyVersion; + distributionTester.jettyHome = jettyHome; + distributionTester.mavenLocalRepository = mavenLocalRepository; + distributionTester.waitStartTime = waitStartTime; + distributionTester.maxWaitToStop = maxWaitToStop; if(!this.mavenRemoteRepositories.isEmpty()) { - distributionRunner.mavenRemoteRepositories.putAll(this.mavenRemoteRepositories); + distributionTester.mavenRemoteRepositories.putAll(this.mavenRemoteRepositories); } - return distributionRunner.initialise(); + return distributionTester.initialise(); } } } diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/HttpModuleTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/HttpModuleTests.java index 0afef157e2b..08c3ae187a1 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/HttpModuleTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/HttpModuleTests.java @@ -21,32 +21,31 @@ package org.eclipse.jetty.tests.distribution; import org.junit.jupiter.api.Test; import java.io.File; -import java.nio.file.Path; public class HttpModuleTests { @Test public void http_module() throws Exception { - DistributionRunner distributionRunner = DistributionRunner.Builder.newInstance() // + DistributionTester distributionTester = DistributionTester.Builder.newInstance() // .jettyVersion(System.getProperty("jetty_version")) // .mavenLocalRepository(System.getProperty("mavenRepoPath")) // .waitStartTime(30) // .build(); // try { - distributionRunner.start("--create-startd", "--approve-all-licenses", "--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,jmx-remote,servlet,servlets"); - distributionRunner.stop(); + distributionTester.start("--create-startd", "--approve-all-licenses", "--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,jmx-remote,servlet,servlets"); + distributionTester.stop(); - File war = distributionRunner.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + System.getProperty("jetty_version")); - distributionRunner.installWarFile(war, "test"); - distributionRunner.start(); - distributionRunner.assertLogsContains("Started @"); - distributionRunner.assertUrlStatus("/test/index.jsp", 200); - distributionRunner.assertUrlContains("/test/index.jsp", "Hello"); + File war = distributionTester.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + System.getProperty("jetty_version")); + distributionTester.installWarFile(war, "test"); + distributionTester.start(); + distributionTester.assertLogsContains("Started @"); + distributionTester.assertUrlStatus("/test/index.jsp", 200); + distributionTester.assertUrlContains("/test/index.jsp", "Hello"); } finally { - distributionRunner.stop(); - distributionRunner.cleanup(); + distributionTester.stop(); + distributionTester.cleanup(); } } diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/JpmsActivatedTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/JpmsActivatedTests.java index cd7964cd6cf..2462626db7f 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/JpmsActivatedTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/JpmsActivatedTests.java @@ -19,11 +19,9 @@ package org.eclipse.jetty.tests.distribution; import java.io.File; -import java.nio.file.Path; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnJre; -import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; public class JpmsActivatedTests @@ -32,25 +30,25 @@ public class JpmsActivatedTests @DisabledOnJre(JRE.JAVA_8) public void jpms_activated() throws Exception { - DistributionRunner distributionRunner = DistributionRunner.Builder.newInstance() // + DistributionTester distributionTester = DistributionTester.Builder.newInstance() // .jettyVersion(System.getProperty("jetty_version")) // .mavenLocalRepository(System.getProperty("mavenRepoPath")) // .waitStartTime(30) // .build(); // try { - distributionRunner.start("--create-startd", "--approve-all-licenses", "--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,jmx-remote,servlet,servlets"); - distributionRunner.stop(); + distributionTester.start("--create-startd", "--approve-all-licenses", "--add-to-start=resources,server,http,webapp,deploy,jsp,jmx,jmx-remote,servlet,servlets"); + distributionTester.stop(); - File war = distributionRunner.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + System.getProperty("jetty_version")); - distributionRunner.installWarFile(war, "test"); - distributionRunner.start("--jpms"); - distributionRunner.assertLogsContains("Started @"); - distributionRunner.assertUrlStatus("/test/index.jsp", 200); - distributionRunner.assertUrlContains("/test/index.jsp", "Hello"); + File war = distributionTester.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + System.getProperty("jetty_version")); + distributionTester.installWarFile(war, "test"); + distributionTester.start("--jpms"); + distributionTester.assertLogsContains("Started @"); + distributionTester.assertUrlStatus("/test/index.jsp", 200); + distributionTester.assertUrlContains("/test/index.jsp", "Hello"); } finally { - distributionRunner.stop(); - distributionRunner.cleanup(); + distributionTester.stop(); + distributionTester.cleanup(); } }