Skip to content

Commit 033594f

Browse files
committed
@LaunchWithUndertow now uses port name in $availableTcpPort()
1 parent 9705445 commit 033594f

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

web/undertow/src/main/java/org/seedstack/seed/undertow/LaunchWithUndertow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
@Documented
2727
@Inherited
2828
@LaunchWith(value = UndertowLauncher.class, separateThread = true)
29-
@ConfigurationProperty(name = "web.server.port", value = "$availableTcpPort()")
29+
@ConfigurationProperty(name = "web.server.port", value = "$availableTcpPort('undertow')")
3030
public @interface LaunchWithUndertow {
3131
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
*/
8+
package org.seedstack.seed.undertow;
9+
10+
import io.restassured.response.Response;
11+
import org.junit.Test;
12+
import org.junit.runner.RunWith;
13+
import org.seedstack.seed.Configuration;
14+
import org.seedstack.seed.testing.junit4.SeedITRunner;
15+
16+
import static io.restassured.RestAssured.expect;
17+
import static org.assertj.core.api.Assertions.assertThat;
18+
19+
@LaunchWithUndertow
20+
@RunWith(SeedITRunner.class)
21+
public class LaunchWithUndertowIT {
22+
@Configuration("web.server.port")
23+
protected int configuredPort;
24+
@Configuration("runtime.web.server.port")
25+
protected int realPort;
26+
@Configuration("runtime.web.baseUrl")
27+
protected String baseUrl;
28+
29+
@Test
30+
public void servlet() {
31+
assertThat(realPort).isEqualTo(configuredPort);
32+
Response servletResponse = expect()
33+
.statusCode(200)
34+
.when()
35+
.get(baseUrl + "/hello");
36+
assertThat(servletResponse.asString()).isEqualTo("Hello World!");
37+
}
38+
}

0 commit comments

Comments
 (0)