Forward quarkus server output to console in testsuite

This commit is contained in:
Tero Saarni 2022-08-03 20:37:41 +03:00 committed by Pedro Igor
parent 2b2287d1ee
commit 2392af157b

View file

@ -27,6 +27,7 @@ import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.exec.StreamPumper;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils; import org.apache.commons.lang3.SystemUtils;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer; import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
@ -54,6 +55,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
private KeycloakQuarkusConfiguration configuration; private KeycloakQuarkusConfiguration configuration;
private Process container; private Process container;
private static AtomicBoolean restart = new AtomicBoolean(); private static AtomicBoolean restart = new AtomicBoolean();
private Thread stdoutForwarderThread;
@Inject @Inject
private Instance<SuiteContext> suiteContext; private Instance<SuiteContext> suiteContext;
@ -75,6 +77,8 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
try { try {
importRealm(); importRealm();
container = startContainer(); container = startContainer();
stdoutForwarderThread = new Thread(new StreamPumper(container.getInputStream(), System.out));
stdoutForwarderThread.start();
waitForReadiness(); waitForReadiness();
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -156,7 +160,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
private Process startContainer() throws IOException { private Process startContainer() throws IOException {
ProcessBuilder pb = new ProcessBuilder(getProcessCommands()); ProcessBuilder pb = new ProcessBuilder(getProcessCommands());
File wrkDir = configuration.getProvidersPath().resolve("bin").toFile(); File wrkDir = configuration.getProvidersPath().resolve("bin").toFile();
ProcessBuilder builder = pb.directory(wrkDir).inheritIO().redirectErrorStream(true); ProcessBuilder builder = pb.directory(wrkDir).redirectErrorStream(true);
String javaOpts = configuration.getJavaOpts(); String javaOpts = configuration.getJavaOpts();