Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix protocol signature for info command (BulkReply) #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions project/ScalaRedisProject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/redis/NodeOperations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/redis/cluster/RedisCluster.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
38 changes: 38 additions & 0 deletions src/test/scala/com/redis/NodeOperationsSpec.scala
Original file line number Diff line number Diff line change
@@ -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")
}
}
}