Permalink
Browse files

Update casbah deps from 2.4.1 to 2.5.0.

  • Loading branch information...
1 parent a3f38d8 commit 93da64050e251ac1a4256033ec9a28a42f06b537 @rktoomey rktoomey committed Feb 15, 2013
View
@@ -153,7 +153,7 @@ object Dependencies {
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.2"
val logbackCore = "ch.qos.logback" % "logback-core" % LogbackVersion % "test"
val logbackClassic = "ch.qos.logback" % "logback-classic" % LogbackVersion % "test"
- val casbah = "org.mongodb" %% "casbah" % "2.4.1" pomOnly()
+ val casbah = "org.mongodb" %% "casbah" % "2.5.0" pomOnly()
val json4sNative = "org.json4s" %% "json4s-native" % "3.0.0"
}
@@ -1,12 +1,9 @@
package com.novus.salat.conversions
-import com.mongodb.casbah.commons.conversions
-import conversions.{ MongoConversionHelper, scala }
-
+import com.mongodb.casbah.commons.conversions.MongoConversionHelper
+import com.mongodb.casbah.commons.conversions.scala.JodaDateTimeHelpers
import org.bson.{ BSON, Transformer }
-
-import org.scala_tools.time.Imports._
-import scala.JodaDateTimeHelpers
+import org.joda.time.DateTimeZone
import org.joda.time.tz.CachedDateTimeZone
object RegisterJodaTimeZoneConversionHelpers extends JodaDateTimeZoneHelpers {
@@ -39,8 +39,6 @@ import scala.Predef._
trait SalatMongoCursorBase[T <: AnyRef] extends Logging {
- import scalaj.collection.Imports._
-
val _grater: Grater[T]
val underlying: DBCursor
@@ -105,7 +103,7 @@ trait SalatMongoCursorBase[T <: AnyRef] extends Logging {
def numSeen = underlying.numSeen
- def sizes = underlying.getSizes.asScala
+ def sizes = scala.collection.JavaConversions.collectionAsScalaIterable(underlying.getSizes).toList
def batchSize(n: Int) = {
underlying.batchSize(n)
@@ -25,13 +25,11 @@
package com.novus.salat.json
-import org.scala_tools.time.Imports._
-import org.joda.time.DateTimeZone
-import org.joda.time.format.{ DateTimeFormatter, ISODateTimeFormat }
import java.util.{ TimeZone, Date }
-import org.json4s._
-import org.json4s.native.JsonMethods._
import org.bson.types.{ BSONTimestamp, ObjectId }
+import org.joda.time.format.{ DateTimeFormatter, ISODateTimeFormat }
+import org.joda.time.{ DateTime, DateTimeZone }
+import org.json4s._
object JSONConfig {
val ISO8601 = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC)
@@ -24,16 +24,13 @@
*/
package com.novus.salat.transformers
-import java.lang.reflect.Method
-import scala.tools.scalap.scalax.rules.scalasig._
-import com.novus.salat.annotations.util._
-
+import com.mongodb.casbah.Imports._
import com.novus.salat._
+import com.novus.salat.annotations.util._
import com.novus.salat.impls._
import com.novus.salat.util._
-import com.mongodb.casbah.Imports._
-import com.novus.salat.util.Logging
-import org.scala_tools.time.Imports._
+import java.lang.reflect.Method
+import scala.tools.scalap.scalax.rules.scalasig._
package object in extends Logging {
@@ -240,6 +237,7 @@ package object in extends Logging {
package in {
import java.lang.Integer
+ import org.joda.time.{ DateTime, DateTimeZone }
import org.json4s.JsonAST.JArray
trait LongToInt extends Transformer {
@@ -24,17 +24,16 @@
*/
package com.novus.salat.test
+import com.mongodb.casbah.Imports._
+import com.mongodb.util.JSON.parse
import com.novus.salat._
import com.novus.salat.test.global._
import com.novus.salat.test.model._
-
-import com.mongodb.casbah.Imports._
-import com.mongodb.util.JSON.parse
+import org.joda.time.DateTime
class DateTimeSpec extends SalatSpec {
"A grater" should {
"support org.scala_tools.time.TypeImports.DateTime" in {
- import org.scala_tools.time.Imports._
val dt = DateTime.now
val n = Neville(asOf = dt)
val dbo: MongoDBObject = grater[Neville].asDBObject(n)
@@ -29,8 +29,9 @@ import com.novus.salat._
import com.novus.salat.test.global._
import com.novus.salat.test.model._
import com.mongodb.casbah.Imports._
-import org.scala_tools.time.Imports._
+
import com.novus.salat.util.MapPrettyPrinter
+import org.joda.time.DateTime
class IgnoreAnnotationSpec extends SalatSpec {
@@ -28,8 +28,9 @@ import com.novus.salat._
import com.novus.salat.test.global._
import com.novus.salat.test.model._
import com.mongodb.casbah.Imports._
-import org.scala_tools.time.Imports._
+
import com.novus.salat.util.MapPrettyPrinter
+import org.joda.time.DateTime
class KeyAnnotationSpec extends SalatSpec {
@@ -29,9 +29,9 @@ import com.novus.salat.test._
import com.novus.salat.test.global._
import com.mongodb.casbah.Imports._
import com.novus.salat.annotations._
-import org.scala_tools.time.Imports._
+
import com.novus.salat.dao._
-import org.joda.time.DateMidnight
+import org.joda.time.{ DateTime, DateMidnight }
@Salat
trait Beta {
@@ -30,7 +30,7 @@ import com.novus.salat.test.global._
import com.mongodb.casbah.Imports._
import org.specs2.specification.Scope
import com.novus.salat.test.dao._
-import org.scala_tools.time.Imports._
+
import org.joda.time.DateTimeConstants._
import org.joda.time.DateMidnight
import com.mongodb.casbah.commons.{ MongoDBList, MongoDBObject }
@@ -72,7 +72,7 @@ class ChildCollectionSpec extends SalatSpec {
val cr = ParentDAO.children.updateByParentId(parent1.id, updateQuery, false, true)
// number of children is unchanged
- ParentDAO.children.collection.count must_== 5L
+ ParentDAO.children.collection.count() must_== 5L
// children of parent1 are updated as expected
ParentDAO.children.findByParentId(parent1.id).toList must contain(
child1Parent1.copy(childInfo = ChildInfo(lastUpdated = newLastUpdated)),
@@ -88,7 +88,7 @@ class ChildCollectionSpec extends SalatSpec {
// three children of parent1 have been removed from the child collection, overall count is reduced
ParentDAO.children.findByParentId(parent1.id).toList must beEmpty
- ParentDAO.children.collection.count must_== 2L
+ ParentDAO.children.collection.count() must_== 2L
// child collection is otherwise unchanged
ParentDAO.children.findByParentId(parent2.id).toList must contain(child1Parent2, child2Parent2).only
ParentDAO.children.findByParentId(parent3.id).toList must beEmpty
@@ -131,20 +131,20 @@ class ChildCollectionSpec extends SalatSpec {
trait parentChildContext extends Scope {
log.debug("before: dropping %s", ParentDAO.collection.getFullName())
ParentDAO.collection.drop()
- ParentDAO.collection.count must_== 0L
+ ParentDAO.collection.count() must_== 0L
val childDAO = ParentDAO.children
log.debug("before: dropping %s", childDAO.collection.getFullName())
childDAO.collection.drop()
- childDAO.collection.count must_== 0L
+ childDAO.collection.count() must_== 0L
val parent1 = Parent(name = "parent1")
val parent2 = Parent(name = "parent2")
val parent3 = Parent(name = "parent3")
val _ids = ParentDAO.insert(parent1, parent2, parent3)
_ids must contain(Option(parent1.id), Option(parent2.id), Option(parent3.id)).only
- ParentDAO.collection.count must_== 3L
+ ParentDAO.collection.count() must_== 3L
val child1Parent1 = Child(id = 1, parentId = parent1.id, x = "child1Parent1", y = Some("child1Parent1"))
val child2Parent1 = Child(id = 2, parentId = parent1.id, x = "child2Parent1")
@@ -156,7 +156,7 @@ class ChildCollectionSpec extends SalatSpec {
val childIds = ParentDAO.children.insert(child1Parent1, child2Parent1, child3Parent1, child1Parent2, child2Parent2)
childIds must contain(Option(child1Parent1.id), Option(child2Parent1.id), Option(child3Parent1.id),
Option(child1Parent2.id), Option(child2Parent2.id)).only
- ParentDAO.children.collection.count must_== 5L
+ ParentDAO.children.collection.count() must_== 5L
}
}
@@ -27,11 +27,12 @@ package com.novus.salat.test.dao
import com.novus.salat.test.global._
import com.mongodb.casbah.Imports._
-import org.scala_tools.time.Imports._
+
import com.novus.salat.test._
import org.specs2.specification.Scope
import com.novus.salat.json.JSONConfig
import org.json4s.JsonAST._
+import org.joda.time.DateTime
class ModelCompanionSpec extends SalatSpec {
// which most specs can execute concurrently, this particular spec needs to execute sequentially to avoid mutating shared state,
@@ -67,14 +68,14 @@ class ModelCompanionSpec extends SalatSpec {
"y":99,
"z":[1.0,2.0,3.0],
"d":"%s"
-}""".format(_id.toString, JSONConfig.ISO8601.print(d.millis))
+}""".format(_id.toString, JSONConfig.ISO8601.print(d.getMillis))
}
"toCompactJson" in new myModelScope {
val expected = "{\"_typeHint\":\"com.novus.salat.test.dao.MyModel\",\"_id\":{\"$oid\":\""+
_id.toString+
"\"},\"x\":\"Test\",\"y\":99,\"z\":[1.0,2.0,3.0],\"d\":\""+
- JSONConfig.ISO8601.print(d.millis)+
+ JSONConfig.ISO8601.print(d.getMillis)+
"\"}"
MyModel.toCompactJson(m) must_== expected
}
@@ -125,7 +126,7 @@ class ModelCompanionSpec extends SalatSpec {
trait myModelScope extends Scope {
log.trace("before: dropping %s", MyModel.collection.getFullName())
MyModel.collection.drop()
- MyModel.collection.count must_== 0L
+ MyModel.collection.count() must_== 0L
val _id = new ObjectId
val d = new DateTime
@@ -27,10 +27,11 @@ package com.novus.salat.test.dao
import com.novus.salat.annotations._
import com.mongodb.casbah.Imports._
-import org.scala_tools.time.Imports._
+
import com.novus.salat.test._
import com.novus.salat.test.global._
import com.novus.salat.dao.{ SalatDAO, ModelCompanion }
+import org.joda.time.DateTime
object MyModel extends ModelCompanion[MyModel, ObjectId] {
val collection = MongoConnection()(SalatSpecDb)(MyModelColl)
@@ -39,9 +39,9 @@ class PolymorphicSalatDAOSpec extends SalatSpec {
log.debug("before: dropping %s", UserDAO.collection.getFullName())
log.debug("before: dropping %s", RoleDAO.collection.getFullName())
UserDAO.collection.drop()
- UserDAO.collection.count must_== 0L
+ UserDAO.collection.count() must_== 0L
RoleDAO.collection.drop()
- RoleDAO.collection.count must_== 0L
+ RoleDAO.collection.count() must_== 0L
val userId = new ObjectId
val editorId = new ObjectId
@@ -54,7 +54,7 @@ class PolymorphicSalatDAOSpec extends SalatSpec {
trait roleContext extends Scope {
log.debug("before: dropping %s", RoleDAO.collection.getFullName())
RoleDAO.collection.drop()
- RoleDAO.collection.count must_== 0L
+ RoleDAO.collection.count() must_== 0L
val user1Id = new ObjectId
val user2Id = new ObjectId
val user3Id = new ObjectId
@@ -73,14 +73,14 @@ class PolymorphicSalatDAOSpec extends SalatSpec {
trait fooContext extends Scope {
log.debug("before: dropping %s", FooDAO.collection.getFullName())
FooDAO.collection.drop()
- FooDAO.collection.count must_== 0L
+ FooDAO.collection.count() must_== 0L
val barId = new ObjectId
val bar = Bar(_id = barId, x = 1, y = "y", z = 3.14)
FooDAO.insert(bar) must beSome(barId)
val bazId = new ObjectId
val baz = Baz(_id = bazId, x = -1, y = "y'", n = "n")
FooDAO.insert(baz) must beSome(bazId)
- FooDAO.collection.count must_== 2L
+ FooDAO.collection.count() must_== 2L
}
"Salat DAO" should {
@@ -98,8 +98,8 @@ class PolymorphicSalatDAOSpec extends SalatSpec {
}
"support a polymorphic child collection with always-on type hinting" in new userContext {
UserDAO.insert(user)
- UserDAO.collection.count must_== 1L
- RoleDAO.collection.count must_== 2L
+ UserDAO.collection.count() must_== 1L
+ RoleDAO.collection.count() must_== 2L
val user_* = UserDAO.findOneById(userId)
user_* must beSome(user)
Oops, something went wrong.

0 comments on commit 93da640

Please sign in to comment.