Change package names zero->boot
* actuator -> boot-ops * cli -> boot-cli * launcher -> boot-load * autoconfig -> boot-config * bootstrap -> boot-strap * starters -> boot-up [#54095231] [bs-253] Refactor Zero->Boot
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.cli;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.boot.cli.command.CleanCommand;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class GrapesCleaner {
|
||||
|
||||
// FIXME get the version
|
||||
private static final String VERSION = "0.5.0.BUILD-SNAPSHOT";
|
||||
|
||||
public static void cleanIfNecessary() throws Exception {
|
||||
File installedJar = new File(getMavenRepository(), String.format(
|
||||
"org/springframework/boot/spring-boot-strap/%s/spring-boot-strap-%s.jar",
|
||||
VERSION, VERSION));
|
||||
File grapesJar = new File(
|
||||
getGrapesCache(),
|
||||
String.format(
|
||||
"org.springframework.boot/spring-boot-strap/jars/spring-boot-strap-%s.jar",
|
||||
VERSION));
|
||||
if (!VERSION.contains("SNAPSHOT") || installedJar.exists() && grapesJar.exists()
|
||||
&& installedJar.lastModified() <= grapesJar.lastModified()) {
|
||||
return;
|
||||
}
|
||||
new CleanCommand().run();
|
||||
}
|
||||
|
||||
private static File getMavenRepository() {
|
||||
return new File(System.getProperty("user.home"), ".m2/repository");
|
||||
}
|
||||
|
||||
private static File getGrapesCache() {
|
||||
return new File(System.getProperty("user.home"), ".groovy/grapes");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.cli;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
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.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class SampleIntegrationTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void cleanGrapes() throws Exception {
|
||||
GrapesCleaner.cleanIfNecessary();
|
||||
// System.setProperty("ivy.message.logger.level", "3");
|
||||
}
|
||||
|
||||
private RunCommand command;
|
||||
|
||||
private PrintStream savedOutput;
|
||||
|
||||
private ByteArrayOutputStream output;
|
||||
|
||||
private PrintStream savedErr;
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
this.savedOutput = System.out;
|
||||
this.savedErr = System.err;
|
||||
this.output = new ByteArrayOutputStream();
|
||||
System.setOut(new PrintStream(this.output));
|
||||
System.setErr(new PrintStream(this.output));
|
||||
}
|
||||
|
||||
@After
|
||||
public void clear() {
|
||||
System.setOut(this.savedOutput);
|
||||
System.setErr(this.savedErr);
|
||||
System.out.println(getOutput());
|
||||
}
|
||||
|
||||
private String getOutput() {
|
||||
return this.output.toString();
|
||||
}
|
||||
|
||||
private void start(final String... sample) throws Exception {
|
||||
Future<RunCommand> future = Executors.newSingleThreadExecutor().submit(
|
||||
new Callable<RunCommand>() {
|
||||
@Override
|
||||
public RunCommand call() throws Exception {
|
||||
RunCommand command = new RunCommand();
|
||||
command.run(sample);
|
||||
return command;
|
||||
}
|
||||
});
|
||||
this.command = future.get(4, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
@After
|
||||
public void stop() {
|
||||
if (this.command != null) {
|
||||
this.command.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appSample() throws Exception {
|
||||
start("samples/app.groovy");
|
||||
String output = getOutput();
|
||||
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void templateSample() throws Exception {
|
||||
start("samples/template.groovy");
|
||||
String output = getOutput();
|
||||
assertTrue("Wrong output: " + output, output.contains("Hello World!"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jobSample() throws Exception {
|
||||
start("samples/job.groovy", "foo=bar");
|
||||
String output = getOutput();
|
||||
assertTrue("Wrong output: " + output,
|
||||
output.contains("completed with the following parameters"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void reactorSample() throws Exception {
|
||||
start("samples/reactor.groovy", "Phil");
|
||||
String output = getOutput();
|
||||
int count = 0;
|
||||
while (!output.contains("Hello Phil") && count++ < 5) {
|
||||
Thread.sleep(200);
|
||||
output = getOutput();
|
||||
}
|
||||
assertTrue("Wrong output: " + output, output.contains("Hello Phil"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jobWebSample() throws Exception {
|
||||
start("samples/job.groovy", "samples/web.groovy", "foo=bar");
|
||||
String output = getOutput();
|
||||
assertTrue("Wrong output: " + output,
|
||||
output.contains("completed with the following parameters"));
|
||||
String result = FileUtil.readEntirely(new URL("http://localhost:8080")
|
||||
.openStream());
|
||||
assertEquals("World!", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void webSample() throws Exception {
|
||||
start("samples/web.groovy");
|
||||
String result = FileUtil.readEntirely(new URL("http://localhost:8080")
|
||||
.openStream());
|
||||
assertEquals("World!", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uiSample() throws Exception {
|
||||
start("samples/ui.groovy", "--classpath=.:src/test/resources");
|
||||
String result = FileUtil.readEntirely(new URL("http://localhost:8080")
|
||||
.openStream());
|
||||
assertTrue("Wrong output: " + result, result.contains("Hello World"));
|
||||
result = FileUtil.readEntirely(new URL(
|
||||
"http://localhost:8080/css/bootstrap.min.css").openStream());
|
||||
assertTrue("Wrong output: " + result, result.contains("container"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void opsSample() throws Exception {
|
||||
start("samples/ops.groovy");
|
||||
String result = FileUtil.readEntirely(new URL("http://localhost:8080")
|
||||
.openStream());
|
||||
assertEquals("{\"message\":\"Hello World!\"}", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void integrationSample() throws Exception {
|
||||
start("samples/integration.groovy");
|
||||
String output = getOutput();
|
||||
assertTrue("Wrong output: " + output, output.contains("Hello, World"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void xmlSample() throws Exception {
|
||||
start("samples/app.xml", "samples/runner.groovy");
|
||||
String output = getOutput();
|
||||
assertTrue("Wrong output: " + output, output.contains("Hello World"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package org.springframework.boot.cli;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.springframework.boot.cli.Command;
|
||||
import org.springframework.boot.cli.NoSuchCommandException;
|
||||
import org.springframework.boot.cli.SpringCli;
|
||||
import org.springframework.boot.cli.SpringCli.NoArgumentsException;
|
||||
import org.springframework.boot.cli.SpringCli.NoHelpCommandArgumentsException;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willThrow;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* Tests for {@link SpringCli}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class SpringCliTests {
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
private SpringCli cli;
|
||||
|
||||
@Mock
|
||||
private Command regularCommand;
|
||||
|
||||
private Set<Call> calls = EnumSet.noneOf(Call.class);
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
this.cli = new SpringCli() {
|
||||
|
||||
@Override
|
||||
protected void showUsage() {
|
||||
SpringCliTests.this.calls.add(Call.SHOW_USAGE);
|
||||
super.showUsage();
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void errorMessage(String message) {
|
||||
SpringCliTests.this.calls.add(Call.ERROR_MESSAGE);
|
||||
super.errorMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void printStackTrace(Exception ex) {
|
||||
SpringCliTests.this.calls.add(Call.PRINT_STACK_TRACE);
|
||||
super.printStackTrace(ex);
|
||||
}
|
||||
};
|
||||
given(this.regularCommand.getName()).willReturn("command");
|
||||
given(this.regularCommand.getDescription()).willReturn("A regular command");
|
||||
this.cli.setCommands(Arrays.asList(this.regularCommand));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runWithoutArguments() throws Exception {
|
||||
this.thrown.expect(NoArgumentsException.class);
|
||||
this.cli.run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runCommand() throws Exception {
|
||||
this.cli.run("command", "--arg1", "arg2");
|
||||
verify(this.regularCommand).run("--arg1", "arg2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingCommand() throws Exception {
|
||||
this.thrown.expect(NoSuchCommandException.class);
|
||||
this.cli.run("missing");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesSuccess() throws Exception {
|
||||
int status = this.cli.runAndHandleErrors("command");
|
||||
assertThat(status, equalTo(0));
|
||||
assertThat(this.calls, equalTo((Set<Call>) EnumSet.noneOf(Call.class)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesNoArgumentsException() throws Exception {
|
||||
int status = this.cli.runAndHandleErrors();
|
||||
assertThat(status, equalTo(1));
|
||||
assertThat(this.calls, equalTo((Set<Call>) EnumSet.of(Call.SHOW_USAGE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesNoSuchCommand() throws Exception {
|
||||
int status = this.cli.runAndHandleErrors("missing");
|
||||
assertThat(status, equalTo(1));
|
||||
assertThat(this.calls, equalTo((Set<Call>) EnumSet.of(Call.ERROR_MESSAGE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesRegularException() throws Exception {
|
||||
willThrow(new RuntimeException()).given(this.regularCommand).run();
|
||||
int status = this.cli.runAndHandleErrors("command");
|
||||
assertThat(status, equalTo(1));
|
||||
assertThat(this.calls, equalTo((Set<Call>) EnumSet.of(Call.ERROR_MESSAGE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesExceptionWithDashD() throws Exception {
|
||||
willThrow(new RuntimeException()).given(this.regularCommand).run();
|
||||
int status = this.cli.runAndHandleErrors("command", "-d");
|
||||
assertThat(status, equalTo(1));
|
||||
assertThat(this.calls, equalTo((Set<Call>) EnumSet.of(Call.ERROR_MESSAGE,
|
||||
Call.PRINT_STACK_TRACE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesExceptionWithDashDashDebug() throws Exception {
|
||||
willThrow(new RuntimeException()).given(this.regularCommand).run();
|
||||
int status = this.cli.runAndHandleErrors("command", "--debug");
|
||||
assertThat(status, equalTo(1));
|
||||
assertThat(this.calls, equalTo((Set<Call>) EnumSet.of(Call.ERROR_MESSAGE,
|
||||
Call.PRINT_STACK_TRACE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exceptionMessages() throws Exception {
|
||||
assertThat(new NoSuchCommandException("name").getMessage(),
|
||||
equalTo(SpringCli.CLI_APP + ": 'name' is not a valid command. See '"
|
||||
+ SpringCli.CLI_APP + " help'."));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void help() throws Exception {
|
||||
this.cli.run("help", "command");
|
||||
verify(this.regularCommand).getHelp();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void helpNoCommand() throws Exception {
|
||||
this.thrown.expect(NoHelpCommandArgumentsException.class);
|
||||
this.cli.run("help");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void helpUnknownCommand() throws Exception {
|
||||
this.thrown.expect(NoSuchCommandException.class);
|
||||
this.cli.run("help", "missing");
|
||||
}
|
||||
|
||||
private static enum Call {
|
||||
SHOW_USAGE, ERROR_MESSAGE, PRINT_STACK_TRACE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.cli.command;
|
||||
|
||||
import groovy.lang.GroovyObjectSupport;
|
||||
import groovy.lang.Script;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.cli.GrapesCleaner;
|
||||
import org.springframework.boot.cli.command.OptionHandler;
|
||||
import org.springframework.boot.cli.command.ScriptCommand;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Tests for {@link ScriptCommand}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class ScriptCommandTests {
|
||||
|
||||
public static boolean executed = false;
|
||||
|
||||
@BeforeClass
|
||||
public static void cleanGrapes() throws Exception {
|
||||
GrapesCleaner.cleanIfNecessary();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testMissing() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("missing");
|
||||
command.run("World");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScript() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("script");
|
||||
command.run("World");
|
||||
assertEquals("World",
|
||||
((String[]) ((Script) command.getMain()).getProperty("args"))[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocateFile() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand(
|
||||
"src/test/resources/commands/script.groovy");
|
||||
command.setPaths(new String[] { "." });
|
||||
command.run("World");
|
||||
assertEquals("World",
|
||||
((String[]) ((Script) command.getMain()).getProperty("args"))[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRunnable() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("runnable");
|
||||
command.run("World");
|
||||
assertTrue(executed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClosure() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("closure");
|
||||
command.run("World");
|
||||
assertTrue(executed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCommand() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("command");
|
||||
assertEquals("My script command", command.getUsageHelp());
|
||||
command.run("World");
|
||||
assertTrue(executed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateClassName() throws Exception {
|
||||
ScriptCommand command1 = new ScriptCommand("handler");
|
||||
ScriptCommand command2 = new ScriptCommand("command");
|
||||
assertNotSame(command1.getMain().getClass(), command2.getMain().getClass());
|
||||
assertEquals(command1.getMain().getClass().getName(), command2.getMain()
|
||||
.getClass().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOptions() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("handler");
|
||||
String out = ((OptionHandler) command.getMain()).getHelp();
|
||||
assertTrue("Wrong output: " + out, out.contains("--foo"));
|
||||
command.run("World", "--foo");
|
||||
assertTrue(executed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMixin() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("mixin");
|
||||
GroovyObjectSupport object = (GroovyObjectSupport) command.getMain();
|
||||
String out = (String) object.getProperty("help");
|
||||
assertTrue("Wrong output: " + out, out.contains("--foo"));
|
||||
command.run("World", "--foo");
|
||||
assertTrue(executed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMixinWithBlock() throws Exception {
|
||||
ScriptCommand command = new ScriptCommand("test");
|
||||
GroovyObjectSupport object = (GroovyObjectSupport) command.getMain();
|
||||
String out = (String) object.getProperty("help");
|
||||
System.err.println(out);
|
||||
assertTrue("Wrong output: " + out, out.contains("--foo"));
|
||||
command.run("World", "--foo", "--bar=2");
|
||||
assertTrue(executed);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
def run = { msg ->
|
||||
org.springframework.boot.cli.command.ScriptCommandTests.executed = true
|
||||
println "Hello ${msg}"
|
||||
}
|
||||
|
||||
run
|
||||
18
spring-boot-cli/src/test/resources/commands/command.groovy
Normal file
18
spring-boot-cli/src/test/resources/commands/command.groovy
Normal file
@@ -0,0 +1,18 @@
|
||||
package org.test.command
|
||||
|
||||
class TestCommand implements Command {
|
||||
|
||||
String name = "foo"
|
||||
|
||||
String description = "My script command"
|
||||
|
||||
String help = "No options"
|
||||
|
||||
String usageHelp = "Not very useful"
|
||||
|
||||
void run(String... args) {
|
||||
org.springframework.boot.cli.command.ScriptCommandTests.executed = true
|
||||
println "Hello ${args[0]}"
|
||||
}
|
||||
|
||||
}
|
||||
19
spring-boot-cli/src/test/resources/commands/handler.groovy
Normal file
19
spring-boot-cli/src/test/resources/commands/handler.groovy
Normal file
@@ -0,0 +1,19 @@
|
||||
package org.test.command
|
||||
|
||||
@Grab("org.eclipse.jgit:org.eclipse.jgit:2.3.1.201302201838-r")
|
||||
import org.eclipse.jgit.api.Git
|
||||
|
||||
class TestCommand extends OptionHandler {
|
||||
|
||||
void options() {
|
||||
option "foo", "Foo set"
|
||||
}
|
||||
|
||||
void run(OptionSet options) {
|
||||
// Demonstrate use of Grape.grab to load dependencies before running
|
||||
println "Clean : " + Git.open(".." as File).status().call().isClean()
|
||||
org.springframework.boot.cli.command.ScriptCommandTests.executed = true
|
||||
println "Hello ${options.nonOptionArguments()}: ${options.has('foo')}"
|
||||
}
|
||||
|
||||
}
|
||||
6
spring-boot-cli/src/test/resources/commands/mixin.groovy
Normal file
6
spring-boot-cli/src/test/resources/commands/mixin.groovy
Normal file
@@ -0,0 +1,6 @@
|
||||
void options() {
|
||||
option "foo", "Foo set"
|
||||
}
|
||||
|
||||
org.springframework.boot.cli.command.ScriptCommandTests.executed = true
|
||||
println "Hello ${options.nonOptionArguments()}: ${options.has('foo')}"
|
||||
11
spring-boot-cli/src/test/resources/commands/runnable.groovy
Normal file
11
spring-boot-cli/src/test/resources/commands/runnable.groovy
Normal file
@@ -0,0 +1,11 @@
|
||||
class TestCommand implements Runnable {
|
||||
def msg
|
||||
TestCommand(String msg) {
|
||||
this.msg = msg
|
||||
}
|
||||
void run() {
|
||||
org.springframework.boot.cli.command.ScriptCommandTests.executed = true
|
||||
println "Hello ${msg}"
|
||||
}
|
||||
}
|
||||
new TestCommand(args[0])
|
||||
@@ -0,0 +1 @@
|
||||
println "Hello ${args[0]}"
|
||||
7
spring-boot-cli/src/test/resources/commands/test.groovy
Normal file
7
spring-boot-cli/src/test/resources/commands/test.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
options {
|
||||
option "foo", "Foo set"
|
||||
option "bar", "Bar has an argument of type int" withOptionalArg() ofType Integer
|
||||
}
|
||||
|
||||
org.springframework.boot.cli.command.ScriptCommandTests.executed = true
|
||||
println "Hello ${options.nonOptionArguments()}: ${options.has('foo')} ${options.valueOf('bar')}"
|
||||
19
spring-boot-cli/src/test/resources/logback.xml
Normal file
19
spring-boot-cli/src/test/resources/logback.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="CONSOLE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } [%t] --- %-40.40logger{39} : %m%n%wex"/>
|
||||
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.bootstrap.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
|
||||
<!-- logger name="org.springframework" level="DEBUG"/-->
|
||||
|
||||
</configuration>
|
||||
11
spring-boot-cli/src/test/resources/static/css/bootstrap.min.css
vendored
Normal file
11
spring-boot-cli/src/test/resources/static/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
25
spring-boot-cli/src/test/resources/templates/home.html
Normal file
25
spring-boot-cli/src/test/resources/templates/home.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title th:text="${title}">Title</title>
|
||||
<link rel="stylesheet" th:href="@{/resources/css/bootstrap.min.css}"
|
||||
href="../../resources/css/bootstrap.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand" href="http://www.thymeleaf.org"> Thymeleaf -
|
||||
Plain </a>
|
||||
<ul class="nav">
|
||||
<li><a th:href="@{/}" href="home.html"> Home </a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h1 th:text="${title}">Title</h1>
|
||||
<div th:text="${message}">Fake content</div>
|
||||
<div id="created" th:text="${#dates.format(date)}">July 11,
|
||||
2012 2:17:16 PM CDT</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
1
spring-boot-cli/src/test/resources/templates/test.txt
Normal file
1
spring-boot-cli/src/test/resources/templates/test.txt
Normal file
@@ -0,0 +1 @@
|
||||
Hello ${message}!
|
||||
Reference in New Issue
Block a user