net.mguenther.kafka.junit.Props Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kafka-junit Show documentation
Show all versions of kafka-junit Show documentation
Provides an embedded Kafka cluster consisting of Apache ZooKeeper, Apache Kafka Brokers and Kafka Connect
workers in distributed mode along with a rich set of convenient accessors and fault injectors to interact
with the embedded Kafka cluster. Supports working against external clusters as well.
package net.mguenther.kafka.junit;
import java.util.Properties;
/**
* Provides a fluent interface for constructing {@link java.util.Properties}. Use this for example
* with {@code EmbeddedConnectConfig#deployConnector} to retain the fluent interface when provisioning
* your embedded Kafka cluster.
*/
public class Props {
private final Properties properties = new Properties();
public Props with(final String propertyName, final T value) {
properties.put(propertyName, value);
return this;
}
public Props withAll(final Properties overrides) {
properties.putAll(overrides);
return this;
}
public Properties build() {
final Properties copyOfProps = new Properties();
copyOfProps.putAll(properties);
return copyOfProps;
}
public static Props create() {
return new Props();
}
}