Merge branch '2.3.x'
This commit is contained in:
commit
c9b8a05321
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.boot.devtools.tests;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.springframework.boot.devtools.tests.JvmLauncher.LaunchedJvm;
|
||||
|
||||
|
|
@ -27,6 +28,8 @@ import org.springframework.boot.devtools.tests.JvmLauncher.LaunchedJvm;
|
|||
*/
|
||||
final class ApplicationState {
|
||||
|
||||
private final Instant launchTime;
|
||||
|
||||
private final Integer serverPort;
|
||||
|
||||
private final FileContents out;
|
||||
|
|
@ -34,17 +37,18 @@ final class ApplicationState {
|
|||
private final FileContents err;
|
||||
|
||||
ApplicationState(File serverPortFile, LaunchedJvm jvm) {
|
||||
this(serverPortFile, jvm.getStandardOut(), jvm.getStandardError());
|
||||
this(serverPortFile, jvm.getStandardOut(), jvm.getStandardError(), jvm.getLaunchTime());
|
||||
}
|
||||
|
||||
ApplicationState(File serverPortFile, LaunchedApplication application) {
|
||||
this(serverPortFile, application.getStandardOut(), application.getStandardError());
|
||||
this(serverPortFile, application.getStandardOut(), application.getStandardError(), application.getLaunchTime());
|
||||
}
|
||||
|
||||
private ApplicationState(File serverPortFile, File out, File err) {
|
||||
private ApplicationState(File serverPortFile, File out, File err, Instant launchTime) {
|
||||
this.serverPort = new FileContents(serverPortFile).get(Integer::parseInt);
|
||||
this.out = new FileContents(out);
|
||||
this.err = new FileContents(err);
|
||||
this.launchTime = launchTime;
|
||||
}
|
||||
|
||||
boolean hasServerPort() {
|
||||
|
|
@ -57,7 +61,8 @@ final class ApplicationState {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Application output:%n%s%n%s", this.out, this.err);
|
||||
return String.format("Application launched at %s produced output:%n%s%n%s", this.launchTime, this.out,
|
||||
this.err);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package org.springframework.boot.devtools.tests;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
@ -66,6 +67,8 @@ class JvmLauncher implements BeforeTestExecutionCallback {
|
|||
|
||||
private final Process process;
|
||||
|
||||
private final Instant launchTime = Instant.now();
|
||||
|
||||
private final File standardOut;
|
||||
|
||||
private final File standardError;
|
||||
|
|
@ -80,6 +83,10 @@ class JvmLauncher implements BeforeTestExecutionCallback {
|
|||
return this.process;
|
||||
}
|
||||
|
||||
Instant getLaunchTime() {
|
||||
return this.launchTime;
|
||||
}
|
||||
|
||||
File getStandardOut() {
|
||||
return this.standardOut;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.boot.devtools.tests;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.Instant;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
|
|
@ -36,6 +37,8 @@ class LaunchedApplication {
|
|||
|
||||
private Process remoteProcess;
|
||||
|
||||
private final Instant launchTime = Instant.now();
|
||||
|
||||
private final BiFunction<Integer, File, Process> remoteProcessRestarter;
|
||||
|
||||
LaunchedApplication(File classesDirectory, File standardOut, File standardError, Process localProcess,
|
||||
|
|
@ -79,4 +82,8 @@ class LaunchedApplication {
|
|||
return this.classesDirectory;
|
||||
}
|
||||
|
||||
Instant getLaunchTime() {
|
||||
return this.launchTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ abstract class RemoteApplicationLauncher extends AbstractApplicationLauncher {
|
|||
}
|
||||
|
||||
private int awaitServerPort(LaunchedJvm jvm, File serverPortFile) throws Exception {
|
||||
return Awaitility.waitAtMost(Duration.ofSeconds(30))
|
||||
return Awaitility.waitAtMost(Duration.ofSeconds(60))
|
||||
.until(() -> new ApplicationState(serverPortFile, jvm), ApplicationState::hasServerPort)
|
||||
.getServerPort();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue