org.springframework.mock.web.MockAsyncContext Java Examples

The following examples show how to use org.springframework.mock.web.MockAsyncContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SseEventSinkContextProviderTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    provider = new SseEventSinkContextProvider();
    
    final Exchange exchange = mock(Exchange.class);
    final Endpoint endpoint = mock(Endpoint.class);
    final ContinuationProvider continuationProvider = mock(ContinuationProvider.class);
    
    final MockHttpServletResponse response = new MockHttpServletResponse();
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockAsyncContext ctx = new MockAsyncContext(request, response) {
        @Override
        public void start(Runnable runnable) {
            /* do nothing */
        } 
    };
    request.setAsyncContext(ctx);
    
    message = new MessageImpl();
    message.setExchange(exchange);
    message.put(ContinuationProvider.class.getName(), continuationProvider);
    message.put(AbstractHTTPDestination.HTTP_REQUEST, request);
    
    when(exchange.getEndpoint()).thenReturn(endpoint);
}
 
Example #2
Source File: SseBroadcasterImplTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Before
public void setUp() {
    broadcaster = new SseBroadcasterImpl();
    response = new MockHttpServletResponse();
    writer = mock(MessageBodyWriter.class);
    ctx = new MockAsyncContext(new MockHttpServletRequest(), response);
}