Skip to content

Commit

Permalink
Merge 34389cd into 5600b00
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jun 6, 2021
2 parents 5600b00 + 34389cd commit f121f9f
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Expand Up @@ -9,6 +9,12 @@ scala:
- "2.11.12"
- "2.12.10"
- "2.13.0"

jobs:
include:
- scala: 3.0.1-RC1
script: sbt "++ ${TRAVIS_SCALA_VERSION}!" test

jdk:
- openjdk8

Expand Down
37 changes: 25 additions & 12 deletions build.sbt
Expand Up @@ -3,26 +3,29 @@ import sbt.Tests.{InProcess, Group}

val akkaVersion = "2.5.25"

val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion
val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion cross CrossVersion.for3Use2_13

val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion
val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion cross CrossVersion.for3Use2_13

val specs2 = "org.specs2" %% "specs2-core" % "4.8.0"
val specs2 = "org.specs2" %% "specs2-core" % "4.8.0" cross CrossVersion.for3Use2_13

val stm = "org.scala-stm" %% "scala-stm" % "0.9.1"
val stm = "org.scala-stm" %% "scala-stm" % "0.11.1"

val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.2"
val scalacheck = Def.setting{
val v = if (scalaBinaryVersion.value == "2.11") "1.15.2" else "1.15.3"
"org.scalacheck" %% "scalacheck" % v
}

//val scalameter = "com.github.axel22" %% "scalameter" % "0.4"

val rediscalaDependencies = Seq(
val rediscalaDependencies = Def.setting(Seq(
akkaActor,
stm,
akkaTestkit % "test",
//scalameter % "test",
specs2 % "test",
scalacheck % "test"
)
scalacheck.value % "test"
))


