|
2 | 2 |
|
3 | 3 | import static io.quarkus.runtime.LaunchMode.NORMAL; |
4 | 4 | import static io.quarkus.runtime.configuration.ConfigSourceOrdinal.INTEGRATION_TEST; |
| 5 | +import static io.quarkus.test.common.ListeningAddress.LISTENING_ADDRESS; |
5 | 6 | import static io.quarkus.test.junit.ArtifactTypeUtil.isContainer; |
6 | 7 | import static io.quarkus.test.junit.ArtifactTypeUtil.isJar; |
7 | 8 | import static io.quarkus.test.junit.IntegrationTestUtil.activateLogging; |
|
14 | 15 | import static io.quarkus.test.junit.IntegrationTestUtil.readQuarkusArtifactProperties; |
15 | 16 | import static io.quarkus.test.junit.IntegrationTestUtil.startLauncher; |
16 | 17 | import static io.quarkus.test.junit.TestResourceUtil.TestResourceManagerReflections.copyEntriesFromProfile; |
| 18 | +import static java.util.Optional.empty; |
17 | 19 |
|
18 | 20 | import java.io.Closeable; |
19 | 21 | import java.io.File; |
@@ -129,7 +131,7 @@ public void beforeEach(ExtensionContext context) throws Exception { |
129 | 131 | // Inject of ValueRegistry and Config done IntegrationTestUtil.doProcessTestInstance |
130 | 132 |
|
131 | 133 | ValueRegistry valueRegistry = ValueRegistryInjector.get(context); |
132 | | - Optional<ListeningAddress> listeningAddress = valueRegistry.get(ListeningAddress.LISTENING_ADDRESS); |
| 134 | + Optional<ListeningAddress> listeningAddress = valueRegistry.get(LISTENING_ADDRESS); |
133 | 135 | listeningAddress.ifPresent(new Consumer<ListeningAddress>() { |
134 | 136 | @Override |
135 | 137 | public void accept(ListeningAddress listeningAddress) { |
@@ -314,10 +316,12 @@ private QuarkusTestExtensionState doProcessStart(Class<? extends QuarkusTestProf |
314 | 316 |
|
315 | 317 | // Start Quarkus, capture the listening port if available and register it in ValueRegistry |
316 | 318 | Optional<ListeningAddress> listeningAddress = startLauncher(launcher, additionalProperties); |
317 | | - listeningAddress.ifPresent(address -> { |
318 | | - address.register(valueRegistry, newConfig); |
319 | | - valueRegistry.register(ListeningAddress.LISTENING_ADDRESS, listeningAddress); |
320 | | - }); |
| 319 | + if (listeningAddress.isPresent()) { |
| 320 | + listeningAddress.get().register(valueRegistry, newConfig); |
| 321 | + valueRegistry.register(LISTENING_ADDRESS, listeningAddress); |
| 322 | + } else { |
| 323 | + valueRegistry.register(LISTENING_ADDRESS, Optional.empty()); |
| 324 | + } |
321 | 325 |
|
322 | 326 | testHttpEndpointProviders = TestHttpEndpointProvider.load(); |
323 | 327 |
|
|
0 commit comments