Issue #3343 - Add an API/tools to be able to test Jetty Distribution.

Made sure web apps are unpacked in a directory
within $jetty.base to avoid cluttering /tmp.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-02-12 19:21:43 +01:00
parent 6aa917080f
commit 009a4659a7
1 changed files with 6 additions and 3 deletions

View File

@ -130,18 +130,21 @@ public class DistributionTester
*/
public DistributionTester.Run start(List<String> args) throws Exception
{
File jettyBaseDir = config.jettyBase.toFile();
Path workDir = Files.createDirectories(jettyBaseDir.toPath().resolve("work"));
List<String> commands = new ArrayList<>();
commands.add(getJavaExecutable());
commands.add("-Djava.io.tmpdir=" + workDir.toAbsolutePath().toString());
commands.add("-jar");
commands.add(config.jettyHome.toAbsolutePath() + "/start.jar");
commands.addAll(args);
File workingDir = config.jettyBase.toFile();
LOGGER.info("Executing: {}", commands);
LOGGER.info("Working Dir: {}", workingDir.getAbsolutePath());
LOGGER.info("Working Dir: {}", jettyBaseDir.getAbsolutePath());
ProcessBuilder pbCmd = new ProcessBuilder(commands);
pbCmd.directory(workingDir);
pbCmd.directory(jettyBaseDir);
Process process = pbCmd.start();
return new Run(process);