-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Introduce the ability to run @QuarkusIntegrationTests against remote apps
- Loading branch information
Showing
3 changed files
with
82 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
test-framework/common/src/main/java/io/quarkus/test/common/TestHostLauncher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.quarkus.test.common; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
/** | ||
* A launcher that simply sets the {@code quarkus.http.host} property based on the value {@code quarkus.http.test-host} | ||
* in order to support the case of running integration tests against an already running application | ||
* using RestAssured without any chances. | ||
* | ||
* This is highly experimental, so changes are to be expected. | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
public class TestHostLauncher implements ArtifactLauncher { | ||
|
||
private String previousHost; | ||
|
||
@Override | ||
public void start() throws IOException { | ||
// set 'quarkus.http.host' to ensure that RestAssured targets the proper host | ||
previousHost = System.setProperty("quarkus.http.host", System.getProperty("quarkus.http.test-host")); | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
if (previousHost != null) { | ||
System.setProperty("quarkus.http.host", previousHost); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean listensOnSsl() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void includeAsSysProps(Map systemProps) { | ||
|
||
} | ||
|
||
@Override | ||
public void init(InitContext initContext) { | ||
throw new IllegalStateException("Should not be called"); | ||
} | ||
|
||
@Override | ||
public LaunchResult runToCompletion(String[] args) { | ||
throw new IllegalStateException("Should not be called"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters