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
a07833fb
Commit
a07833fb
authored
May 10, 2017
by
Andy Wilkinson
Committed by
Stephane Nicoll
Aug 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make BootRunIntegrationTests compatible with Java 9
Closes gh-10019
parent
3cf0f651
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
BootRunApplication.java
...-plugin/src/test/java/com/example/BootRunApplication.java
+5
-6
BootRunIntegrationTests.java
...mework/boot/gradle/tasks/run/BootRunIntegrationTests.java
+14
-9
No files found.
spring-boot-tools/spring-boot-gradle-plugin/src/test/java/com/example/BootRunApplication.java
View file @
a07833fb
...
...
@@ -16,8 +16,8 @@
package
com
.
example
;
import
java.
net.URL
;
import
java.
net.URLClassLoader
;
import
java.
io.File
;
import
java.
lang.management.ManagementFactory
;
/**
* Very basic application used for testing {@code BootRun}.
...
...
@@ -32,11 +32,10 @@ public class BootRunApplication {
public
static
void
main
(
String
[]
args
)
{
int
i
=
1
;
for
(
URL
url
:
((
URLClassLoader
)
BootRunApplication
.
class
.
getClassLoader
()
)
.
getURLs
(
))
{
System
.
out
.
println
(
i
++
+
". "
+
url
);
for
(
String
entry
:
ManagementFactory
.
getRuntimeMXBean
().
getClassPath
(
)
.
split
(
File
.
pathSeparator
))
{
System
.
out
.
println
(
i
++
+
". "
+
entry
);
}
}
}
spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootRunIntegrationTests.java
View file @
a07833fb
...
...
@@ -48,9 +48,12 @@ public class BootRunIntegrationTests {
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"src/main/resources"
).
mkdirs
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
getOutput
()).
contains
(
"1. "
+
urlOf
(
"build/classes/java/main"
));
assertThat
(
result
.
getOutput
()).
contains
(
"2. "
+
urlOf
(
"build/resources/main"
));
assertThat
(
result
.
getOutput
()).
doesNotContain
(
urlOf
(
"src/main/resources"
));
assertThat
(
result
.
getOutput
())
.
contains
(
"1. "
+
canonicalPathOf
(
"build/classes/java/main"
));
assertThat
(
result
.
getOutput
())
.
contains
(
"2. "
+
canonicalPathOf
(
"build/resources/main"
));
assertThat
(
result
.
getOutput
())
.
doesNotContain
(
canonicalPathOf
(
"src/main/resources"
));
}
@Test
...
...
@@ -58,9 +61,12 @@ public class BootRunIntegrationTests {
copyApplication
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
getOutput
()).
contains
(
"1. "
+
urlOf
(
"src/main/resources"
));
assertThat
(
result
.
getOutput
()).
contains
(
"2. "
+
urlOf
(
"build/classes/java/main"
));
assertThat
(
result
.
getOutput
()).
doesNotContain
(
urlOf
(
"build/resources/main"
));
assertThat
(
result
.
getOutput
())
.
contains
(
"1. "
+
canonicalPathOf
(
"src/main/resources"
));
assertThat
(
result
.
getOutput
())
.
contains
(
"2. "
+
canonicalPathOf
(
"build/classes/java/main"
));
assertThat
(
result
.
getOutput
())
.
doesNotContain
(
canonicalPathOf
(
"build/resources/main"
));
}
@Test
...
...
@@ -98,9 +104,8 @@ public class BootRunIntegrationTests {
FileSystemUtils
.
copyRecursively
(
new
File
(
"src/test/java/com/example"
),
output
);
}
private
String
urlOf
(
String
path
)
throws
IOException
{
return
new
File
(
this
.
gradleBuild
.
getProjectDir
().
getCanonicalFile
(),
path
).
toURI
()
.
toURL
().
toString
();
private
String
canonicalPathOf
(
String
path
)
throws
IOException
{
return
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
path
).
getCanonicalPath
();
}
}
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