DistributionTester is definitely a better name
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
dd4041dae1
commit
214bc03270
|
@ -83,7 +83,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
* <b>So API can change without any further notice.</b>
|
||||
* </p>
|
||||
*/
|
||||
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<String> logs = new ArrayList<>();
|
||||
|
||||
|
@ -113,17 +113,17 @@ public class DistributionRunner {
|
|||
|
||||
private Map<String,String> 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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue