|
|
|
@ -38,7 +38,7 @@ import static org.junit.Assert.assertTrue;
|
|
|
|
|
public class SampleIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Rule
|
|
|
|
|
public CliTester cli = new CliTester();
|
|
|
|
|
public CliTester cli = new CliTester("samples/");
|
|
|
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
|
public static void cleanGrapes() throws Exception {
|
|
|
|
@ -47,26 +47,26 @@ public class SampleIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void appSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/app.groovy");
|
|
|
|
|
String output = this.cli.run("app.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void templateSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/template.groovy");
|
|
|
|
|
String output = this.cli.run("template.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output, output.contains("Hello World!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void jobSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/job.groovy", "foo=bar");
|
|
|
|
|
String output = this.cli.run("job.groovy", "foo=bar");
|
|
|
|
|
assertTrue("Wrong output: " + output,
|
|
|
|
|
output.contains("completed with the following parameters"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void reactorSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/reactor.groovy", "Phil");
|
|
|
|
|
String output = this.cli.run("reactor.groovy", "Phil");
|
|
|
|
|
int count = 0;
|
|
|
|
|
while (!output.contains("Hello Phil") && count++ < 5) {
|
|
|
|
|
Thread.sleep(200);
|
|
|
|
@ -77,8 +77,7 @@ public class SampleIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void jobWebSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/job.groovy", "samples/web.groovy",
|
|
|
|
|
"foo=bar");
|
|
|
|
|
String output = this.cli.run("job.groovy", "web.groovy", "foo=bar");
|
|
|
|
|
assertTrue("Wrong output: " + output,
|
|
|
|
|
output.contains("completed with the following parameters"));
|
|
|
|
|
String result = this.cli.getHttpOutput();
|
|
|
|
@ -87,13 +86,13 @@ public class SampleIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void webSample() throws Exception {
|
|
|
|
|
this.cli.run("samples/web.groovy");
|
|
|
|
|
this.cli.run("web.groovy");
|
|
|
|
|
assertEquals("World!", this.cli.getHttpOutput());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void uiSample() throws Exception {
|
|
|
|
|
this.cli.run("samples/ui.groovy", "--classpath=.:src/test/resources");
|
|
|
|
|
this.cli.run("ui.groovy", "--classpath=.:src/test/resources");
|
|
|
|
|
String result = this.cli.getHttpOutput();
|
|
|
|
|
assertTrue("Wrong output: " + result, result.contains("Hello World"));
|
|
|
|
|
result = this.cli.getHttpOutput("http://localhost:8080/css/bootstrap.min.css");
|
|
|
|
@ -102,37 +101,37 @@ public class SampleIntegrationTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void actuatorSample() throws Exception {
|
|
|
|
|
this.cli.run("samples/actuator.groovy");
|
|
|
|
|
this.cli.run("actuator.groovy");
|
|
|
|
|
assertEquals("{\"message\":\"Hello World!\"}", this.cli.getHttpOutput());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void httpSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/http.groovy");
|
|
|
|
|
String output = this.cli.run("http.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void integrationSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/integration.groovy");
|
|
|
|
|
String output = this.cli.run("integration.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output, output.contains("Hello, World"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void xmlSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/runner.xml", "samples/runner.groovy");
|
|
|
|
|
String output = this.cli.run("runner.xml", "runner.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void txSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/tx.groovy");
|
|
|
|
|
String output = this.cli.run("tx.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output, output.contains("Foo count="));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void jmsSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/jms.groovy");
|
|
|
|
|
String output = this.cli.run("jms.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output,
|
|
|
|
|
output.contains("Received Greetings from Spring Boot via ActiveMQ"));
|
|
|
|
|
FileUtils.deleteDirectory(new File("activemq-data"));// cleanup ActiveMQ cruft
|
|
|
|
@ -142,14 +141,14 @@ public class SampleIntegrationTests {
|
|
|
|
|
@Ignore
|
|
|
|
|
// this test requires RabbitMQ to be run, so disable it be default
|
|
|
|
|
public void rabbitSample() throws Exception {
|
|
|
|
|
String output = this.cli.run("samples/rabbit.groovy");
|
|
|
|
|
String output = this.cli.run("rabbit.groovy");
|
|
|
|
|
assertTrue("Wrong output: " + output,
|
|
|
|
|
output.contains("Received Greetings from Spring Boot via RabbitMQ"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void deviceSample() throws Exception {
|
|
|
|
|
this.cli.run("samples/device.groovy");
|
|
|
|
|
this.cli.run("device.groovy");
|
|
|
|
|
assertEquals("Hello Normal Device!", this.cli.getHttpOutput());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|