This repository has been archived by the owner on May 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
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
- Loading branch information
Showing
3 changed files
with
34 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
/** | ||
* Copyright (C) 2011 | ||
* Michael Mosmann <[email protected]> | ||
* Martin Jöhren <[email protected]> | ||
* | ||
* Michael Mosmann <[email protected]> | ||
* Martin Jöhren <[email protected]> | ||
* <p> | ||
* with contributions from | ||
* konstantin-ba@github, Archimedes Trajano (trajano@github), Christian Bayer ([email protected]) | ||
* | ||
* konstantin-ba@github, Archimedes Trajano (trajano@github), Christian Bayer ([email protected]) | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
|
@@ -25,29 +25,32 @@ | |
import de.flapdoodle.embed.process.distribution.Distribution; | ||
import de.flapdoodle.embed.process.distribution.Platform; | ||
import de.flapdoodle.embed.process.extract.IExtractedFileSet; | ||
import de.flapdoodle.embed.process.io.LogWatchStreamProcessor; | ||
import de.flapdoodle.embed.process.io.Processors; | ||
import de.flapdoodle.embed.process.io.StreamToLineProcessor; | ||
import de.flapdoodle.embed.process.io.file.Files; | ||
import de.flapdoodle.embed.process.runtime.ProcessControl; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import ru.yandex.qatools.embed.postgresql.config.PostgresConfig; | ||
import ru.yandex.qatools.embed.postgresql.ext.LogWatchStreamProcessor; | ||
import ru.yandex.qatools.embed.postgresql.ext.SubdirTempDir; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
|
||
import static de.flapdoodle.embed.process.io.file.Files.createTempFile; | ||
import static java.util.Arrays.asList; | ||
import static java.util.Collections.singleton; | ||
import static java.util.UUID.randomUUID; | ||
|
||
/** | ||
* initdb process | ||
* (helper to initialize the DB) | ||
*/ | ||
class InitDbProcess<E extends InitDbExecutable> extends AbstractPGProcess<E, InitDbProcess> { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(InitDbProcess.class); | ||
|
||
public InitDbProcess(Distribution distribution, PostgresConfig config, IRuntimeConfig runtimeConfig, E executable) throws IOException { | ||
super(distribution, config, runtimeConfig, executable); | ||
|
@@ -80,10 +83,10 @@ protected List<String> getCommandLine(Distribution distribution, PostgresConfig | |
|
||
@Override | ||
protected void onAfterProcessStart(ProcessControl process, IRuntimeConfig runtimeConfig) throws IOException { | ||
ProcessOutput outputConfig = runtimeConfig.getProcessOutput(); | ||
LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor( | ||
"database system is ready to accept connections", | ||
new HashSet<>(asList("[initdb error]")), StreamToLineProcessor.wrap(outputConfig.getOutput())); | ||
final ProcessOutput outputConfig = runtimeConfig.getProcessOutput(); | ||
final LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor( | ||
"performing post-bootstrap initialization", | ||
singleton("[initdb error]"), StreamToLineProcessor.wrap(outputConfig.getOutput())); | ||
Processors.connect(process.getReader(), logWatch); | ||
Processors.connect(process.getError(), StreamToLineProcessor.wrap(outputConfig.getError())); | ||
logWatch.waitForResult(getConfig().timeout().startupTimeout()); | ||
|
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
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