Skip to content

Commit

Permalink
extract selftest alias, search for that alias when looking up own con…
Browse files Browse the repository at this point in the history
…nectUrl
  • Loading branch information
andrewazores committed Nov 6, 2023
1 parent 6838f0e commit 6f89046
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/test/java/itest/bases/StandardSelfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@
import io.vertx.ext.web.codec.BodyCodec;
import io.vertx.ext.web.handler.HttpException;
import itest.util.Utils;
import jakarta.ws.rs.NotFoundException;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.jboss.logging.Logger;
import org.junit.jupiter.api.BeforeAll;

public abstract class StandardSelfTest {

private static final String SELFTEST_ALIAS = "selftest";
public static final Logger logger = Logger.getLogger(StandardSelfTest.class);
public static final ObjectMapper mapper = new ObjectMapper();
public static final int REQUEST_TIMEOUT_SECONDS = 30;
Expand Down Expand Up @@ -105,7 +107,7 @@ private static void tryDefineSelfCustomTarget() {
"connectUrl",
"service:jmx:rmi:///jndi/rmi://localhost:0/jmxrmi",
"alias",
"self"));
SELFTEST_ALIAS));
ForkJoinPool.commonPool()
.submit(
() -> {
Expand Down Expand Up @@ -151,7 +153,20 @@ public static String getSelfReferenceConnectUrl() {
return;
}
JsonArray arr = ar.result().body();
future.complete(arr.getJsonObject(0));
boolean found = false;
for (int i = 0; i < arr.size(); i++) {
JsonObject obj = arr.getJsonObject(i);
if (SELFTEST_ALIAS.equals(
obj.getString("alias"))) {
future.complete(obj);
found = true;
break;
}
}
if (!found) {
future.completeExceptionally(
new NotFoundException());
}
});
});
try {
Expand Down

0 comments on commit 6f89046

Please sign in to comment.