Skip to content

Commit

Permalink
Upgrades version, minor refactoring, removes warnings, fixes broken p…
Browse files Browse the repository at this point in the history
…roject coordinates of commons-pool 2.6.0 in build.sbt
  • Loading branch information
debasishg committed Dec 26, 2018
1 parent 3f30725 commit 5953dec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ lazy val redisClient = (project in file(".")).settings(coreSettings : _*)

lazy val commonSettings: Seq[Setting[_]] = Seq(
organization := "net.debasishg",
version := "3.8",
scalaVersion := "2.12.6",
crossScalaVersions := Seq("2.12.7", "2.11.12", "2.10.7", "2.13.0-M5"),
version := "3.9",
scalaVersion := "2.12.8",
crossScalaVersions := Seq("2.11.12", "2.10.7", "2.13.0-M5"),

scalacOptions in Compile ++= Seq( "-unchecked", "-feature", "-language:postfixOps", "-deprecation" ),

Expand All @@ -18,12 +18,12 @@ lazy val commonSettings: Seq[Setting[_]] = Seq(
lazy val coreSettings = commonSettings ++ Seq(
name := "RedisClient",
libraryDependencies ++= Seq(
"commons-pool" % "commons-pool" % "2.6.0",
"org.slf4j" % "slf4j-api" % "1.7.25",
"org.slf4j" % "slf4j-log4j12" % "1.7.25" % "provided",
"log4j" % "log4j" % "1.2.17" % "provided",
"junit" % "junit" % "4.12" % "test",
"org.scalatest" %% "scalatest" % "3.0.6-SNAP3" % "test"),
"org.apache.commons" % "commons-pool2" % "2.6.0",
"org.slf4j" % "slf4j-api" % "1.7.25",
"org.slf4j" % "slf4j-log4j12" % "1.7.25" % "provided",
"log4j" % "log4j" % "1.2.17" % "provided",
"junit" % "junit" % "4.12" % "test",
"org.scalatest" %% "scalatest" % "3.0.6-SNAP3" % "test"),

parallelExecution in Test := false,
publishTo := version { (v: String) =>
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/com/redis/Bench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Bench {
def load(opsPerClient: Int, fn: (Int, String) => Unit)(implicit clients: RedisClientPool): (Double, Double, Seq[_]) = {
val start = System.nanoTime
val tasks = (1 to 100) map (i => Future { fn(opsPerClient, "k" + i.toString) })
val results = Await.result(Future.sequence(tasks), 20 seconds)
val results = Await.result(Future.sequence(tasks), 60 seconds)
val elapsedSeconds = (System.nanoTime - start)/1000000000.0
val opsPerSec = (opsPerClient * 100 * 2) / elapsedSeconds
(elapsedSeconds, opsPerSec, results)
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/com/redis/PoolSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class PoolSpec extends FunSpec
val l = (0 until 5000).map(_.toString).toList
val fns = List[List[String] => Option[Long]](lp, rp, set)
val tasks = fns map (fn => Future { fn(l) })
val results = Await.result(Future.sequence(tasks), 20 seconds)
val results = Await.result(Future.sequence(tasks), 60 seconds)
results should equal(List(Some(5000), Some(5000), Some(1000)))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/com/redis/cluster/RedisClusterSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class RedisClusterSpec extends FunSpec
r.set("testkey1", "testvalue2")
r.get("testkey1") should equal (Some("testvalue2"))

val nodename = r.hr.getNode(formattedKey("testkey1")).toString
val nodename = r.hr.getNode(formattedKey("testkey1").toIndexedSeq).toString

//simulate the same value is duplicated to slave
//for test, don't set to master, just to make sure the expected value is loaded from slave
Expand All @@ -137,7 +137,7 @@ class RedisClusterSpec extends FunSpec
r.set("testkey1", "testvalue2")
r.get("testkey1") should equal (Some("testvalue2"))

val nodename = r.hr.getNode(formattedKey("testkey1")).toString
val nodename = r.hr.getNode(formattedKey("testkey1").toIndexedSeq).toString

//replaced master with slave on the same node
r.removeServer(nodename)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/com/redis/cluster/RedisShardsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class RedisShardsSpec extends FunSpec
r.set("testkey1", "testvalue2")
r.get("testkey1") should equal (Some("testvalue2"))

val nodename = r.hr.getNode(formattedKey("testkey1")).toString
val nodename = r.hr.getNode(formattedKey("testkey1").toIndexedSeq).toString

//simulate the same value is duplicated to slave
//for test, don't set to master, just to make sure the expected value is loaded from slave
Expand All @@ -134,7 +134,7 @@ class RedisShardsSpec extends FunSpec
r.set("testkey1", "testvalue2")
r.get("testkey1") should equal (Some("testvalue2"))

val nodename = r.hr.getNode(formattedKey("testkey1")).toString
val nodename = r.hr.getNode(formattedKey("testkey1").toIndexedSeq).toString

//replaced master with slave on the same node
r.removeServer(nodename)
Expand Down

0 comments on commit 5953dec

Please sign in to comment.