Permalink
Browse files
manually bring in ryan king's configgy change
- Loading branch information...
|
@@ -5,4 +5,7 @@ log { |
|
|
}
|
|
|
|
|
|
# where do the Zookeeper servers live?
|
|
|
-hostlist = "localhost:2181"
|
|
|
+zookeeper-client {
|
|
|
+ session-timeout = 3000
|
|
|
+ hostlist = "localhost:2181"
|
|
|
+}
|
|
@@ -33,8 +33,8 @@ class ZooKeeperClient(servers: String, sessionTimeout: Int, basePath: String, wa |
|
|
}
|
|
|
|
|
|
def this(config: ConfigMap, watcher: ZKWatch) = {
|
|
|
- this(config.getString("servers").get, // Must be set. No sensible default.
|
|
|
- config.getInt("session-timeout", 3000),
|
|
|
+ this(config.getString("zookeeper-client.hostlist").get, // Must be set. No sensible default.
|
|
|
+ config.getInt("zookeeper-client.session-timeout", 3000),
|
|
|
config.getString("base-path", ""),
|
|
|
watcher)
|
|
|
}
|
|
|
|
@@ -7,19 +7,21 @@ import org.apache.zookeeper.CreateMode._ |
|
|
import org.apache.zookeeper.KeeperException.NoNodeException
|
|
|
import org.apache.zookeeper.data.{ACL, Id}
|
|
|
import org.specs._
|
|
|
-
|
|
|
+import net.lag.configgy.Configgy
|
|
|
|
|
|
class ZookeeperClientSpec extends Specification {
|
|
|
"ZookeeperClient" should {
|
|
|
- val zookeeperHost = "localhost"
|
|
|
- val zookeeperPort = 2181
|
|
|
+ Configgy.configure("src/main/resources/config.conf")
|
|
|
|
|
|
val watcher = ZKWatch((a: WatchedEvent) => {})
|
|
|
- val zkClient = new ZooKeeperClient("%s:%s".format(zookeeperHost, zookeeperPort), watcher)
|
|
|
+ val configMap = Configgy.config
|
|
|
+ val zkClient = new ZooKeeperClient(configMap, watcher)
|
|
|
|
|
|
doBefore {
|
|
|
// we need to be sure that a ZooKeeper server is running in order to test
|
|
|
- new Socket(zookeeperHost, zookeeperPort) must throwA[SocketException]
|
|
|
+ val hostlist = configMap.getString("zookeeper-client.hostlist", "localhost:2181")
|
|
|
+ val socketPort = hostlist.split(":")
|
|
|
+ new Socket(socketPort(0), socketPort(1).toInt) must throwA[SocketException]
|
|
|
}
|
|
|
|
|
|
doLast {
|
|
|
0 comments on commit
bfdc36a