val baseSourceUrl = "https://github.com/etaty/rediscala/tree/"
Expand All @@ -33,7 +36,7 @@ lazy val standardSettings = Def.settings(
name := "rediscala",
organization := "com.github.etaty",
scalaVersion := Scala211,
crossScalaVersions := Seq(Scala211, "2.12.10", "2.13.0"),
crossScalaVersions := Seq(Scala211, "2.12.10", "2.13.0", "3.0.1-RC1"),
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")),
homepage := Some(url("https://github.com/etaty/rediscala")),
scmInfo := Some(ScmInfo(url("https://github.com/etaty/rediscala"), "scm:git:git@github.com:etaty/rediscala.git")),
Expand All @@ -50,13 +53,23 @@ lazy val standardSettings = Def.settings(
publishTo := sonatypePublishTo.value,
publishMavenStyle := true,
git.gitRemoteRepo := "git@github.com:etaty/rediscala.git",

scalacOptions ++= {
if (scalaBinaryVersion.value == "3") {
Seq(
"-source", "3.0-migration"
)
} else {
Seq(
"-Xlint"
)
}
},
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-Xlint",
"-deprecation",
"-feature",
"-language:postfixOps",
"-language:implicitConversions",
"-unchecked"
),
scalacOptions in (Compile, doc) ++= {
Expand Down Expand Up @@ -119,7 +132,7 @@ lazy val root = Project(id = "rediscala",
base = file(".")
).settings(
standardSettings,
libraryDependencies ++= rediscalaDependencies
libraryDependencies ++= rediscalaDependencies.value
).configs(
BenchTest
).enablePlugins(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.3.3
sbt.version=1.5.3
2 changes: 1 addition & 1 deletion src/main/scala/redis/Redis.scala
Expand Up @@ -111,7 +111,7 @@ case class RedisPubSub(

val redisConnection: ActorRef = system.actorOf(
Props(classOf[RedisSubscriberActorWithCallback],
new InetSocketAddress(host, port), channels, patterns, onMessage, onPMessage, authPassword,onConnectStatus)
new InetSocketAddress(host, port), channels, patterns, onMessage, onPMessage, authPassword,onConnectStatus())
.withDispatcher(redisDispatcher.name),
name + '-' + Redis.tempName()
)
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/redis/RedisPool.scala
Expand Up @@ -23,7 +23,7 @@ abstract class RedisClientPoolLike(system: ActorSystem, redisDispatcher: RedisDi
def redisServerConnections: scala.collection.Map[RedisServer, RedisConnection]

val name: String
implicit val executionContext = system.dispatchers.lookup(redisDispatcher.name)
implicit val executionContext: ExecutionContext = system.dispatchers.lookup(redisDispatcher.name)

private val redisConnectionRef: Ref[Seq[ActorRef]] = Ref(Seq.empty)
/**
Expand Down Expand Up @@ -107,7 +107,7 @@ case class RedisClientMutablePool(redisServers: Seq[RedisServer],
redisDispatcher: RedisDispatcher = Redis.dispatcher
) extends RedisClientPoolLike (system, redisDispatcher) with RoundRobinPoolRequest with RedisCommands {

override val redisServerConnections = {
override val redisServerConnections: collection.mutable.Map[RedisServer, RedisConnection] = {
val m = redisServers map { server => makeRedisConnection(server) }
collection.mutable.Map(m: _*)
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/redis/Sentinel.scala
Expand Up @@ -6,7 +6,7 @@ import akka.event.Logging
import redis.api.pubsub.{PMessage, Message}
import redis.actors.RedisSubscriberActorWithCallback
import java.net.InetSocketAddress
import scala.concurrent.{Await, Future}
import scala.concurrent.{Await, ExecutionContext, Future}

trait SentinelCommands
extends Sentinel
Expand Down Expand Up @@ -112,7 +112,7 @@ abstract class SentinelMonitored(system: ActorSystem, redisDispatcher: RedisDisp
val onNewSlave: (String, Int) => Unit
val onSlaveDown: (String, Int) => Unit

implicit val executionContext = system.dispatchers.lookup(redisDispatcher.name)
implicit val executionContext: ExecutionContext = system.dispatchers.lookup(redisDispatcher.name)

val log = Logging.getLogger(system, this)

Expand Down Expand Up @@ -163,7 +163,7 @@ abstract class SentinelMonitored(system: ActorSystem, redisDispatcher: RedisDisp
if (master == masterName && sentinelClients.contains(k)) {
sentinelClients.synchronized {
if (sentinelClients.contains(k)) {
sentinelClients(k).stop
sentinelClients(k).stop()
sentinelClients -= k
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/redis/api/Scripting.scala
Expand Up @@ -27,7 +27,7 @@ case class RedisScript(script: String) {
}
}

trait EvaledScript extends {
trait EvaledScript {
val isMasterOnly = true
def encodeRequest[KK, KA](
encoder: ((String, Seq[ByteString]) => ByteString),
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/redis/ConverterSpec.scala
Expand Up @@ -7,7 +7,7 @@ import redis.protocol.{Bulk, RedisReply}
case class DumbClass(s1: String, s2: String)

object DumbClass {
implicit val byteStringFormatter = new ByteStringFormatter[DumbClass] {
implicit val byteStringFormatter: ByteStringFormatter[DumbClass] = new ByteStringFormatter[DumbClass] {
def serialize(data: DumbClass): ByteString = {
ByteString(data.s1 + "|" + data.s2)
}
Expand All @@ -18,7 +18,7 @@ object DumbClass {
}
}

implicit val redisReplyDeserializer = new RedisReplyDeserializer[DumbClass] {
implicit val redisReplyDeserializer: RedisReplyDeserializer[DumbClass] = new RedisReplyDeserializer[DumbClass] {
override def deserialize: PartialFunction[RedisReply, DumbClass] = {
case Bulk(Some(bs)) => byteStringFormatter.deserialize(bs)
}
Expand Down
5 changes: 3 additions & 2 deletions src/test/scala/redis/RedisSpec.scala
Expand Up @@ -13,6 +13,7 @@ import org.specs2.mutable.SpecificationLike
import org.specs2.specification.core.Fragments

import scala.collection.JavaConverters._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.io.Source
import scala.reflect.io.File
Expand Down Expand Up @@ -49,9 +50,9 @@ abstract class RedisHelper extends TestKit(ActorSystem()) with SpecificationLike

import scala.concurrent.duration._

implicit val executionContext = system.dispatchers.lookup(Redis.dispatcher.name)
implicit val executionContext: ExecutionContext = system.dispatchers.lookup(Redis.dispatcher.name)

implicit val timeout = Timeout(10 seconds)
implicit val timeout: Timeout = Timeout(10 seconds)
val timeOut = 10 seconds
val longTimeOut = 100 seconds

Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/redis/RedisTest.scala
Expand Up @@ -11,7 +11,7 @@ class RedisTest extends RedisStandaloneServer {

"basic test" should {
"ping" in {
Await.result(redis.ping, timeOut) mustEqual "PONG"
Await.result(redis.ping(), timeOut) mustEqual "PONG"
}
"set" in {
Await.result(redis.set("key", "value"), timeOut) mustEqual true
Expand Down Expand Up @@ -47,7 +47,7 @@ class RedisTest extends RedisStandaloneServer {
implicit val redisDispatcher = RedisDispatcher("no-this-dispatcher")
RedisClient(port = port)
})
test must throwA[ConfigurationException]
test() must throwA[ConfigurationException]
}
}

Expand Down

0 comments on commit f121f9f

Please sign in to comment.