Simple test to try serialization of the complex user state class
authorGeorgios Gousios <gousiosg@gmail.com>
Tue, 10 Jan 2012 15:40:49 +0000 (17:40 +0200)
committerGeorgios Gousios <gousiosg@gmail.com>
Tue, 10 Jan 2012 16:17:52 +0000 (18:17 +0200)
src/test/scala/gr/grnet/aquarium/user/UserActorTest.scala [new file with mode: 0644]

diff --git a/src/test/scala/gr/grnet/aquarium/user/UserActorTest.scala b/src/test/scala/gr/grnet/aquarium/user/UserActorTest.scala
new file mode 100644 (file)
index 0000000..1302368
--- /dev/null
@@ -0,0 +1,33 @@
+package gr.grnet.aquarium.user
+
+import gr.grnet.aquarium.logic.test.DSLTest
+import gr.grnet.aquarium.logic.accounting.Policy
+import org.junit.Test
+
+/**
+ * 
+ * @author Georgios Gousios <gousiosg@gmail.com>
+ */
+
+class UserActorTest extends DSLTest {
+
+  @Test
+  def testUserStateSerialization = {
+    before
+    val now = System.currentTimeMillis()
+    val state = UserState(
+      "1",
+      ActiveSuspendedSnapshot(true, now),
+      CreditSnapshot(0, now),
+      AgreementSnapshot("default", now),
+      RolesSnapshot(Nil, now),
+      PaymentOrdersSnapshot(Nil, now),
+      OwnedGroupsSnapshot(Nil, now),
+      GroupMembershipsSnapshot(Nil, now),
+      OwnedResourcesSnapshot(Map(("foo", "1") -> (0F, 0L)), now)
+    )
+
+    println(state.toJson)
+    assertNotThrows(state.toJson)
+  }
+}
\ No newline at end of file