
org.mockserver.client.MockServerEventBus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockserver-client-java Show documentation
Show all versions of mockserver-client-java Show documentation
A java client for the MockServer
package org.mockserver.client;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
/**
* A publish/subscribe communication channel between {@link MockServerClient} and {@link ForwardChainExpectation} instances
*
* @author albans
*/
final class MockServerEventBus {
private final Multimap subscribers = LinkedListMultimap.create();
void publish(EventType event) {
for (SubscriberHandler subscriber : subscribers.get(event)) {
subscriber.handle();
}
}
public void subscribe(SubscriberHandler subscriber, EventType... events) {
for (EventType event : events) {
subscribers.put(event, subscriber);
}
}
enum EventType {
STOP, RESET
}
interface SubscriberHandler {
void handle();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy