Embedded Vault provides a platform neutral way for running Vault in tests. This library is based on Flapdoodle OSS's embed process.
The artifacts are available on JCenter. Therefore you must add JCenter to your build script repositories:
repositories {
jcenter()
}
Add a Gradle compile dependency to the build.gradle
file of your project:
testCompile 'com.github.golovnin:embedded-vault:0.10.1.0'
Here is the example of how to launch the Vault instance:
VaultServerConfig config = new VaultServerConfig.Builder()
.build();
VaultServerStarter starter = VaultServerStarter.getDefaultInstance();
VaultServerExecutable executable = starter.prepare(config);
VaultServerProcess process = executable.start();
// Execute your tests here
process.stop();
Here is the example of how to launch the Vault instance using a custom version:
IVersion v0_7_2 = () -> "0.7.2";
VaultServerConfig config = new VaultServerConfig.Builder()
.version(v0_7_2)
.build();
VaultServerStarter starter = VaultServerStarter.getDefaultInstance();
VaultServerExecutable executable = starter.prepare(config);
VaultServerProcess process = executable.start();
// Execute your tests here
process.stop();
Versions: 0.10.1 and any custom
Platforms: Mac OS X, FreeBSD, Linux, Solaris and Windows
Copyright (c) 2017, Andrej Golovnin