redis.embedded.ports.PredefinedPortProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of embedded-redis Show documentation
Show all versions of embedded-redis Show documentation
Redis embedded server for Java integration testing
package redis.embedded.ports;
import redis.embedded.PortProvider;
import redis.embedded.exceptions.RedisBuildingException;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* Created by piotrturek on 29/01/15.
*/
public class PredefinedPortProvider implements PortProvider {
private final List ports = new LinkedList<>();
private final Iterator current;
public PredefinedPortProvider(Collection ports) {
this.ports.addAll(ports);
this.current = this.ports.iterator();
}
@Override
public synchronized int next() {
if (!current.hasNext()) {
throw new RedisBuildingException("Run out of Redis ports!");
}
return current.next();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy