use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class AutoConfigurationReportLoggingInitializerTests method noErrorIfNotInitialized.
@Test
public void noErrorIfNotInitialized() throws Exception {
this.initializer.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[0], null, new RuntimeException("Planned")));
assertThat(this.infoLog.get(0)).contains("Unable to provide auto-configuration report");
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class RemoteSpringApplication method run.
private void run(String[] args) {
Restarter.initialize(args, RestartInitializer.NONE);
SpringApplication application = new SpringApplication(RemoteClientConfiguration.class);
application.setWebApplicationType(WebApplicationType.NONE);
application.setBanner(getBanner());
application.setInitializers(getInitializers());
application.setListeners(getListeners());
application.run(args);
waitIndefinitely();
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class SpringBootDependencyInjectionTestExecutionListenerTests method prepareFailingTestInstanceShouldPrintReport.
@Test
public void prepareFailingTestInstanceShouldPrintReport() throws Exception {
TestContext testContext = mock(TestContext.class);
given(testContext.getTestInstance()).willThrow(new IllegalStateException());
SpringApplication application = new SpringApplication(Config.class);
application.setWebApplicationType(WebApplicationType.NONE);
ConfigurableApplicationContext applicationContext = application.run();
given(testContext.getApplicationContext()).willReturn(applicationContext);
try {
this.reportListener.prepareTestInstance(testContext);
} catch (IllegalStateException ex) {
// Expected
}
this.out.expect(containsString("AUTO-CONFIGURATION REPORT"));
this.out.expect(containsString("Positive matches"));
this.out.expect(containsString("Negative matches"));
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class SpringApplicationAdminMXBeanRegistrarTests method eventsFromOtherContextsAreIgnored.
@Test
public void eventsFromOtherContextsAreIgnored() throws MalformedObjectNameException {
SpringApplicationAdminMXBeanRegistrar registrar = new SpringApplicationAdminMXBeanRegistrar(OBJECT_NAME);
ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
registrar.setApplicationContext(context);
registrar.onApplicationEvent(new ApplicationReadyEvent(new SpringApplication(), null, mock(ConfigurableApplicationContext.class)));
assertThat(isApplicationReady(registrar)).isFalse();
registrar.onApplicationEvent(new ApplicationReadyEvent(new SpringApplication(), null, context));
assertThat(isApplicationReady(registrar)).isTrue();
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class SpringApplicationAdminMXBeanRegistrarTests method environmentIsExposed.
@Test
public void environmentIsExposed() {
final ObjectName objectName = createObjectName(OBJECT_NAME);
SpringApplication application = new SpringApplication(Config.class);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run("--foo.bar=blam");
assertThat(isApplicationReady(objectName)).isTrue();
assertThat(isApplicationEmbeddedWebApplication(objectName)).isFalse();
assertThat(getProperty(objectName, "foo.bar")).isEqualTo("blam");
assertThat(getProperty(objectName, "does.not.exist.test")).isNull();
}
Aggregations