Skip to content

Commit 0c1aa19

Browse files
author
Dave Syer
committed
Add tests for loading dependencies in starters without parent
1 parent 578fadf commit 0c1aa19

File tree

5 files changed

+59
-4
lines changed

5 files changed

+59
-4
lines changed

spring-boot-cli/samples/actuator.groovy

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ package org.test
22

33
@Grab("spring-boot-starter-actuator")
44

5-
@Controller
5+
@RestController
66
class SampleController {
77

88
@RequestMapping("/")
9-
@ResponseBody
109
public def hello() {
1110
[message: "Hello World!"]
1211
}
1312
}
14-
15-

spring-boot-cli/samples/secure.groovy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.test
2+
3+
@Grab("spring-boot-starter-security")
4+
@Grab("spring-boot-starter-actuator")
5+
6+
@RestController
7+
class SampleController {
8+
9+
@RequestMapping("/")
10+
public def hello() {
11+
[message: "Hello World!"]
12+
}
13+
}

spring-boot-cli/src/test/java/org/springframework/boot/cli/ReproIntegrationTests.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,20 @@ public void grabAntBuilder() throws Exception {
3939
containsString("{\"message\":\"Hello World\"}"));
4040
}
4141

42+
// Security depends on old versions of Spring so if the dependencies aren't pinned
43+
// this will fail
44+
@Test
45+
public void securityDependencies() throws Exception {
46+
this.cli.run("secure.groovy");
47+
assertThat(this.cli.getHttpOutput(),
48+
containsString("{\"message\":\"Hello World\"}"));
49+
}
50+
51+
@Test
52+
public void shellDependencies() throws Exception {
53+
this.cli.run("crsh.groovy");
54+
assertThat(this.cli.getHttpOutput(),
55+
containsString("{\"message\":\"Hello World\"}"));
56+
}
57+
4258
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.test
2+
3+
@Grab("spring-boot-starter-shell-remote")
4+
5+
@RestController
6+
class SampleController {
7+
8+
@RequestMapping("/")
9+
public def hello() {
10+
[message: "Hello World!"]
11+
}
12+
}
13+
14+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.test
2+
3+
// No security features added just a test that the dependencies are resolved
4+
@Grab("spring-boot-starter-security")
5+
6+
@RestController
7+
class SampleController {
8+
9+
@RequestMapping("/")
10+
public def hello() {
11+
[message: "Hello World!"]
12+
}
13+
}
14+
15+

0 commit comments

Comments
 (0)