use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class SampleCouchbaseApplicationTests method testDefaultSettings.
@Test
public void testDefaultSettings() throws Exception {
try {
new SpringApplicationBuilder(SampleCouchbaseApplication.class).run("--server.port=0");
} catch (RuntimeException ex) {
if (serverNotRunning(ex)) {
return;
}
}
String output = this.outputCapture.toString();
assertThat(output).contains("firstName='Alice', lastName='Smith'");
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class ResourceServerTokenServicesConfigurationTests method asymmetricJwt.
@Test
public void asymmetricJwt() {
EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.resource.jwt.keyValue=" + PUBLIC_KEY);
this.context = new SpringApplicationBuilder(ResourceConfiguration.class).environment(this.environment).web(WebApplicationType.NONE).run();
DefaultTokenServices services = this.context.getBean(DefaultTokenServices.class);
assertThat(services).isNotNull();
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class ResourceServerTokenServicesConfigurationTests method useRemoteTokenServices.
@Test
public void useRemoteTokenServices() {
EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.resource.tokenInfoUri:http://example.com", "security.oauth2.resource.clientId=acme");
this.context = new SpringApplicationBuilder(ResourceConfiguration.class).environment(this.environment).web(WebApplicationType.NONE).run();
RemoteTokenServices services = this.context.getBean(RemoteTokenServices.class);
assertThat(services).isNotNull();
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class ShutdownParentEndpointTests method shutdownChild.
@Test
public void shutdownChild() throws Exception {
this.context = new SpringApplicationBuilder(Config.class).child(Empty.class).web(WebApplicationType.NONE).run();
CountDownLatch latch = this.context.getBean(Config.class).latch;
assertThat((String) getEndpointBean().invoke().get("message")).startsWith("Shutting down");
assertThat(this.context.isActive()).isTrue();
assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
}
use of org.springframework.boot.builder.SpringApplicationBuilder in project spring-boot by spring-projects.
the class LoggingApplicationListenerIntegrationTests method loggingPerformedDuringChildApplicationStartIsNotLost.
@Test
public void loggingPerformedDuringChildApplicationStartIsNotLost() {
new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).child(Config.class).web(WebApplicationType.NONE).listeners(new ApplicationListener<ApplicationStartingEvent>() {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void onApplicationEvent(ApplicationStartingEvent event) {
this.logger.info("Child application starting");
}
}).run();
assertThat(this.outputCapture.toString()).contains("Child application starting");
}
Aggregations