Skip to content
Closed
Show file tree
Hide file tree
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 @@ -32,11 +32,11 @@
*
* @author Andy Wilkinson
*/
public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void addARequestMappingToAnExistingController(ApplicationLauncher applicationLauncher) throws Exception {
void addARequestMappingToAnExistingController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
Expand All @@ -51,8 +51,7 @@ public void addARequestMappingToAnExistingController(ApplicationLauncher applica

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void removeARequestMappingFromAnExistingController(ApplicationLauncher applicationLauncher)
throws Exception {
void removeARequestMappingFromAnExistingController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
Expand All @@ -65,7 +64,7 @@ public void removeARequestMappingFromAnExistingController(ApplicationLauncher ap

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAController(ApplicationLauncher applicationLauncher) throws Exception {
void createAController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
Expand All @@ -81,7 +80,7 @@ public void createAController(ApplicationLauncher applicationLauncher) throws Ex

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAControllerAndThenAddARequestMapping(ApplicationLauncher applicationLauncher) throws Exception {
void createAControllerAndThenAddARequestMapping(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
Expand All @@ -99,8 +98,8 @@ public void createAControllerAndThenAddARequestMapping(ApplicationLauncher appli

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAControllerAndThenAddARequestMappingToAnExistingController(
ApplicationLauncher applicationLauncher) throws Exception {
void createAControllerAndThenAddARequestMappingToAnExistingController(ApplicationLauncher applicationLauncher)
throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
Expand All @@ -120,7 +119,7 @@ public void createAControllerAndThenAddARequestMappingToAnExistingController(

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void deleteAController(ApplicationLauncher applicationLauncher) throws Exception {
void deleteAController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
Expand All @@ -135,7 +134,7 @@ public void deleteAController(ApplicationLauncher applicationLauncher) throws Ex

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAControllerAndThenDeleteIt(ApplicationLauncher applicationLauncher) throws Exception {
void createAControllerAndThenDeleteIt(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
*
* @author Madhura Bhave
*/
public class DevToolsWithLazyInitializationIntegrationTests extends AbstractDevToolsIntegrationTests {
class DevToolsWithLazyInitializationIntegrationTests extends AbstractDevToolsIntegrationTests {

@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void addARequestMappingToAnExistingControllerWhenLazyInit(ApplicationLauncher applicationLauncher)
void addARequestMappingToAnExistingControllerWhenLazyInit(ApplicationLauncher applicationLauncher)
throws Exception {
launchApplication(applicationLauncher, "--spring.main.lazy-initialization=true");
TestRestTemplate template = new TestRestTemplate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,31 @@
* @author Andy Wilkinson
* @author Ali Shahbour
*/
public class SysVinitLaunchScriptIT {
class SysVinitLaunchScriptIT {

private final SpringBootDockerCmdExecFactory commandExecFactory = new SpringBootDockerCmdExecFactory();

private static final char ESC = 27;

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void statusWhenStopped(String os, String version) throws Exception {
void statusWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "status-when-stopped.sh");
assertThat(output).contains("Status: 3");
assertThat(output).has(coloredString(AnsiColor.RED, "Not running"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void statusWhenStarted(String os, String version) throws Exception {
void statusWhenStarted(String os, String version) throws Exception {
String output = doTest(os, version, "status-when-started.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void statusWhenKilled(String os, String version) throws Exception {
void statusWhenKilled(String os, String version) throws Exception {
String output = doTest(os, version, "status-when-killed.sh");
assertThat(output).contains("Status: 1");
assertThat(output)
Expand All @@ -94,31 +94,31 @@ public void statusWhenKilled(String os, String version) throws Exception {

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void stopWhenStopped(String os, String version) throws Exception {
void stopWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "stop-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void forceStopWhenStopped(String os, String version) throws Exception {
void forceStopWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "force-stop-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void startWhenStarted(String os, String version) throws Exception {
void startWhenStarted(String os, String version) throws Exception {
String output = doTest(os, version, "start-when-started.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Already running [" + extractPid(output) + "]"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void restartWhenStopped(String os, String version) throws Exception {
void restartWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "restart-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
Expand All @@ -127,7 +127,7 @@ public void restartWhenStopped(String os, String version) throws Exception {

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void restartWhenStarted(String os, String version) throws Exception {
void restartWhenStarted(String os, String version) throws Exception {
String output = doTest(os, version, "restart-when-started.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extract("PID1", output) + "]"));
Expand All @@ -137,88 +137,88 @@ public void restartWhenStarted(String os, String version) throws Exception {

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void startWhenStopped(String os, String version) throws Exception {
void startWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "start-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void basicLaunch(String os, String version) throws Exception {
void basicLaunch(String os, String version) throws Exception {
String output = doTest(os, version, "basic-launch.sh");
assertThat(output).doesNotContain("PID_FOLDER");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMissingLogFolderGeneratesAWarning(String os, String version) throws Exception {
void launchWithMissingLogFolderGeneratesAWarning(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-missing-log-folder.sh");
assertThat(output).has(
coloredString(AnsiColor.YELLOW, "LOG_FOLDER /does/not/exist does not exist. Falling back to /tmp"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMissingPidFolderGeneratesAWarning(String os, String version) throws Exception {
void launchWithMissingPidFolderGeneratesAWarning(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-missing-pid-folder.sh");
assertThat(output).has(
coloredString(AnsiColor.YELLOW, "PID_FOLDER /does/not/exist does not exist. Falling back to /tmp"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithSingleCommandLineArgument(String os, String version) throws Exception {
void launchWithSingleCommandLineArgument(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-single-command-line-argument.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMultipleCommandLineArguments(String os, String version) throws Exception {
void launchWithMultipleCommandLineArguments(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-multiple-command-line-arguments.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithSingleRunArg(String os, String version) throws Exception {
void launchWithSingleRunArg(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-single-run-arg.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMultipleRunArgs(String os, String version) throws Exception {
void launchWithMultipleRunArgs(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-multiple-run-args.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithSingleJavaOpt(String os, String version) throws Exception {
void launchWithSingleJavaOpt(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-single-java-opt.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithDoubleLinkSingleJavaOpt(String os, String version) throws Exception {
void launchWithDoubleLinkSingleJavaOpt(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-double-link-single-java-opt.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMultipleJavaOpts(String os, String version) throws Exception {
void launchWithMultipleJavaOpts(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-multiple-java-opts.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithUseOfStartStopDaemonDisabled(String os, String version) throws Exception {
void launchWithUseOfStartStopDaemonDisabled(String os, String version) throws Exception {
// CentOS doesn't have start-stop-daemon
Assumptions.assumeFalse(os.equals("CentOS"));
doLaunch(os, version, "launch-with-use-of-start-stop-daemon-disabled.sh");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithRelativePidFolder(String os, String version) throws Exception {
void launchWithRelativePidFolder(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-relative-pid-folder.sh");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
assertThat(output).has(coloredString(AnsiColor.GREEN, "Running [" + extractPid(output) + "]"));
Expand All @@ -227,72 +227,71 @@ public void launchWithRelativePidFolder(String os, String version) throws Except

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void pidFolderOwnership(String os, String version) throws Exception {
void pidFolderOwnership(String os, String version) throws Exception {
String output = doTest(os, version, "pid-folder-ownership.sh");
assertThat(output).contains("phil root");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void pidFileOwnership(String os, String version) throws Exception {
void pidFileOwnership(String os, String version) throws Exception {
String output = doTest(os, version, "pid-file-ownership.sh");
assertThat(output).contains("phil root");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void logFileOwnership(String os, String version) throws Exception {
void logFileOwnership(String os, String version) throws Exception {
String output = doTest(os, version, "log-file-ownership.sh");
assertThat(output).contains("phil root");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void logFileOwnershipIsChangedWhenCreated(String os, String version) throws Exception {
void logFileOwnershipIsChangedWhenCreated(String os, String version) throws Exception {
String output = doTest(os, version, "log-file-ownership-is-changed-when-created.sh");
assertThat(output).contains("andy root");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void logFileOwnershipIsUnchangedWhenExists(String os, String version) throws Exception {
void logFileOwnershipIsUnchangedWhenExists(String os, String version) throws Exception {
String output = doTest(os, version, "log-file-ownership-is-unchanged-when-exists.sh");
assertThat(output).contains("root root");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithRelativeLogFolder(String os, String version) throws Exception {
void launchWithRelativeLogFolder(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-relative-log-folder.sh");
assertThat(output).contains("Log written");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithRunAsUser(String os, String version) throws Exception {
void launchWithRunAsUser(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-user.sh");
assertThat(output).contains("wagner root");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void whenRunAsUserDoesNotExistLaunchFailsWithInvalidArgument(String os, String version) throws Exception {
void whenRunAsUserDoesNotExistLaunchFailsWithInvalidArgument(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-invalid-user.sh");
assertThat(output).contains("Status: 2");
assertThat(output).has(coloredString(AnsiColor.RED, "Cannot run as 'johndoe': no such user"));
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void whenJarOwnerAndRunAsUserAreBothSpecifiedRunAsUserTakesPrecedence(String os, String version)
throws Exception {
void whenJarOwnerAndRunAsUserAreBothSpecifiedRunAsUserTakesPrecedence(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-user-preferred-to-jar-owner.sh");
assertThat(output).contains("wagner root");
}

@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void whenLaunchedUsingNonRootUserWithRunAsUserSpecifiedLaunchFailsWithInsufficientPrivilege(String os,
void whenLaunchedUsingNonRootUserWithRunAsUserSpecifiedLaunchFailsWithInsufficientPrivilege(String os,
String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-user-root-required.sh");
assertThat(output).contains("Status: 4");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,17 @@
*/
@EmbeddedServletContainerTest(packaging = "jar",
launchers = { BootRunApplicationLauncher.class, IdeApplicationLauncher.class })
public class EmbeddedServletContainerJarDevelopmentIntegrationTests {
class EmbeddedServletContainerJarDevelopmentIntegrationTests {

@TestTemplate
public void metaInfResourceFromDependencyIsAvailableViaHttp(RestTemplate rest) {
void metaInfResourceFromDependencyIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}

@TestTemplate
@DisabledOnOs(OS.WINDOWS)
public void metaInfResourceFromDependencyWithNameThatContainsReservedCharactersIsAvailableViaHttp(
RestTemplate rest) {
void metaInfResourceFromDependencyWithNameThatContainsReservedCharactersIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity(
"/nested-reserved-%21%23%24%25%26%28%29%2A%2B%2C%3A%3D%3F%40%5B%5D-meta-inf-resource.txt",
String.class);
Expand All @@ -54,7 +53,7 @@ public void metaInfResourceFromDependencyWithNameThatContainsReservedCharactersI
}

@TestTemplate
public void metaInfResourceFromDependencyIsAvailableViaServletContext(RestTemplate rest) {
void metaInfResourceFromDependencyIsAvailableViaServletContext(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/servletContext?/nested-meta-inf-resource.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
Expand Down
Loading