Skip to content

Commit

Permalink
Make the ServerDevModeTest more robust to also pass on fast multicore…
Browse files Browse the repository at this point in the history
… machines
  • Loading branch information
ppalaga committed Jan 3, 2024
1 parent 28c91fd commit 38c053f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
5 changes: 5 additions & 0 deletions extensions/core/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import java.io.StringWriter;
import java.io.Writer;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

import org.awaitility.Awaitility;
import org.hamcrest.CoreMatchers;
import org.hamcrest.Matchers;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand Down Expand Up @@ -66,14 +68,14 @@ void changePath() {
private void assertWsdl(RestAssuredConfig config, String path) {
given()
.config(config)
.when().get(path + "?wsdl")
.when().get("/soap" + path + "?wsdl")
.then()
.statusCode(200)
.body(
Matchers.hasXPath(
anyNs("definitions", "service", "port", "address") + "/@*[local-name() = 'location']",
CoreMatchers.is(
"http://localhost:8080" + path)));
"http://localhost:8080/soap" + path)));
}

private void assertCount(RestAssuredConfig config, String path, int expectedStatus, String expectedCount) {
Expand All @@ -86,13 +88,21 @@ private void assertCount(RestAssuredConfig config, String path, int expectedStat
" </soapenv:Body>\n" +
"</soapenv:Envelope>";

final ValidatableResponse response = given()
.config(config)
.body(requestBody)
.when()
.post(path)
.then()
.statusCode(expectedStatus);
final ValidatableResponse response = Awaitility.await().atMost(10, TimeUnit.SECONDS).until(
() -> {
try {
return given()
.config(config)
.body(requestBody)
.when()
.post("/soap" + path)
.then();
} catch (Exception e) {
/* The reload of the service takes some time */
return null;
}
},
resp -> resp != null);

if (expectedStatus >= 200 && expectedStatus < 300) {
response.body(
Expand All @@ -105,7 +115,7 @@ private void assertCount(RestAssuredConfig config, String path, int expectedStat
public static Asset applicationProperties() {
Writer writer = new StringWriter();
Properties props = new Properties();
props.setProperty("quarkus.cxf.path", "/");
props.setProperty("quarkus.cxf.path", "/soap");
props.setProperty("quarkus.cxf.endpoint.\"/fruit\".implementor",
io.quarkiverse.cxf.deployment.test.FruitWebServiceImpl.class.getName());
try {
Expand Down

0 comments on commit 38c053f

Please sign in to comment.