Skip to content

Commit

Permalink
Serialization spec fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rinmalavi committed Nov 4, 2014
1 parent 53c257c commit b0a45fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
18 changes: 8 additions & 10 deletions http/src/test/scala/com/dslplatform/test/SerializationTest.scala
Expand Up @@ -79,21 +79,21 @@ class SerializationTest extends Specification {
val cl = classOf[SimpleRoot]
val fld = cl.getDeclaredField("__locator")
fld.setAccessible(true)
fld.get(simpleRoot) !== null
(fld.get(simpleRoot) !== null)
}

def deserializeNonOptionalObjectsInAValue = { jsonSerialization: JsonSerialization =>
val dtd = jsonSerialization.deserialize[ValDTD]("{}".getBytes("UTF-8"))
dtd.T.withMillis(0) === DateTime.now().withMillis(0)
dtd.D === BigDecimal(0)
dtd.DT === LocalDate.now()
(dtd.D === BigDecimal(0)) &
(dtd.DT === LocalDate.now())
}

def deserializeNonOptionalObjectsInAEntity = { jsonSerialization: JsonSerialization =>
val dtd = jsonSerialization.deserialize[RootDTD]("{}".getBytes("UTF-8"))
dtd.T.withMillis(0) === DateTime.now().withMillis(0)
dtd.D === BigDecimal(0)
dtd.DT === LocalDate.now()
(dtd.D === BigDecimal(0)) &
(dtd.DT === LocalDate.now())
}

def enumSerializeDeserialize = { jsonSerialization: JsonSerialization =>
Expand Down Expand Up @@ -134,16 +134,14 @@ class SerializationTest extends Specification {
def traitSerialization = { jsonSerialization: JsonSerialization =>
val cl2 = clone1(m = V(url = java.net.URI.create("http://dsl-platform.com")))
val json = jsonSerialization.serialize(cl2)
json.contains("$type") must beTrue
json.contains("http://dsl-platform.com") must beTrue
(json.contains("$type") must beTrue) &
(json.contains("http://dsl-platform.com") must beTrue)
}

def serverTraitSerialization = { implicit locator: ServiceLocator => // 404
val cl2_new = clone1(m = V(url = java.net.URI.create("http://dsl-platform.com")))
val repository: PersistableRepository[clone1] = locator.resolve[PersistableRepository[clone1]]
repository.insert(cl2_new)
val cl2_find = clone1.find(cl2_new.URI)
cl2_new === cl2_find
repository.insert(cl2_new).map { uri => clone1.find(uri).m.isInstanceOf[V]} must beTrue.await
}

def traitDeserialization = { jsonSerialization: JsonSerialization =>
Expand Down
12 changes: 6 additions & 6 deletions project/Projects.scala
Expand Up @@ -201,12 +201,12 @@ object Revenj {
}

def setup: Def.Initialize[Task[() => Unit]] = Def.taskDyn {
makeScalaClientTestJar.value
makeRevenj.value
Def.taskDyn{
revenjProcess = startRevenj.value.toOption
Def.task { () => ()}
}
makeScalaClientTestJar.value
makeRevenj.value
Def.taskDyn {
revenjProcess = startRevenj.value.toOption
Def.task { () => () }
}
}

def shutdown: Def.Initialize[Task[() => Unit]] = Def.task {
Expand Down

0 comments on commit b0a45fe

Please sign in to comment.