In my Spring Application I have a part that relys on MongoDb, which I have to test.
I want to be able to run the tests locally and on the build server.
Currently I am trying to do this, adding
testCompile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '2.2.0'
as dependency.
This package downloads the mongo executables from mongodb.org, extracts them and stores them locally. While this works like a charm locally, it is bound to fail on the build server, since that cannot access remote sites.
So I'd like to change the configuration, to use exectuables found in the artifactory repo or - if necessary - that have been added to the project repo.
An interesting pice of code seems to be de.flapdoodle.embed.mongo.config.DownloadConfigBuilder
It shows that some environment variable
EMBEDDED_MONGO_ARTIFACTSmight be usedIt shows the default download sources, but the paths are not absolute. So I do not know, how my mirror needs to be structured. Visisting the links, I will be redirected.
private static class PlatformDependentDownloadPath implements IDownloadPath { @Override public String getPath(Distribution distribution) { if (distribution.getPlatform()==Platform.Windows) { return "https://downloads.mongodb.org/"; } return "https://fastdl.mongodb.org/"; } }
Then in the Documentation from flapdoodle you find:
- Customize Download URL
... Command command = Command.MongoD; IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder() .defaults(command) .artifactStore(new ExtractedArtifactStoreBuilder() .defaults(command) .download(new DownloadConfigBuilder() .defaultsForCommand(command) .downloadPath("http://my.custom.download.domain/"))) .build(); ...
but again, this downloadPath does not seem to be absolute.
Briefly:
- How do I need to structure my download mirror
- How do I configure the download path to use my mirror - especially with respect to the Spring Autoconfiguration