All tests compile
This commit is contained in:
parent
076a29d666
commit
7cdda0fb82
7 changed files with 135 additions and 165 deletions
|
|
@ -5,7 +5,8 @@ import junit.framework.TestCase
|
|||
import org.junit.{Test, Before}
|
||||
import org.junit.Assert._
|
||||
|
||||
import se.scalablesolutions.akka.actor.{Actor, Transactor}
|
||||
import se.scalablesolutions.akka.actor.{Actor, ActorID, Transactor}
|
||||
import Actor._
|
||||
|
||||
/**
|
||||
* A persistent actor based on Redis storage.
|
||||
|
|
@ -21,8 +22,8 @@ import se.scalablesolutions.akka.actor.{Actor, Transactor}
|
|||
*/
|
||||
|
||||
case class Balance(accountNo: String)
|
||||
case class Debit(accountNo: String, amount: BigInt, failer: Actor)
|
||||
case class MultiDebit(accountNo: String, amounts: List[BigInt], failer: Actor)
|
||||
case class Debit(accountNo: String, amount: BigInt, failer: ActorID)
|
||||
case class MultiDebit(accountNo: String, amounts: List[BigInt], failer: ActorID)
|
||||
case class Credit(accountNo: String, amount: BigInt)
|
||||
case object LogSize
|
||||
|
||||
|
|
@ -97,9 +98,9 @@ class AccountActor extends Transactor {
|
|||
class RedisPersistentActorSpec extends TestCase {
|
||||
@Test
|
||||
def testSuccessfulDebit = {
|
||||
val bactor = new AccountActor
|
||||
val bactor = newActor[AccountActor]
|
||||
bactor.start
|
||||
val failer = new PersistentFailerActor
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
failer.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
bactor !! Debit("a-123", 3000, failer)
|
||||
|
|
@ -117,12 +118,12 @@ class RedisPersistentActorSpec extends TestCase {
|
|||
|
||||
@Test
|
||||
def testUnsuccessfulDebit = {
|
||||
val bactor = new AccountActor
|
||||
val bactor = newActor[AccountActor]
|
||||
bactor.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
assertEquals(BigInt(5000), (bactor !! Balance("a-123")).get)
|
||||
|
||||
val failer = new PersistentFailerActor
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
bactor !! Debit("a-123", 7000, failer)
|
||||
|
|
@ -138,13 +139,13 @@ class RedisPersistentActorSpec extends TestCase {
|
|||
|
||||
@Test
|
||||
def testUnsuccessfulMultiDebit = {
|
||||
val bactor = new AccountActor
|
||||
val bactor = newActor[AccountActor]
|
||||
bactor.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
|
||||
assertEquals(BigInt(5000), (bactor !! (Balance("a-123"), 5000)).get)
|
||||
|
||||
val failer = new PersistentFailerActor
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
bactor !! MultiDebit("a-123", List(500, 2000, 1000, 3000), failer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue