Merge branch '1.2.x'

This commit is contained in:
Phillip Webb
2015-10-07 23:34:08 -07:00
507 changed files with 2659 additions and 2478 deletions

View File

@@ -38,8 +38,8 @@ public class CommandLineIT {
private final CommandLineInvoker cli = new CommandLineInvoker();
@Test
public void hintProducesListOfValidCommands() throws IOException,
InterruptedException {
public void hintProducesListOfValidCommands()
throws IOException, InterruptedException {
Invocation cli = this.cli.invoke("hint");
assertThat(cli.await(), equalTo(0));
assertThat("Unexpected error: \n" + cli.getErrorOutput(), cli.getErrorOutput()
@@ -48,8 +48,8 @@ public class CommandLineIT {
}
@Test
public void invokingWithNoArgumentsDisplaysHelp() throws IOException,
InterruptedException {
public void invokingWithNoArgumentsDisplaysHelp()
throws IOException, InterruptedException {
Invocation cli = this.cli.invoke();
assertThat(cli.await(), equalTo(1));
assertThat(cli.getErrorOutput().length(), equalTo(0));
@@ -57,8 +57,8 @@ public class CommandLineIT {
}
@Test
public void unrecognizedCommandsAreHandledGracefully() throws IOException,
InterruptedException {
public void unrecognizedCommandsAreHandledGracefully()
throws IOException, InterruptedException {
Invocation cli = this.cli.invoke("not-a-real-command");
assertThat(cli.await(), equalTo(1));
assertThat(cli.getErrorOutput(),

View File

@@ -38,8 +38,8 @@ import static org.junit.Assert.assertTrue;
*/
public class JarCommandIT {
private final CommandLineInvoker cli = new CommandLineInvoker(new File(
"src/it/resources/jar-command"));
private final CommandLineInvoker cli = new CommandLineInvoker(
new File("src/it/resources/jar-command"));
@Test
public void noArguments() throws Exception {
@@ -68,11 +68,12 @@ public class JarCommandIT {
assertThat(invocation.getErrorOutput(), equalTo(""));
invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "bad.groovy");
invocation.await();
assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length());
assertEquals(invocation.getErrorOutput(), 0,
invocation.getErrorOutput().length());
assertTrue(jar.exists());
Process process = new JavaExecutable().processBuilder("-jar",
jar.getAbsolutePath()).start();
Process process = new JavaExecutable()
.processBuilder("-jar", jar.getAbsolutePath()).start();
invocation = new Invocation(process);
invocation.await();
@@ -85,11 +86,12 @@ public class JarCommandIT {
Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(),
"jar.groovy");
invocation.await();
assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length());
assertEquals(invocation.getErrorOutput(), 0,
invocation.getErrorOutput().length());
assertTrue(jar.exists());
Process process = new JavaExecutable().processBuilder("-jar",
jar.getAbsolutePath()).start();
Process process = new JavaExecutable()
.processBuilder("-jar", jar.getAbsolutePath()).start();
invocation = new Invocation(process);
invocation.await();
@@ -107,14 +109,15 @@ public class JarCommandIT {
@Test
public void jarCreationWithIncludes() throws Exception {
File jar = new File("target/test-app.jar");
Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(),
"--include", "-public/**,-resources/**", "jar.groovy");
Invocation invocation = this.cli.invoke("jar", jar.getAbsolutePath(), "--include",
"-public/**,-resources/**", "jar.groovy");
invocation.await();
assertEquals(invocation.getErrorOutput(), 0, invocation.getErrorOutput().length());
assertEquals(invocation.getErrorOutput(), 0,
invocation.getErrorOutput().length());
assertTrue(jar.exists());
Process process = new JavaExecutable().processBuilder("-jar",
jar.getAbsolutePath()).start();
Process process = new JavaExecutable()
.processBuilder("-jar", jar.getAbsolutePath()).start();
invocation = new Invocation(process);
invocation.await();

View File

@@ -71,8 +71,8 @@ public final class CommandLineInvoker {
return pathname.isDirectory() && pathname.getName().contains("-bin");
}
})[0];
dir = new File(dir, dir.getName().replace("-bin", "")
.replace("spring-boot-cli", "spring"));
dir = new File(dir,
dir.getName().replace("-bin", "").replace("spring-boot-cli", "spring"));
dir = new File(dir, "bin");
File launchScript = new File(dir, isWindows() ? "spring.bat" : "spring");
Assert.state(launchScript.exists() && launchScript.isFile(),
@@ -99,10 +99,10 @@ public final class CommandLineInvoker {
public Invocation(Process process) {
this.process = process;
this.streamReaders.add(new Thread(new StreamReadingRunnable(this.process
.getErrorStream(), this.err)));
this.streamReaders.add(new Thread(new StreamReadingRunnable(this.process
.getInputStream(), this.out)));
this.streamReaders.add(new Thread(
new StreamReadingRunnable(this.process.getErrorStream(), this.err)));
this.streamReaders.add(new Thread(
new StreamReadingRunnable(this.process.getInputStream(), this.out)));
for (Thread streamReader : this.streamReaders) {
streamReader.start();
}