Skip to content

Commit

Permalink
Make monitor return the underlying buffered reader
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpet committed May 23, 2011
1 parent 86274a2 commit 1e926f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/com/redis/Operations/NodeOperations.scala
Expand Up @@ -56,9 +56,10 @@ trait NodeOperations {

// MONITOR
// is a debugging command that outputs the whole sequence of commands received by the Redis server.
def monitor: (Boolean, java.io.BufferedReader) = {
def monitor: java.io.BufferedReader = {
connection.write("MONITOR\r\n")
(connection.readBoolean, connection.getInputStream)
connection.readBoolean
connection.getInputStream
}

// SLAVEOF
Expand Down
4 changes: 3 additions & 1 deletion src/test/scala/com/redis/operations/NodeOperationsSpec.scala
Expand Up @@ -44,8 +44,10 @@ object NodeOperationsSpec extends Specification with Mockito {
}

"start monitor debug on the server" in {
val reader = mock[java.io.BufferedReader]
connection.readBoolean returns true
client.monitor._1 mustEqual true
connection.getInputStream returns reader
client.monitor mustEqual reader
connection.write("MONITOR\r\n") was called
}

Expand Down

0 comments on commit 1e926f0

Please sign in to comment.