Skip to content

Commit d0c7548

Browse files
author
robmcdougall
committed
🐛 Fixed AemInstance to work with remote AEM instances.
1 parent 6018d18 commit d0c7548

File tree

1 file changed

+8
-4
lines changed
  • rest-services/it.tests/src/test/java/com/_4point/aem/docservices/rest_services/it_tests

1 file changed

+8
-4
lines changed

rest-services/it.tests/src/test/java/com/_4point/aem/docservices/rest_services/it_tests/AemInstance.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void prepareForTests() {
5050
if (!preparedForTests.get()) {
5151
Integer mappedPort = aemPort();
5252

53-
startAem(mappedPort);
53+
startAem(mappedPort, targetType);
5454
// deploySampleFiles(mappedPort);
5555

5656
preparedForTests.set(true);
@@ -59,11 +59,15 @@ public void prepareForTests() {
5959
}
6060

6161
// Make sure AEM is up before running the tests.
62-
private static void startAem(Integer mappedPort) {
63-
System.out.println(String.format("Checking if AEM is available on port %d.", mappedPort));
62+
private static void startAem(Integer mappedPort, AemTargetType targetType) {
63+
String targetMachine = switch (targetType) {
64+
case LOCAL, TESTCONTAINERS -> "localhost";
65+
case REMOTE_WINDOWS, REMOTE_LINUX -> TestUtils.TEST_MACHINE_NAME;
66+
};
67+
System.out.println(String.format("Checking if AEM is available on port %d of %s.", mappedPort, targetMachine));
6468
HttpClient client = HttpClient.newHttpClient();
6569
HttpRequest request = HttpRequest.newBuilder()
66-
.uri(URI.create(String.format("http://localhost:%d/", mappedPort)))
70+
.uri(URI.create(String.format("http://%s:%d/", targetMachine, mappedPort)))
6771
.header("Authorization", encodeBasic(TestUtils.TEST_USER, TestUtils.TEST_USER_PASSWORD))
6872
.GET()
6973
.build();

0 commit comments

Comments
 (0)