use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class MultipleResourceServerConfigurationTests method orderIsUnchangedWhenThereAreMultipleResourceServerConfigurations.
@Test
public void orderIsUnchangedWhenThereAreMultipleResourceServerConfigurations() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.register(DoubleResourceConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "security.oauth2.resource.tokenInfoUri:http://example.com", "security.oauth2.client.clientId=acme");
this.context.refresh();
assertThat(this.context.getBean("adminResources", ResourceServerConfiguration.class).getOrder()).isEqualTo(3);
assertThat(this.context.getBean("otherResources", ResourceServerConfiguration.class).getOrder()).isEqualTo(4);
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class FacebookAutoConfigurationTests method expectedSocialBeansCreated.
@Test
public void expectedSocialBeansCreated() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.social.facebook.appId:12345");
EnvironmentTestUtils.addEnvironment(this.context, "spring.social.facebook.appSecret:secret");
this.context.register(FacebookAutoConfiguration.class);
this.context.register(SocialWebAutoConfiguration.class);
this.context.refresh();
assertConnectionFrameworkBeans();
assertThat(this.context.getBean(Facebook.class)).isNotNull();
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class LinkedInAutoConfigurationTests method expectedSocialBeansCreated.
@Test
public void expectedSocialBeansCreated() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.social.linkedin.appId:12345");
EnvironmentTestUtils.addEnvironment(this.context, "spring.social.linkedin.appSecret:secret");
this.context.register(LinkedInAutoConfiguration.class);
this.context.register(SocialWebAutoConfiguration.class);
this.context.refresh();
assertConnectionFrameworkBeans();
assertThat(this.context.getBean(LinkedIn.class)).isNotNull();
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class TwitterAutoConfigurationTests method expectedSocialBeansCreated.
@Test
public void expectedSocialBeansCreated() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.social.twitter.appId:12345");
EnvironmentTestUtils.addEnvironment(this.context, "spring.social.twitter.appSecret:secret");
this.context.register(TwitterAutoConfiguration.class);
this.context.register(SocialWebAutoConfiguration.class);
this.context.refresh();
assertConnectionFrameworkBeans();
assertThat(this.context.getBean(Twitter.class)).isNotNull();
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class DispatcherServletAutoConfigurationTests method registrationOverrideWithDispatcherServletWrongName.
// If a DispatcherServlet instance is registered with a name different
// from the default one, we're registering one anyway
@Test
public void registrationOverrideWithDispatcherServletWrongName() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
this.context.register(CustomDispatcherServletWrongName.class, DispatcherServletAutoConfiguration.class);
this.context.setServletContext(new MockServletContext());
this.context.refresh();
ServletRegistrationBean<?> registration = this.context.getBean(ServletRegistrationBean.class);
assertThat(registration.getUrlMappings().toString()).isEqualTo("[/]");
assertThat(registration.getServletName()).isEqualTo("dispatcherServlet");
assertThat(this.context.getBeanNamesForType(DispatcherServlet.class).length).isEqualTo(2);
}
Aggregations