Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
3e35fd48
Commit
3e35fd48
authored
Aug 14, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait longer for server port and improve diagnostics on timeout
See gh-22909
parent
d0cd445a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
5 deletions
+24
-5
ApplicationState.java
...springframework/boot/devtools/tests/ApplicationState.java
+9
-4
JvmLauncher.java
.../org/springframework/boot/devtools/tests/JvmLauncher.java
+7
-0
LaunchedApplication.java
...ingframework/boot/devtools/tests/LaunchedApplication.java
+7
-0
RemoteApplicationLauncher.java
...mework/boot/devtools/tests/RemoteApplicationLauncher.java
+1
-1
No files found.
spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/ApplicationState.java
View file @
3e35fd48
...
...
@@ -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
);
}
}
spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/JvmLauncher.java
View file @
3e35fd48
...
...
@@ -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
;
}
...
...
spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/LaunchedApplication.java
View file @
3e35fd48
...
...
@@ -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
;
}
}
spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/RemoteApplicationLauncher.java
View file @
3e35fd48
...
...
@@ -101,7 +101,7 @@ abstract class RemoteApplicationLauncher extends AbstractApplicationLauncher {
}
private
int
awaitServerPort
(
LaunchedJvm
jvm
,
File
serverPortFile
)
throws
Exception
{
return
Awaitility
.
waitAtMost
(
Duration
.
ofSeconds
(
3
0
))
return
Awaitility
.
waitAtMost
(
Duration
.
ofSeconds
(
6
0
))
.
until
(()
->
new
ApplicationState
(
serverPortFile
,
jvm
),
ApplicationState:
:
hasServerPort
)
.
getServerPort
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment