Search in sources :

Example 1 with WebSessionManager

use of org.springframework.web.server.session.WebSessionManager in project spring-framework by spring-projects.

the class SessionAttributeMethodArgumentResolverTests method setup.

@Before
public void setup() throws Exception {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.refresh();
    ReactiveAdapterRegistry adapterRegistry = new ReactiveAdapterRegistry();
    this.resolver = new SessionAttributeMethodArgumentResolver(context.getBeanFactory(), adapterRegistry);
    this.session = mock(WebSession.class);
    WebSessionManager sessionManager = new MockWebSessionManager(this.session);
    ServerHttpRequest request = MockServerHttpRequest.get("/").build();
    this.exchange = new DefaultServerWebExchange(request, new MockServerHttpResponse(), sessionManager);
    this.handleMethod = ReflectionUtils.findMethod(getClass(), "handleWithSessionAttribute", (Class<?>[]) null);
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DefaultServerWebExchange(org.springframework.web.server.adapter.DefaultServerWebExchange) WebSession(org.springframework.web.server.WebSession) MockWebSessionManager(org.springframework.web.server.session.MockWebSessionManager) ReactiveAdapterRegistry(org.springframework.core.ReactiveAdapterRegistry) ServerHttpRequest(org.springframework.http.server.reactive.ServerHttpRequest) MockServerHttpRequest(org.springframework.mock.http.server.reactive.test.MockServerHttpRequest) MockWebSessionManager(org.springframework.web.server.session.MockWebSessionManager) WebSessionManager(org.springframework.web.server.session.WebSessionManager) MockServerHttpResponse(org.springframework.mock.http.server.reactive.test.MockServerHttpResponse) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 ReactiveAdapterRegistry (org.springframework.core.ReactiveAdapterRegistry)1 ServerHttpRequest (org.springframework.http.server.reactive.ServerHttpRequest)1 MockServerHttpRequest (org.springframework.mock.http.server.reactive.test.MockServerHttpRequest)1 MockServerHttpResponse (org.springframework.mock.http.server.reactive.test.MockServerHttpResponse)1 WebSession (org.springframework.web.server.WebSession)1 DefaultServerWebExchange (org.springframework.web.server.adapter.DefaultServerWebExchange)1 MockWebSessionManager (org.springframework.web.server.session.MockWebSessionManager)1 WebSessionManager (org.springframework.web.server.session.WebSessionManager)1