Fix tests according HTTPS for origin urls

This commit is contained in:
Artem Bilan
2019-03-20 11:24:44 -04:00
parent fd30d1b48b
commit c9e5f99de5
5 changed files with 9 additions and 8 deletions

View File

@@ -142,7 +142,7 @@ subprojects { subproject ->
springSecurityVersion = '5.2.0.BUILD-SNAPSHOT'
springRetryVersion = '1.2.4.RELEASE'
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.0.BUILD-SNAPSHOT'
springWsVersion = '3.0.6.RELEASE'
springWsVersion = '3.0.7.RELEASE'
tomcatVersion = "9.0.16"
xstreamVersion = '1.4.11.1'
}
@@ -301,7 +301,7 @@ subprojects { subproject ->
checkstyle {
configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
toolVersion = "8.17"
toolVersion = "8.18"
}
artifacts {

View File

@@ -31,7 +31,7 @@
</int-http:inbound-channel-adapter>
<int-http:inbound-channel-adapter path="/customized" supported-methods="GET,POST" channel="nullChannel">
<int-http:cross-origin origin="https://site1.com,http://site2.com"
<int-http:cross-origin origin="https://site1.com,https://site2.com"
allowed-headers="header1, header2"
exposed-headers="header3, header4"
method="DELETE"

View File

@@ -36,6 +36,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
/**
* @author Artem Bilan
*
* @since 4.2
*/
@RunWith(SpringJUnit4ClassRunner.class)
@@ -52,7 +53,7 @@ public class CrossOriginTests {
public void setUp() {
this.request = new MockHttpServletRequest();
this.request.setMethod("GET");
this.request.addHeader(HttpHeaders.ORIGIN, "http://domain.com/");
this.request.addHeader(HttpHeaders.ORIGIN, "https://domain.com/");
}
@Test
@@ -102,7 +103,7 @@ public class CrossOriginTests {
assertThat(config).isNotNull();
assertThat(config.getAllowedMethods().toArray()).isEqualTo(new String[] { "DELETE" });
assertThat(config.getAllowedOrigins().toArray())
.isEqualTo(new String[] { "http://site1.com", "http://site2.com" });
.isEqualTo(new String[] { "https://site1.com", "https://site2.com" });
assertThat(config.getAllowedHeaders().toArray()).isEqualTo(new String[] { "header1", "header2" });
assertThat(config.getExposedHeaders().toArray()).isEqualTo(new String[] { "header3", "header4" });
assertThat(config.getMaxAge()).isEqualTo(new Long(123));
@@ -161,7 +162,7 @@ public class CrossOriginTests {
@Test
public void testOptionsHeaderHandling() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("OPTIONS", "/default");
request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
request.addHeader(HttpHeaders.ORIGIN, "https://domain2.com");
HandlerExecutionChain handler = this.handlerMapping.getHandler(request);
assertThat(handler).isNotNull();
Object handlerMethod = handler.getHandler();

View File

@@ -20,7 +20,7 @@
handshake-handler="handshakeHandler"
handshake-interceptors="handshakeInterceptor"
decorator-factories="decoratorFactory"
allowed-origins="http://www.foo.com/">
allowed-origins="https://foo.com">
<int-websocket:sockjs client-library-url="https://foo.sock.js"
disconnect-delay="4000"
heartbeat-time="30000"

View File

@@ -159,7 +159,7 @@ public class WebSocketParserTests {
assertThat(TestUtils.getPropertyValue(this.serverWebSocketContainer, "sendTimeLimit")).isEqualTo(100);
assertThat(TestUtils.getPropertyValue(this.serverWebSocketContainer, "sendBufferSizeLimit")).isEqualTo(100000);
assertThat(TestUtils.getPropertyValue(this.serverWebSocketContainer, "origins", String[].class))
.isEqualTo(new String[] { "http://foo.com" });
.isEqualTo(new String[] { "https://foo.com" });
WebSocketHandlerDecoratorFactory[] decoratorFactories =
TestUtils.getPropertyValue(this.serverWebSocketContainer, "decoratorFactories",