|
39 | 39 | import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion;
|
40 | 40 | import de.flapdoodle.embed.process.config.IRuntimeConfig;
|
41 | 41 | import de.flapdoodle.embed.process.config.io.ProcessOutput;
|
| 42 | +import de.flapdoodle.embed.process.config.store.IDownloadPath; |
| 43 | +import de.flapdoodle.embed.process.distribution.Distribution; |
| 44 | +import de.flapdoodle.embed.process.distribution.Platform; |
42 | 45 | import de.flapdoodle.embed.process.io.Processors;
|
43 | 46 | import de.flapdoodle.embed.process.io.Slf4jLevel;
|
44 | 47 | import de.flapdoodle.embed.process.io.progress.Slf4jProgressListener;
|
@@ -190,8 +193,9 @@ public IRuntimeConfig embeddedMongoRuntimeConfig() {
|
190 | 193 | }
|
191 | 194 |
|
192 | 195 | private ArtifactStoreBuilder getArtifactStore(Logger logger) {
|
193 |
| - return new ExtractedArtifactStoreBuilder().defaults(Command.MongoD).download(new DownloadConfigBuilder() |
194 |
| - .defaultsForCommand(Command.MongoD).progressListener(new Slf4jProgressListener(logger)).build()); |
| 196 | + return new ExtractedArtifactStoreBuilder().defaults(Command.MongoD) |
| 197 | + .download(new HttpsDownloadConfigBuilder().defaultsForCommand(Command.MongoD) |
| 198 | + .progressListener(new Slf4jProgressListener(logger)).build()); |
195 | 199 | }
|
196 | 200 |
|
197 | 201 | }
|
@@ -270,4 +274,27 @@ public String toString() {
|
270 | 274 |
|
271 | 275 | }
|
272 | 276 |
|
| 277 | + private static class HttpsDownloadConfigBuilder extends DownloadConfigBuilder { |
| 278 | + |
| 279 | + @Override |
| 280 | + public DownloadConfigBuilder defaultsForCommand(Command command) { |
| 281 | + super.defaultsForCommand(command); |
| 282 | + downloadPath().setDefault(new PlatformDependentHttpsDownloadPath()); |
| 283 | + return this; |
| 284 | + } |
| 285 | + |
| 286 | + private static class PlatformDependentHttpsDownloadPath implements IDownloadPath { |
| 287 | + |
| 288 | + @Override |
| 289 | + public String getPath(Distribution distribution) { |
| 290 | + if (distribution.getPlatform() == Platform.Windows) { |
| 291 | + return "https://downloads.mongodb.org/"; |
| 292 | + } |
| 293 | + return "https://fastdl.mongodb.org/"; |
| 294 | + } |
| 295 | + |
| 296 | + } |
| 297 | + |
| 298 | + } |
| 299 | + |
273 | 300 | }
|
0 commit comments