From 3adfdd34ec23f19e8795226d3ccdd397fc13246f Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 9 Oct 2013 10:16:01 -0400 Subject: [PATCH] Use simplified @Grab where possible --- spring-boot-cli/samples/actuator.groovy | 2 +- spring-boot-cli/samples/device.groovy | 10 ++++---- spring-boot-cli/samples/job.groovy | 2 +- spring-boot-cli/samples/simpleGrab.groovy | 24 ------------------- spring-boot-cli/samples/tx.groovy | 2 +- spring-boot-cli/samples/ui.groovy | 4 +--- .../boot/cli/SampleIntegrationTests.java | 13 +++------- spring-boot-dependencies/pom.xml | 2 +- 8 files changed, 13 insertions(+), 46 deletions(-) delete mode 100644 spring-boot-cli/samples/simpleGrab.groovy diff --git a/spring-boot-cli/samples/actuator.groovy b/spring-boot-cli/samples/actuator.groovy index 72dc5df16b..21e4df8f9a 100644 --- a/spring-boot-cli/samples/actuator.groovy +++ b/spring-boot-cli/samples/actuator.groovy @@ -1,6 +1,6 @@ package org.test -@Grab("org.springframework.boot:spring-boot-starter-actuator:0.5.0.BUILD-SNAPSHOT") +@Grab("spring-boot-starter-actuator") @Controller class SampleController { diff --git a/spring-boot-cli/samples/device.groovy b/spring-boot-cli/samples/device.groovy index 015a566bec..48719f84f8 100644 --- a/spring-boot-cli/samples/device.groovy +++ b/spring-boot-cli/samples/device.groovy @@ -6,15 +6,15 @@ class Example { @RequestMapping("/") @ResponseBody - public String helloWorld(Device device) { + String helloWorld(Device device) { if (device.isNormal()) { - return "Hello Normal Device!" + "Hello Normal Device!" } else if (device.isMobile()) { - return "Hello Mobile Device!" + "Hello Mobile Device!" } else if (device.isTablet()) { - return "Hello Tablet Device!" + "Hello Tablet Device!" } else { - return "Hello Unknown Device!" + "Hello Unknown Device!" } } diff --git a/spring-boot-cli/samples/job.groovy b/spring-boot-cli/samples/job.groovy index 4daddca98d..d6a49ec859 100644 --- a/spring-boot-cli/samples/job.groovy +++ b/spring-boot-cli/samples/job.groovy @@ -1,6 +1,6 @@ package org.test -@Grab("org.hsqldb:hsqldb-j5:2.0.0") +@Grab("hsqldb") @Configuration @EnableBatchProcessing class JobConfig { diff --git a/spring-boot-cli/samples/simpleGrab.groovy b/spring-boot-cli/samples/simpleGrab.groovy deleted file mode 100644 index 3528a0d30d..0000000000 --- a/spring-boot-cli/samples/simpleGrab.groovy +++ /dev/null @@ -1,24 +0,0 @@ -package org.test - -@Grab('spring-boot-starter-web') -@Component -class Example implements CommandLineRunner { - - @Autowired - private MyService myService - - void run(String... args) { - print "Hello " + this.myService.sayWorld() - } -} - - -@Service -class MyService { - - String sayWorld() { - return "World!" - } -} - - diff --git a/spring-boot-cli/samples/tx.groovy b/spring-boot-cli/samples/tx.groovy index a9b98fa719..09e2c59d32 100644 --- a/spring-boot-cli/samples/tx.groovy +++ b/spring-boot-cli/samples/tx.groovy @@ -1,6 +1,6 @@ package org.test -@Grab("org.hsqldb:hsqldb:2.2.9") +@Grab("hsqldb") @Configuration @EnableTransactionManagement diff --git a/spring-boot-cli/samples/ui.groovy b/spring-boot-cli/samples/ui.groovy index 4e07d9ac59..0d4f4e6024 100644 --- a/spring-boot-cli/samples/ui.groovy +++ b/spring-boot-cli/samples/ui.groovy @@ -1,8 +1,6 @@ package app -import groovy.util.logging.Log - -@Grab("org.thymeleaf:thymeleaf-spring3:2.0.16") +@Grab("thymeleaf-spring3") @Controller class Example { diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java index dd50531399..36d2f466a6 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java @@ -16,9 +16,6 @@ package org.springframework.boot.cli; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.File; import java.net.URL; import java.util.concurrent.Callable; @@ -37,6 +34,9 @@ import org.springframework.boot.OutputCapture; import org.springframework.boot.cli.command.CleanCommand; import org.springframework.boot.cli.command.RunCommand; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * Integration tests to exercise the samples. * @@ -95,13 +95,6 @@ public class SampleIntegrationTests { assertTrue("Wrong output: " + output, output.contains("Hello World")); } - @Test - public void simpleGrabSample() throws Exception { - start("samples/simpleGrab.groovy"); - String output = this.outputCapture.getOutputAndRelease(); - assertTrue("Wrong output: " + output, output.contains("Hello World")); - } - @Test public void templateSample() throws Exception { start("samples/template.groovy"); diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 26eea2d776..2001330c2c 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -33,7 +33,7 @@ 1.7.5 1.12 0.7-groovy-2.0 - 4.0.0.M3 + 4.0.0.BUILD-SNAPSHOT 3.2.0.RC1 2.2.4.RELEASE 1.0.0.M1