Expose timeToFirstMessage in Java/XML config
Issue: SPR-16531
This commit is contained in:
@@ -94,8 +94,8 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Test fixture for MessageBrokerBeanDefinitionParser.
|
||||
* See test configuration files websocket-config-broker-*.xml.
|
||||
* Test fixture for {@link MessageBrokerBeanDefinitionParser}.
|
||||
* Also see test configuration files websocket-config-broker-*.xml.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @author Artem Bilan
|
||||
@@ -147,6 +147,7 @@ public class MessageBrokerBeanDefinitionParserTests {
|
||||
assertEquals(Arrays.asList("v10.stomp", "v11.stomp", "v12.stomp"), subProtocolWsHandler.getSubProtocols());
|
||||
assertEquals(25 * 1000, subProtocolWsHandler.getSendTimeLimit());
|
||||
assertEquals(1024 * 1024, subProtocolWsHandler.getSendBufferSizeLimit());
|
||||
assertEquals(30 * 1000, subProtocolWsHandler.getTimeToFirstMessage());
|
||||
|
||||
Map<String, SubProtocolHandler> handlerMap = subProtocolWsHandler.getProtocolHandlerMap();
|
||||
StompSubProtocolHandler stompHandler = (StompSubProtocolHandler) handlerMap.get("v12.stomp");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
||||
import org.springframework.web.socket.TextMessage;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
import org.springframework.web.socket.config.WebSocketMessageBrokerStats;
|
||||
@@ -61,16 +60,11 @@ import org.springframework.web.socket.messaging.SubProtocolHandler;
|
||||
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
|
||||
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Test fixture for
|
||||
* {@link org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport}.
|
||||
* Test fixture for {@link WebSocketMessageBrokerConfigurationSupport}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
@@ -100,8 +94,8 @@ public class WebSocketMessageBrokerConfigurationSupportTests {
|
||||
session.setOpen(true);
|
||||
webSocketHandler.afterConnectionEstablished(session);
|
||||
|
||||
TextMessage textMessage = StompTextMessageBuilder.create(StompCommand.SEND).headers("destination:/foo").build();
|
||||
webSocketHandler.handleMessage(session, textMessage);
|
||||
webSocketHandler.handleMessage(session,
|
||||
StompTextMessageBuilder.create(StompCommand.SEND).headers("destination:/foo").build());
|
||||
|
||||
Message<?> message = channel.messages.get(0);
|
||||
StompHeaderAccessor accessor = StompHeaderAccessor.getAccessor(message, StompHeaderAccessor.class);
|
||||
@@ -145,6 +139,7 @@ public class WebSocketMessageBrokerConfigurationSupportTests {
|
||||
|
||||
assertEquals(1024 * 1024, subWsHandler.getSendBufferSizeLimit());
|
||||
assertEquals(25 * 1000, subWsHandler.getSendTimeLimit());
|
||||
assertEquals(30 * 1000, subWsHandler.getTimeToFirstMessage());
|
||||
|
||||
Map<String, SubProtocolHandler> handlerMap = subWsHandler.getProtocolHandlerMap();
|
||||
StompSubProtocolHandler protocolHandler = (StompSubProtocolHandler) handlerMap.get("v12.stomp");
|
||||
@@ -240,6 +235,7 @@ public class WebSocketMessageBrokerConfigurationSupportTests {
|
||||
registration.setMessageSizeLimit(128 * 1024);
|
||||
registration.setSendTimeLimit(25 * 1000);
|
||||
registration.setSendBufferSizeLimit(1024 * 1024);
|
||||
registration.setTimeToFirstMessage(30 * 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user