Skip to content

Commit

Permalink
Bump Scala to 2.12, ScalaTest to 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mkiedys committed Nov 18, 2016
1 parent a1300b3 commit 531d688
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ services:
- rabbitmq
scala:
- 2.11.8
- 2.12.0
jdk:
- oraclejdk8
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Source.fromPublisher(queue).map(_.message).runWith(Sink.fromSubscriber(exchange)

API Docs
----
Run `sbt doc` and open target/scala-2.11/index.html.
Run `sbt doc` and open target/scala-2.12/index.html.

Settings
----
Expand Down
6 changes: 4 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ licenses := Seq("Apache License 2.0" -> url("http://opensource.org/licenses/Apac

homepage := Some(url("https://github.com/ScalaConsultants/reactive-rabbit"))

scalaVersion := "2.11.8"
scalaVersion := "2.12.0"

crossScalaVersions := Seq("2.11.8", "2.12.0")

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Xfatal-warnings", "-target:jvm-1.8")

Expand All @@ -25,7 +27,7 @@ libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.3.0", // Configuration
"com.google.guava" % "guava" % "19.0", // for MediaType
"com.google.code.findbugs" % "jsr305" % "3.0.1",
"org.scalatest" %% "scalatest" % "2.2.6" % "test", // for TCK
"org.scalatest" %% "scalatest" % "3.0.1" % "test", // for TCK
"org.reactivestreams" % "reactive-streams-tck" % "1.0.0" % "test",
"com.typesafe.akka" %% "akka-stream" % "2.4.12" % "test"
)
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/scalac/amqp/ConnectionSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ object ConnectionSettings {
/** Builds settings from TypeSafe Config. */
def apply(config: Config): ConnectionSettings = apply(
addresses = {
import scala.collection.JavaConversions._
config.getConfigList("amqp.addresses").map(address
import scala.collection.JavaConverters._
config.getConfigList("amqp.addresses").asScala.map(address
Address(
host = address.getString("host"),
port = address.getInt("port")
Expand Down
7 changes: 4 additions & 3 deletions src/main/scala/io/scalac/amqp/impl/Conversions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.scalac.amqp.impl

import java.time.{ZoneId, ZonedDateTime}
import java.util
import java.util.Date
import java.util.concurrent.TimeUnit

Expand All @@ -9,7 +10,7 @@ import com.google.common.net.MediaType
import com.rabbitmq.client.{AMQP, ConnectionFactory, Envelope}
import io.scalac.amqp._

import scala.collection.JavaConversions._
import scala.collection.JavaConverters._
import scala.concurrent.duration.Duration


Expand Down Expand Up @@ -62,7 +63,7 @@ private object Conversions {
body = body,
contentType = Option(properties.getContentType).map(MediaType.parse),
contentEncoding = Option(properties.getContentEncoding),
headers = Option(properties.getHeaders).map(_.toMap.mapValues(_.toString)).getOrElse(Map()),
headers = Option(properties.getHeaders).map(_.asScala.toMap.mapValues(_.toString)).getOrElse(Map()),
mode = toDeliveryMode(properties.getDeliveryMode),
priority = Option(properties.getPriority).map(Integer2int),
correlationId = Option(properties.getCorrelationId),
Expand Down Expand Up @@ -98,7 +99,7 @@ private object Conversions {
new AMQP.BasicProperties.Builder()
.contentType(message.contentType.map(_.toString).orNull)
.contentEncoding(message.contentEncoding.orNull)
.headers(message.headers)
.headers(message.headers.asJava.asInstanceOf[util.Map[String, AnyRef]])
.deliveryMode(toDeliveryMode(message.mode))
.priority(message.priority.map(int2Integer).orNull)
.correlationId(message.correlationId.orNull)
Expand Down
7 changes: 4 additions & 3 deletions src/main/scala/io/scalac/amqp/impl/RabbitConnection.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package io.scalac.amqp.impl

import java.io.IOException
import java.util

import com.rabbitmq.client.{Address, AlreadyClosedException, Channel}
import io.scalac.amqp._
import org.reactivestreams.{Subscriber, Subscription}

import scala.collection.JavaConversions._
import scala.collection.JavaConverters._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.{Future, blocking}

Expand Down Expand Up @@ -54,7 +55,7 @@ private[amqp] class RabbitConnection(settings: ConnectionSettings) extends Conne

override def exchangeBind(destination: String, source: String, routingKey: String,
arguments: Map[String, String]) =
future(onChannel(_.exchangeBind(destination, source, routingKey, arguments)))
future(onChannel(_.exchangeBind(destination, source, routingKey, arguments.asJava.asInstanceOf[util.Map[String, AnyRef]])))
.map(_ Exchange.BindOk())

override def exchangeUnbind(destination: String, source: String, routingKey: String) =
Expand Down Expand Up @@ -101,7 +102,7 @@ private[amqp] class RabbitConnection(settings: ConnectionSettings) extends Conne

override def queueBind(queue: String, exchange: String, routingKey: String,
arguments: Map[String, String]) =
future(onChannel(_.queueBind(queue, exchange, routingKey, arguments)))
future(onChannel(_.queueBind(queue, exchange, routingKey, arguments.asJava.asInstanceOf[util.Map[String, AnyRef]])))
.map(_ Queue.BindOk())

override def queueUnbind(queue: String, exchange: String, routingKey: String) =
Expand Down

0 comments on commit 531d688

Please sign in to comment.