Fixed last persistence issues with new STM, all test pass

This commit is contained in:
Jonas Bonér 2010-03-05 16:07:06 +01:00
parent 36c0266a5d
commit efa0cc0d5a
2 changed files with 11 additions and 18 deletions

View file

@ -1,13 +1,9 @@
package se.scalablesolutions.akka.state
import se.scalablesolutions.akka.actor.Actor
import junit.framework.TestCase
import se.scalablesolutions.akka.actor.{Actor, Transactor}
import org.junit.Test
import org.junit.Assert._
import org.apache.cassandra.service.CassandraDaemon
import org.junit.BeforeClass
import org.junit.Before
import org.scalatest.junit.JUnitSuite
@ -28,9 +24,8 @@ case class SetRefStateOneWay(key: String)
case class SuccessOneWay(key: String, value: String)
case class FailureOneWay(key: String, value: String, failer: Actor)
class CassandraPersistentActor extends Actor {
class CassandraPersistentActor extends Transactor {
timeout = 100000
makeTransactionRequired
private lazy val mapState = CassandraStorage.newMap
private lazy val vectorState = CassandraStorage.newVector
@ -66,8 +61,7 @@ class CassandraPersistentActor extends Actor {
}
}
@serializable class PersistentFailerActor extends Actor {
makeTransactionRequired
@serializable class PersistentFailerActor extends Transactor {
def receive = {
case "Failure" =>
throw new RuntimeException("expected")
@ -76,8 +70,8 @@ class CassandraPersistentActor extends Actor {
class CassandraPersistentActorSpec extends JUnitSuite {
@Before
def startCassandra = EmbeddedCassandraService.start
//@Before
//def startCassandra = EmbeddedCassandraService.start
@Test
def testMapShouldNotRollbackStateForStatefulServerInCaseOfSuccess = {

View file

@ -8,7 +8,7 @@ import org.junit.Assert._
import _root_.dispatch.json.{JsNumber, JsValue}
import _root_.dispatch.json.Js._
import se.scalablesolutions.akka.actor.Actor
import se.scalablesolutions.akka.actor.{Transactor, Actor}
/**
* A persistent actor based on MongoDB storage.
@ -29,10 +29,10 @@ case class MultiDebit(accountNo: String, amounts: List[BigInt], failer: Actor)
case class Credit(accountNo: String, amount: BigInt)
case object LogSize
class BankAccountActor extends Actor {
makeTransactionRequired
private val accountState = MongoStorage.newMap
private val txnLog = MongoStorage.newVector
class BankAccountActor extends Transactor {
private lazy val accountState = MongoStorage.newMap
private lazy val txnLog = MongoStorage.newVector
def receive: PartialFunction[Any, Unit] = {
// check balance
@ -91,8 +91,7 @@ class BankAccountActor extends Actor {
}
}
@serializable class PersistentFailerActor extends Actor {
makeTransactionRequired
@serializable class PersistentFailerActor extends Transactor {
def receive = {
case "Failure" =>
throw new RuntimeException("expected")