Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SpringBootWatcherIntegrationTest on macos #3013

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void withNoRemoteSecretThrowsException() {
@Test
void withAllRequirementsShouldStartWatcherProcess() throws Exception {
final Runtime runtime = mock(Runtime.class, RETURNS_DEEP_STUBS);
target.resolve("spring-boot-lib.jar").toFile().createNewFile();
target.resolve("spring-boot-devtools.jar").toFile().createNewFile();
FileUtils.write(target.resolve("application.properties").toFile(), "spring.devtools.remote.secret=this-is-a-test", StandardCharsets.UTF_8);
new SpringBootWatcher(runtime, watcherContext)
Expand All @@ -129,15 +130,19 @@ void withAllRequirementsShouldStartWatcherProcess() throws Exception {
&& new File(command[0]).exists()
&& command[1].equals("-cp")
&& command[2].contains(
absolutePath("spring-boot-lib.jar") + File.pathSeparator + absolutePath("spring-boot-devtools.jar"))
realPath("spring-boot-lib.jar") + File.pathSeparator + realPath("spring-boot-devtools.jar"))
&& command[3].equals("-Dspring.devtools.remote.secret=this-is-a-test")
&& command[4].equals("org.springframework.boot.devtools.RemoteSpringApplication")
&& command[5].matches("^http://localhost:\\d+$")
));
}

private String absolutePath(String jar) {
return project.resolve("target").resolve(jar).toFile().getAbsolutePath();
private String realPath(String jar) {
rohanKanojia marked this conversation as resolved.
Show resolved Hide resolved
try {
return project.resolve("target").resolve(jar).toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
}

}