From 8b50750511cc7c05832f1a138102ead02d7148da Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Wed, 24 Jun 2015 10:42:58 -0400 Subject: [PATCH] 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. --- .../sockjs/client/AbstractSockJsIntegrationTests.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java index 1c19aa844c..4c1d9d9bb0 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -94,7 +94,6 @@ public abstract class AbstractSockJsIntegrationTests { this.errorFilter = new ErrorFilter(); this.wac = new AnnotationConfigWebApplicationContext(); this.wac.register(TestConfig.class, upgradeStrategyConfigClass()); - this.wac.refresh(); this.server = createWebSocketTestServer(); this.server.setup(); this.server.deployConfig(this.wac, this.errorFilter); @@ -218,7 +217,9 @@ public abstract class AbstractSockJsIntegrationTests { this.errorFilter.sleepDelayMap.put("/xhr_streaming", 10000L); this.errorFilter.responseStatusMap.put("/xhr_streaming", 503); initSockJsClient(createXhrTransport()); - this.sockJsClient.setConnectTimeoutScheduler(this.wac.getBean(ThreadPoolTaskScheduler.class)); + ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); + scheduler.afterPropertiesSet(); + this.sockJsClient.setConnectTimeoutScheduler(scheduler); WebSocketSession clientSession = sockJsClient.doHandshake(clientHandler, this.baseUrl + "/echo").get(); assertEquals("Fallback didn't occur", XhrClientSockJsSession.class, clientSession.getClass()); TextMessage message = new TextMessage("message1");