Polish websocket xml namespace

Issue: SPR-11063
This commit is contained in:
Rossen Stoyanchev
2013-12-02 15:25:09 -05:00
parent 92e144a8a8
commit 47ef45d152
6 changed files with 54 additions and 25 deletions

View File

@@ -35,6 +35,7 @@ import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.messaging.StompSubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
@@ -47,7 +48,9 @@ import java.util.Map;
import static org.junit.Assert.*;
/**
* Test fixture for the configuration in websocket-config-broker*.xml test files.
* Test fixture for MessageBrokerBeanDefinitionParser.
* See test configuration files websocket-config-broker-*.xml.
*
* @author Brian Clozel
*/
public class MessageBrokerBeanDefinitionParserTests {
@@ -82,6 +85,10 @@ public class MessageBrokerBeanDefinitionParserTests {
SubProtocolWebSocketHandler subProtocolWsHandler = (SubProtocolWebSocketHandler) wsHandler;
assertEquals(Arrays.asList("v10.stomp", "v11.stomp", "v12.stomp"), subProtocolWsHandler.getSubProtocols());
StompSubProtocolHandler stompHandler =
(StompSubProtocolHandler) subProtocolWsHandler.getProtocolHandlerMap().get("v12.stomp");
assertNotNull(stompHandler);
httpRequestHandler = (HttpRequestHandler) suhm.getUrlMap().get("/test/**");
assertNotNull(httpRequestHandler);
assertThat(httpRequestHandler, Matchers.instanceOf(SockJsHttpRequestHandler.class));
@@ -91,12 +98,20 @@ public class MessageBrokerBeanDefinitionParserTests {
assertThat(wsHandler, Matchers.instanceOf(SubProtocolWebSocketHandler.class));
assertNotNull(sockJsHttpRequestHandler.getSockJsService());
UserSessionRegistry userSessionRegistry = this.appContext.getBean(UserSessionRegistry.class);
assertNotNull(userSessionRegistry);
UserDestinationResolver userDestResolver = this.appContext.getBean(UserDestinationResolver.class);
assertNotNull(userDestResolver);
assertThat(userDestResolver, Matchers.instanceOf(DefaultUserDestinationResolver.class));
DefaultUserDestinationResolver defaultUserDestResolver = (DefaultUserDestinationResolver) userDestResolver;
assertEquals("/personal/", defaultUserDestResolver.getDestinationPrefix());
assertSame(stompHandler.getUserSessionRegistry(), defaultUserDestResolver.getUserSessionRegistry());
UserDestinationMessageHandler userDestHandler = this.appContext.getBean(UserDestinationMessageHandler.class);
assertNotNull(userDestHandler);
List<Class<? extends MessageHandler>> subscriberTypes =
Arrays.<Class<? extends MessageHandler>>asList(SimpAnnotationMethodMessageHandler.class,
UserDestinationMessageHandler.class, SimpleBrokerMessageHandler.class);

View File

@@ -64,7 +64,7 @@ import static org.junit.Assert.assertTrue;
/**
* Test fixture for HandlersBeanDefinitionParser.
* See test configuration files websocket-config-handlers*.xml.
* See test configuration files websocket-config-handlers-*.xml.
*
* @author Brian Clozel
*/
@@ -227,6 +227,7 @@ public class HandlersBeanDefinitionParserTests {
}
class TestWebSocketHandler implements WebSocketHandler {
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {}