Search in sources :

Example 61 with AnnotationConfigWebApplicationContext

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);
}
Also used : ResourceServerConfiguration(org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration) AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext) Test(org.junit.Test)

Example 62 with AnnotationConfigWebApplicationContext

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();
}
Also used : AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext) Test(org.junit.Test)

Example 63 with AnnotationConfigWebApplicationContext

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();
}
Also used : AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext) Test(org.junit.Test)

Example 64 with AnnotationConfigWebApplicationContext

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();
}
Also used : AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext) Test(org.junit.Test)

Example 65 with AnnotationConfigWebApplicationContext

use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.

the class DispatcherServletAutoConfigurationTests method renamesMultipartResolver.

@Test
public void renamesMultipartResolver() throws Exception {
    this.context = new AnnotationConfigWebApplicationContext();
    this.context.setServletContext(new MockServletContext());
    this.context.register(MultipartResolverConfiguration.class, DispatcherServletAutoConfiguration.class);
    this.context.refresh();
    DispatcherServlet dispatcherServlet = this.context.getBean(DispatcherServlet.class);
    dispatcherServlet.onApplicationEvent(new ContextRefreshedEvent(this.context));
    assertThat(dispatcherServlet.getMultipartResolver()).isInstanceOf(MockMultipartResolver.class);
}
Also used : DispatcherServlet(org.springframework.web.servlet.DispatcherServlet) AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext) MockServletContext(org.springframework.mock.web.MockServletContext) ContextRefreshedEvent(org.springframework.context.event.ContextRefreshedEvent) Test(org.junit.Test)

Aggregations

AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)192 Test (org.junit.Test)129 MockServletContext (org.springframework.mock.web.MockServletContext)80 MockMvc (org.springframework.test.web.servlet.MockMvc)25 URI (java.net.URI)23 HashMap (java.util.HashMap)23 MapPropertySource (org.springframework.core.env.MapPropertySource)23 StandardEnvironment (org.springframework.core.env.StandardEnvironment)23 MessageSerDe (com.kixeye.chassis.transport.serde.MessageSerDe)21 DispatcherServlet (org.springframework.web.servlet.DispatcherServlet)16 ProtobufMessageSerDe (com.kixeye.chassis.transport.serde.converter.ProtobufMessageSerDe)15 RestTemplate (org.springframework.web.client.RestTemplate)15 ServiceError (com.kixeye.chassis.transport.dto.ServiceError)14 JsonJacksonMessageSerDe (com.kixeye.chassis.transport.serde.converter.JsonJacksonMessageSerDe)14 XmlMessageSerDe (com.kixeye.chassis.transport.serde.converter.XmlMessageSerDe)14 YamlJacksonMessageSerDe (com.kixeye.chassis.transport.serde.converter.YamlJacksonMessageSerDe)14 SerDeHttpMessageConverter (com.kixeye.chassis.transport.http.SerDeHttpMessageConverter)13 HttpMessageConverter (org.springframework.http.converter.HttpMessageConverter)13 QueuingWebSocketListener (com.kixeye.chassis.transport.websocket.QueuingWebSocketListener)9 WebSocketMessageRegistry (com.kixeye.chassis.transport.websocket.WebSocketMessageRegistry)9