golovnin / embedded-consul

Embedded Consul based on https://github.com/flapdoodle-oss/de.flapdoodle.embed.process

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embedded Consul

Embedded Consul provides a platform neutral way for running Consul in tests. This library is based on Flapdoodle OSS's embed process.

Gradle

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-consul:1.2.3.0'

Usage

Here is the example of how to launch the Consul instance:

ConsulAgentConfig config = new ConsulAgentConfig.Builder()
    .build();
ConsulAgentStarter starter = ConsulAgentStarter.getDefaultInstance();
ConsulAgentExecutable executable = starter.prepare(config);
ConsulAgentProcess process = executable.start();

// Execute your tests here

process.stop();

Here is the example of how to launch the Consul instance using a custom version:

ConsulAgentConfig config = new ConsulAgentConfig.Builder()
    .version("0.7.5")
    .build();
ConsulAgentStarter starter = ConsulAgentStarter.getDefaultInstance();
ConsulAgentExecutable executable = starter.prepare(config);
ConsulAgentProcess process = executable.start();

// Execute your tests here

process.stop();

Supported Consul versions and platforms

Versions: 1.2.3 and any custom

Platforms: Mac OS X, FreeBSD, Linux, Solaris and Windows

Copyright (c) 2018, Andrej Golovnin

About

Embedded Consul based on https://github.com/flapdoodle-oss/de.flapdoodle.embed.process

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Java 100.0%