use of org.springframework.context.support.StaticApplicationContext in project spring-boot by spring-projects.
the class MvcEndpointsTests method picksUpEndpointDelegatesFromParent.
@Test
public void picksUpEndpointDelegatesFromParent() throws Exception {
StaticApplicationContext parent = new StaticApplicationContext();
this.context.setParent(parent);
parent.getDefaultListableBeanFactory().registerSingleton("endpoint", new TestEndpoint());
this.endpoints.setApplicationContext(this.context);
this.endpoints.afterPropertiesSet();
assertThat(this.endpoints.getEndpoints()).hasSize(1);
}
use of org.springframework.context.support.StaticApplicationContext in project spring-boot by spring-projects.
the class CloudFoundryEndpointHandlerMappingTests method registersCloudFoundryHealthEndpoint.
@Test
public void registersCloudFoundryHealthEndpoint() throws Exception {
StaticApplicationContext context = new StaticApplicationContext();
HealthEndpoint delegate = new HealthEndpoint(new OrderedHealthAggregator(), Collections.<String, HealthIndicator>emptyMap());
CloudFoundryEndpointHandlerMapping handlerMapping = new CloudFoundryEndpointHandlerMapping(Collections.singleton(new TestHealthMvcEndpoint(delegate)), null, null);
handlerMapping.setPrefix("/test");
handlerMapping.setApplicationContext(context);
handlerMapping.afterPropertiesSet();
HandlerExecutionChain handler = handlerMapping.getHandler(new MockHttpServletRequest("GET", "/test/health"));
HandlerMethod handlerMethod = (HandlerMethod) handler.getHandler();
Object handlerMethodBean = handlerMethod.getBean();
assertThat(handlerMethodBean).isInstanceOf(CloudFoundryHealthMvcEndpoint.class);
}
use of org.springframework.context.support.StaticApplicationContext in project camel by apache.
the class CamelContextFactoryBeanTest method testCustomModelJAXBContextFactory.
public void testCustomModelJAXBContextFactory() throws Exception {
StaticApplicationContext applicationContext = new StaticApplicationContext();
applicationContext.registerSingleton("customModelJAXBContextFactory", CustomModelJAXBContextFactory.class);
factory.setApplicationContext(applicationContext);
factory.afterPropertiesSet();
ModelJAXBContextFactory modelJAXBContextFactory = factory.getContext().getModelJAXBContextFactory();
assertTrue(modelJAXBContextFactory instanceof CustomModelJAXBContextFactory);
}
use of org.springframework.context.support.StaticApplicationContext in project camel by apache.
the class CamelContextFactoryBeanTest method testGetCustomUuidGenerator.
public void testGetCustomUuidGenerator() throws Exception {
StaticApplicationContext applicationContext = new StaticApplicationContext();
applicationContext.registerSingleton("uuidGenerator", SimpleUuidGenerator.class);
factory.setApplicationContext(applicationContext);
factory.afterPropertiesSet();
UuidGenerator uuidGenerator = factory.getContext().getUuidGenerator();
assertTrue(uuidGenerator instanceof SimpleUuidGenerator);
}
use of org.springframework.context.support.StaticApplicationContext in project spring-framework by spring-projects.
the class ScriptTemplateViewTests method missingScriptTemplateConfig.
@Test
public void missingScriptTemplateConfig() throws Exception {
this.expectedException.expect(ApplicationContextException.class);
this.view.setApplicationContext(new StaticApplicationContext());
this.expectedException.expectMessage(contains("ScriptTemplateConfig"));
}
Aggregations