Skip to content

Commit 8b50750

Browse files
committed
Fix failure in performance build
The JettySockJsIntegrationTests are enabled in the performance build only. Following the upgrade to Jetty 9.3 where the JettyRequestUpgradeStrategy is now Lifecycle as wel as ServletContextAware, we need to make sure the ApplicationContext refresh occurs after the ServletContext has been set. This change removes the explicit .refresh() call in the test setup and instead relies on the DispatcherServlet to do that, which ensures that the ServletContext with which it is initialized by Jetty has been set on the ApplicationContext before that.
1 parent 7df9679 commit 8b50750

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,7 +94,6 @@ public void setup() throws Exception {
9494
this.errorFilter = new ErrorFilter();
9595
this.wac = new AnnotationConfigWebApplicationContext();
9696
this.wac.register(TestConfig.class, upgradeStrategyConfigClass());
97-
this.wac.refresh();
9897
this.server = createWebSocketTestServer();
9998
this.server.setup();
10099
this.server.deployConfig(this.wac, this.errorFilter);
@@ -218,7 +217,9 @@ public void fallbackAfterConnectTimeout() throws Exception {
218217
this.errorFilter.sleepDelayMap.put("/xhr_streaming", 10000L);
219218
this.errorFilter.responseStatusMap.put("/xhr_streaming", 503);
220219
initSockJsClient(createXhrTransport());
221-
this.sockJsClient.setConnectTimeoutScheduler(this.wac.getBean(ThreadPoolTaskScheduler.class));
220+
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
221+
scheduler.afterPropertiesSet();
222+
this.sockJsClient.setConnectTimeoutScheduler(scheduler);
222223
WebSocketSession clientSession = sockJsClient.doHandshake(clientHandler, this.baseUrl + "/echo").get();
223224
assertEquals("Fallback didn't occur", XhrClientSockJsSession.class, clientSession.getClass());
224225
TextMessage message = new TextMessage("message1");

0 commit comments

Comments
 (0)