parent
c91e83c7d2
commit
38f0cf1ed2
@ -0,0 +1,16 @@
|
|||||||
|
package org.test
|
||||||
|
|
||||||
|
@GrabResolver(name='spring-snapshot', root='http://repo.springframework.org/snapshot')
|
||||||
|
@Grab("org.springframework.bootstrap:spring-bootstrap-service:0.0.1-SNAPSHOT")
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SampleController {
|
||||||
|
|
||||||
|
@RequestMapping("/")
|
||||||
|
@ResponseBody
|
||||||
|
public def hello() {
|
||||||
|
[message: "Hello World!"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* 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.bootstrap.cli;
|
||||||
|
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Dave Syer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SampleIntegrationTests {
|
||||||
|
|
||||||
|
private RunCommand command;
|
||||||
|
|
||||||
|
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(10, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void stop() {
|
||||||
|
if (this.command != null) {
|
||||||
|
this.command.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void clean() {
|
||||||
|
// SpringBootstrapCli.main("clean");
|
||||||
|
// System.setProperty("ivy.message.logger.level", "4");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void appSample() throws Exception {
|
||||||
|
start("samples/app.groovy");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void webSample() throws Exception {
|
||||||
|
start("samples/web.groovy");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void serviceSample() throws Exception {
|
||||||
|
start("samples/service.groovy");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
log4j.rootCategory=INFO, stdout
|
||||||
|
|
||||||
|
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
|
||||||
|
|
||||||
|
log4j.category.org.springframework.bootstrap=DEBUG
|
Loading…
Reference in New Issue