Convert thread to an actual application

User can now use spring boot CLI as before or alternatively just
java -jar the deployer app.
This commit is contained in:
Dave Syer
2016-12-15 14:43:48 +00:00
parent e3a0dc8395
commit 7e31e9b36c
7 changed files with 75 additions and 81 deletions

View File

@@ -25,26 +25,28 @@ import static org.junit.Assert.assertThat;
/**
* @author Spencer Gibb
*/
public class DeployerThreadTests {
public class DeployerApplicationTests {
@Rule
public OutputCapture output = new OutputCapture();
@Test
public void testCreateClassLoaderAndListDeployables() throws Exception {
new DeployerThread(DeployerThread.class.getClassLoader(), "--launcher.list=true").run();;
new DeployerApplication("--launcher.list=true").run();
assertThat(output.toString(), containsString("configserver"));
}
@Test
public void testNonOptionArgsPassedDown() throws Exception {
new DeployerThread(DeployerThread.class.getClassLoader(), "--launcher.list=true", "--spring.profiles.active=test").run();
new DeployerApplication("--launcher.list=true", "--spring.profiles.active=test")
.run();
assertThat(output.toString(), containsString("foo"));
}
@Test
public void testInvalidDeployableFails() throws Exception {
new DeployerThread(DeployerThread.class.getClassLoader(), "--launcher.deploy=foo,bar").run();
assertThat(output.toString(), containsString("The following are not valid: 'foo,bar'"));
new DeployerApplication("--launcher.deploy=foo,bar").run();
assertThat(output.toString(),
containsString("The following are not valid: 'foo,bar'"));
}
}