diff --git a/project/ScalaRedisProject.scala b/project/ScalaRedisProject.scala index e59e661e..42a138c7 100644 --- a/project/ScalaRedisProject.scala +++ b/project/ScalaRedisProject.scala @@ -15,6 +15,8 @@ object ScalaRedisProject extends Build lazy val coreSettings = commonSettings ++ template ++ Seq( name := "RedisClient", + resolvers += "twitter.com releases" at "http://maven.twttr.com/", + libraryDependencies ++= Seq("commons-pool" % "commons-pool" % "1.5.6", "org.slf4j" % "slf4j-api" % "1.6.1", "org.slf4j" % "slf4j-log4j12" % "1.6.1" % "provided", diff --git a/src/main/scala/com/redis/NodeOperations.scala b/src/main/scala/com/redis/NodeOperations.scala index 35ed28c6..cbb20c01 100644 --- a/src/main/scala/com/redis/NodeOperations.scala +++ b/src/main/scala/com/redis/NodeOperations.scala @@ -30,8 +30,8 @@ trait NodeOperations { self: Redis => // INFO // the info command returns different information and statistics about the server. - def info = - send("INFO")(asString) + def info(implicit parse: Parse[String]): Option[String] = + send("INFO")(asBulk[String]) // MONITOR // is a debugging command that outputs the whole sequence of commands received by the Redis server. diff --git a/src/main/scala/com/redis/cluster/RedisCluster.scala b/src/main/scala/com/redis/cluster/RedisCluster.scala index d2e82d59..06f2200a 100644 --- a/src/main/scala/com/redis/cluster/RedisCluster.scala +++ b/src/main/scala/com/redis/cluster/RedisCluster.scala @@ -124,7 +124,7 @@ abstract class RedisCluster(hosts: String*) extends RedisClient { override def lastsave = throw new UnsupportedOperationException("not supported on a cluster") override def monitor = throw new UnsupportedOperationException("not supported on a cluster") - override def info = throw new UnsupportedOperationException("not supported on a cluster") + override def info(implicit parse: Parse[String]): Option[String] = throw new UnsupportedOperationException("not supported on a cluster") override def slaveof(options: Any) = throw new UnsupportedOperationException("not supported on a cluster") override def move(key: Any, db: Int)(implicit format: Format) = throw new UnsupportedOperationException("not supported on a cluster") override def auth(secret: Any)(implicit format: Format) = throw new UnsupportedOperationException("not supported on a cluster") diff --git a/src/test/scala/com/redis/NodeOperationsSpec.scala b/src/test/scala/com/redis/NodeOperationsSpec.scala new file mode 100644 index 00000000..2f345c94 --- /dev/null +++ b/src/test/scala/com/redis/NodeOperationsSpec.scala @@ -0,0 +1,38 @@ +package com.redis + +import org.scalatest.Spec +import org.scalatest.BeforeAndAfterEach +import org.scalatest.BeforeAndAfterAll +import org.scalatest.matchers.ShouldMatchers +import org.scalatest.junit.JUnitRunner +import org.junit.runner.RunWith + + +@RunWith(classOf[JUnitRunner]) +class NodeOperationsSpec extends Spec + with ShouldMatchers + with BeforeAndAfterEach + with BeforeAndAfterAll { + + val r = new RedisClient("localhost", 6379) + + override def beforeEach = { + } + + override def afterEach = { + r.flushdb + } + + override def afterAll = { + r.disconnect + } + + describe("info") { + it("should return a string containing multiple lines") { + r.info.get.split("\n").length should be > (3) + } + it("should include the redis version") { + r.info.get should include ("redis_version") + } + } +}