|
1 | 1 | /** |
2 | 2 | * Copyright (C) 2011 |
3 | | - * Michael Mosmann <[email protected]> |
4 | | - * Martin Jöhren <[email protected]> |
5 | | - * |
| 3 | + * Michael Mosmann <[email protected]> |
| 4 | + * Martin Jöhren <[email protected]> |
| 5 | + * <p> |
6 | 6 | * with contributions from |
7 | | - * konstantin-ba@github, Archimedes Trajano (trajano@github), Christian Bayer ([email protected]) |
8 | | - * |
| 7 | + * konstantin-ba@github, Archimedes Trajano (trajano@github), Christian Bayer ([email protected]) |
| 8 | + * <p> |
9 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
10 | 10 | * you may not use this file except in compliance with the License. |
11 | 11 | * You may obtain a copy of the License at |
12 | | - * |
13 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
14 | | - * |
| 12 | + * <p> |
| 13 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | + * <p> |
15 | 15 | * Unless required by applicable law or agreed to in writing, software |
16 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
17 | 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
25 | 25 | import de.flapdoodle.embed.process.distribution.Distribution; |
26 | 26 | import de.flapdoodle.embed.process.distribution.Platform; |
27 | 27 | import de.flapdoodle.embed.process.extract.IExtractedFileSet; |
28 | | -import de.flapdoodle.embed.process.io.LogWatchStreamProcessor; |
29 | 28 | import de.flapdoodle.embed.process.io.Processors; |
30 | 29 | import de.flapdoodle.embed.process.io.StreamToLineProcessor; |
31 | 30 | import de.flapdoodle.embed.process.io.file.Files; |
32 | 31 | import de.flapdoodle.embed.process.runtime.ProcessControl; |
| 32 | +import org.slf4j.Logger; |
| 33 | +import org.slf4j.LoggerFactory; |
33 | 34 | import ru.yandex.qatools.embed.postgresql.config.PostgresConfig; |
| 35 | +import ru.yandex.qatools.embed.postgresql.ext.LogWatchStreamProcessor; |
34 | 36 | import ru.yandex.qatools.embed.postgresql.ext.SubdirTempDir; |
35 | 37 |
|
36 | 38 | import java.io.File; |
37 | 39 | import java.io.IOException; |
38 | 40 | import java.util.ArrayList; |
39 | | -import java.util.HashSet; |
40 | 41 | import java.util.List; |
41 | 42 |
|
42 | 43 | import static de.flapdoodle.embed.process.io.file.Files.createTempFile; |
43 | 44 | import static java.util.Arrays.asList; |
| 45 | +import static java.util.Collections.singleton; |
44 | 46 | import static java.util.UUID.randomUUID; |
45 | 47 |
|
46 | 48 | /** |
47 | 49 | * initdb process |
48 | 50 | * (helper to initialize the DB) |
49 | 51 | */ |
50 | 52 | class InitDbProcess<E extends InitDbExecutable> extends AbstractPGProcess<E, InitDbProcess> { |
| 53 | + private static final Logger LOGGER = LoggerFactory.getLogger(InitDbProcess.class); |
51 | 54 |
|
52 | 55 | public InitDbProcess(Distribution distribution, PostgresConfig config, IRuntimeConfig runtimeConfig, E executable) throws IOException { |
53 | 56 | super(distribution, config, runtimeConfig, executable); |
@@ -80,10 +83,10 @@ protected List<String> getCommandLine(Distribution distribution, PostgresConfig |
80 | 83 |
|
81 | 84 | @Override |
82 | 85 | protected void onAfterProcessStart(ProcessControl process, IRuntimeConfig runtimeConfig) throws IOException { |
83 | | - ProcessOutput outputConfig = runtimeConfig.getProcessOutput(); |
84 | | - LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor( |
85 | | - "database system is ready to accept connections", |
86 | | - new HashSet<>(asList("[initdb error]")), StreamToLineProcessor.wrap(outputConfig.getOutput())); |
| 86 | + final ProcessOutput outputConfig = runtimeConfig.getProcessOutput(); |
| 87 | + final LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor( |
| 88 | + "performing post-bootstrap initialization", |
| 89 | + singleton("[initdb error]"), StreamToLineProcessor.wrap(outputConfig.getOutput())); |
87 | 90 | Processors.connect(process.getReader(), logWatch); |
88 | 91 | Processors.connect(process.getError(), StreamToLineProcessor.wrap(outputConfig.getError())); |
89 | 92 | logWatch.waitForResult(getConfig().timeout().startupTimeout()); |
|
0 commit comments