Skip to content

Upgrade Scala version to 2.12.1 #11

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

Open
wants to merge 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package com.github.jeroenr.bson

import akka.util.{ByteString, ByteStringBuilder}
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.element.{BsonNullValue, BsonNull, BsonElement, BsonObject}

import language.postfixOps
import com.github.jeroenr.bson.element.{BsonElement, BsonNullValue, BsonObject}

case class BsonDocument(private val elems: BsonElement*) extends BsonValue {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object BsonDocumentReader extends Reader[BsonDocument] {

override def read(buffer: ByteBuffer): Option[BsonDocument] = {
val elements: ArrayBuffer[Option[BsonElement]] = new ArrayBuffer[Option[BsonElement]]
val size = buffer.getInt()
buffer.getInt()

breakable {
while (buffer.hasRemaining) {
Expand Down
4 changes: 2 additions & 2 deletions bson/src/test/scala/com/github/jeroenr/bson/BsonDslSpec.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.bson

import BsonDsl._
import com.github.jeroenr.bson.Implicits.{BsonValueArray, BsonValueString}
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.Implicits.BsonValueString
import org.scalatest.{Matchers, WordSpec}

class BsonDslSpec extends WordSpec with Matchers {
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ReleaseTransformations._

lazy val commonSettings = Seq(
organization := "com.github.jeroenr",
scalaVersion := "2.11.7",
scalaVersion := "2.12.1",
scalacOptions := Seq(
"-deprecation",
"-encoding", "UTF-8", // yes, this is 2 args
Expand Down
2 changes: 1 addition & 1 deletion pide/src/main/scala/com/github/jeroenr/pide/Dao.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.github.jeroenr.pide
import akka.actor.ActorRef
import akka.stream.scaladsl.Source
import akka.util.Timeout
import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}
import com.github.jeroenr.tepkin.MongoCollection
import com.github.jeroenr.tepkin.protocol.WriteConcern
import com.github.jeroenr.tepkin.protocol.result.{InsertResult, UpdateResult}
Expand Down
2 changes: 1 addition & 1 deletion pide/src/main/scala/com/github/jeroenr/pide/Pide.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.pide

import com.github.jeroenr.bson.Implicits._
import com.github.jeroenr.bson.{BsonDocument, BsonValue, Implicits}
import com.github.jeroenr.bson.{BsonDocument, BsonValue}

trait Pide[ID, E <: Entity[ID]] {

Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Dependencies {
val akkaV = "2.4.17"
val akkaStreamV = "2.4.17"
val scalatestV = "2.2.4"
val scalatestV = "3.0.1"
}
5 changes: 2 additions & 3 deletions tepkin/build.sbt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name := "tepkin"

libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.3",
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5",
"com.typesafe.akka" %% "akka-actor" % Dependencies.akkaV,
"com.typesafe.akka" %% "akka-stream" % Dependencies.akkaStreamV,
"org.slf4j" % "slf4j-api" % "1.7.5",
"ch.qos.logback" % "logback-classic" % "1.0.13" % Test,
"org.scalatest" %% "scalatest" % Dependencies.scalatestV % Test,
"com.github.simplyscala" %% "scalatest-embedmongo" % "0.2.2" % Test intransitive(),
"com.github.simplyscala" %% "scalatest-embedmongo" % "0.2.4" % Test intransitive(),
"de.flapdoodle.embed" % "de.flapdoodle.embed.mongo" % "1.50.2" % Test
// "com.github.simplyscala" %% "scalatest-embedmongo" % "0.2.2" % Test exclude("de.flapdoodle.embed","de.flapdoodle.embedmongo")
)
4 changes: 2 additions & 2 deletions tepkin/src/main/scala/com/github/jeroenr/tepkin/GridFs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import akka.actor.ActorRef
import akka.stream.Materializer
import akka.stream.scaladsl.{FileIO, Source}
import akka.util.{ByteString, Timeout}
import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.Implicits._
import com.github.jeroenr.bson.element.BinarySubtype.Generic
import com.github.jeroenr.bson.element.{BinarySubtype, BsonObjectId}
import com.github.jeroenr.bson.element.BsonObjectId
import com.github.jeroenr.bson.util.Converters
import com.github.jeroenr.bson.{BsonDocument, BsonDsl, Implicits}
import com.github.jeroenr.tepkin.GridFs.Chunk
import com.github.jeroenr.tepkin.protocol.command.Index
import com.github.jeroenr.tepkin.protocol.result.DeleteResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ object MongoClientUriParser extends RegexParsers {
}

def credentials: Parser[MongoCredentials] = credential ~ opt(":" ~ credential) ^^ {
case username ~ None =>
MongoCredentials(username = username)
case username ~ Some(":" ~ password) =>
MongoCredentials(username = username, password = Some(password))
case username ~ _ =>
MongoCredentials(username = username)
}

def host: Parser[InetSocketAddress] = hostName ~ opt(":" ~ port) ^^ {
case hostName ~ None => new InetSocketAddress(hostName, 27017)
case hostName ~ Some(":" ~ port) => new InetSocketAddress(hostName, port)
case hostName ~ _ => new InetSocketAddress(hostName, 27017)
}

def uri: Parser[MongoClientUri] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.tepkin.TepkinMessage.{CursorClosed, CursorOpened, Fetch}
import com.github.jeroenr.tepkin.protocol.message.{GetMoreMessage, KillCursorsMessage, Message, Reply}

import scala.util.{Failure, Success}

/**
* Represents a cursor to read data from Mongo. This actor is an ActorPublisher so it can be passed directly to a
* `akka.stream.scaladsl.Source`
Expand All @@ -31,8 +33,9 @@ class MongoCursor(pool: ActorRef,

import context.dispatcher

pool.?(message)(timeout).pipeTo(self).onFailure {
case cause: Throwable => onErrorThenStop(cause)
pool.?(message)(timeout).pipeTo(self).onComplete {
case Failure(cause) => onErrorThenStop(cause)
case Success(_) => ()
}

override def receive: Receive = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.Implicits._
import com.github.jeroenr.bson.element.BinarySubtype
import com.github.jeroenr.bson.util.Converters
import com.github.jeroenr.bson.{BsonDocument, BsonDsl, BsonValueNumber, Implicits}
import com.github.jeroenr.bson.{BsonDocument, BsonValueNumber}
import com.github.jeroenr.tepkin.MongoCredentials
import com.github.jeroenr.tepkin.protocol.command.Command
import com.github.jeroenr.tepkin.protocol.message.Reply
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.util.Converters
import com.github.jeroenr.bson.util.Converters.md5Hex
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

case class Authenticate(databaseName: String,
username: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

/**
* Finds the distinct values for a specified field across a single collection.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

/**
* Removes an entire collection from a database.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

/**
* The findAndModify command modifies and returns a single document. By default, the returned document does not include
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

/**
* Use getnonce to generate a one-time password for authentication.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

case object IsMaster extends AdminCommand {
override val command: BsonDocument = "isMaster" := 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

/**
* Retrieve information, i.e. the name and options, about the collections in a database.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

case class ListIndexes(databaseName: String,
collectionName: String) extends Command {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.command

import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}

/**
* Terminates the current authenticated session
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jeroenr.tepkin.protocol.result

import com.github.jeroenr.bson.Implicits.BsonValueArray
import com.github.jeroenr.bson.{BsonDocument, BsonValue, BsonValueNumber, Implicits}
import com.github.jeroenr.bson.{BsonDocument, BsonValue, BsonValueNumber}

case class DistinctResult(ok: Boolean,
values: Seq[BsonValue],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import akka.util.Timeout
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.Implicits._
import com.github.jeroenr.bson.util.Converters
import com.github.jeroenr.bson.{BsonDsl, Implicits}
import com.github.simplyscala.{MongodProps, MongoEmbedDatabase}
import com.github.simplyscala.MongoEmbedDatabase
import org.scalatest._
import org.scalatest.concurrent.ScalaFutures

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package com.github.jeroenr.tepkin
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.Source
import akka.util.Timeout
import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.Implicits._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl, Implicits}
import com.github.jeroenr.tepkin.protocol.command.Index
import com.github.jeroenr.tepkin.protocol.exception.{OperationException, WriteException}
import com.github.simplyscala.{MongodProps, MongoEmbedDatabase}
import org.scalatest._
import org.scalatest.concurrent.ScalaFutures

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.github.jeroenr.tepkin.protocol
import java.nio.ByteOrder

import akka.util.ByteString
import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}
import com.github.jeroenr.tepkin.protocol.command._
import org.scalatest.{FlatSpec, Matchers}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.github.jeroenr.tepkin.protocol
import java.nio.ByteOrder

import akka.util.ByteString
import com.github.jeroenr.bson.BsonDocument
import com.github.jeroenr.bson.BsonDsl._
import com.github.jeroenr.bson.{BsonDocument, BsonDsl}
import com.github.jeroenr.tepkin.protocol.message._
import org.scalatest.{FlatSpec, Matchers}

Expand Down