diff --git a/akka-core/src/main/scala/serialization/Serializer.scala b/akka-core/src/main/scala/serialization/Serializer.scala index 3d1c05f423..3eb9315126 100644 --- a/akka-core/src/main/scala/serialization/Serializer.scala +++ b/akka-core/src/main/scala/serialization/Serializer.scala @@ -152,7 +152,14 @@ object Serializer { // FIXME set ClassLoader on SJSONSerializer.SJSON def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = SJSONSerializer.SJSON.in(bytes) - def in(json: String): AnyRef = SJSONSerializer.SJSON.in(json) + import scala.reflect.Manifest + def in[T](json: String)(implicit m: Manifest[T]): AnyRef = { + SJSONSerializer.SJSON.in(json)(m) + } + + def in[T](bytes: Array[Byte])(implicit m: Manifest[T]): AnyRef = { + SJSONSerializer.SJSON.in(bytes)(m) + } } /** diff --git a/akka-core/src/test/scala/SerializerTest.scala b/akka-core/src/test/scala/SerializerTest.scala new file mode 100644 index 0000000000..e11e83a2f5 --- /dev/null +++ b/akka-core/src/test/scala/SerializerTest.scala @@ -0,0 +1,40 @@ +package se.scalablesolutions.akka.serialization + +import junit.framework.TestCase + +import org.scalatest.junit.JUnitSuite +import org.junit.{Test, Before, After} + +import scala.reflect.BeanInfo +@BeanInfo +case class Foo(foo: String) { + def this() = this(null) +} + +@BeanInfo +case class MyMessage(val id: String, val value: Tuple2[String, Int]) { + private def this() = this(null, null) +} + + +class SerializerTest extends JUnitSuite { + @Test + def shouldSerializeString = { + val f = Foo("debasish") + val json = Serializer.ScalaJSON.out(f) + assert(new String(json) == """{"foo":"debasish"}""") + val fo = Serializer.ScalaJSON.in[Foo](new String(json)).asInstanceOf[Foo] + assert(fo == f) + } + + @Test + def shouldSerializeTuple2 = { + val message = MyMessage("id", ("hello", 34)) + val json = Serializer.ScalaJSON.out(message) + assert(new String(json) == """{"id":"id","value":{"hello":34}}""") + val f = Serializer.ScalaJSON.in[MyMessage](new String(json)).asInstanceOf[MyMessage] + assert(f == message) + val g = Serializer.ScalaJSON.in[MyMessage](json).asInstanceOf[MyMessage] + assert(f == message) + } +} diff --git a/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.jar b/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.jar deleted file mode 100644 index 5f3c358883..0000000000 Binary files a/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.jar and /dev/null differ diff --git a/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.pom b/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.pom deleted file mode 100755 index df7e623c43..0000000000 --- a/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.pom +++ /dev/null @@ -1,8 +0,0 @@ - - - 4.0.0 - sjson.json - sjson - 0.3 - jar - \ No newline at end of file diff --git a/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.jar b/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.jar index 6c31d7861b..dcab322c81 100644 Binary files a/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.jar and b/embedded-repo/sjson/json/sjson/0.4/sjson-0.4.jar differ