From 4ecd3f6cab6faabe95cdea61eec29304f1f36927 Mon Sep 17 00:00:00 2001 From: Peter Vlugter Date: Sun, 14 Nov 2010 09:48:57 +1300 Subject: [PATCH] Remove disabled src in stm module --- .../disabled-src/main/scala/actor/Agent.scala | 309 ------------------ .../actor/NestedTransactionalTypedActor.java | 12 - .../NestedTransactionalTypedActorImpl.java | 59 ---- .../akka/actor/TransactionalTypedActor.java | 14 - .../actor/TransactionalTypedActorImpl.java | 88 ----- .../test/scala/actor/AgentSpec.scala | 111 ------- .../test/scala/actor/TransactorSpec.scala | 255 --------------- .../test/scala/remote/RemoteAgentSpec.scala | 37 --- .../RemoteTransactionalTypedActorSpec.scala | 111 ------- .../NestedTransactionalTypedActorSpec.scala | 102 ------ ...artNestedTransactionalTypedActorSpec.scala | 118 ------- .../RestartTransactionalTypedActorSpec.scala | 90 ----- .../TransactionalTypedActorSpec.scala | 83 ----- 13 files changed, 1389 deletions(-) delete mode 100644 akka-stm/disabled-src/main/scala/actor/Agent.scala delete mode 100644 akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActor.java delete mode 100644 akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActorImpl.java delete mode 100644 akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActor.java delete mode 100644 akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActorImpl.java delete mode 100644 akka-stm/disabled-src/test/scala/actor/AgentSpec.scala delete mode 100644 akka-stm/disabled-src/test/scala/actor/TransactorSpec.scala delete mode 100644 akka-stm/disabled-src/test/scala/remote/RemoteAgentSpec.scala delete mode 100644 akka-stm/disabled-src/test/scala/remote/RemoteTransactionalTypedActorSpec.scala delete mode 100644 akka-stm/disabled-src/test/scala/typed-actor/NestedTransactionalTypedActorSpec.scala delete mode 100644 akka-stm/disabled-src/test/scala/typed-actor/RestartNestedTransactionalTypedActorSpec.scala delete mode 100644 akka-stm/disabled-src/test/scala/typed-actor/RestartTransactionalTypedActorSpec.scala delete mode 100644 akka-stm/disabled-src/test/scala/typed-actor/TransactionalTypedActorSpec.scala diff --git a/akka-stm/disabled-src/main/scala/actor/Agent.scala b/akka-stm/disabled-src/main/scala/actor/Agent.scala deleted file mode 100644 index 28a98bc7c5..0000000000 --- a/akka-stm/disabled-src/main/scala/actor/Agent.scala +++ /dev/null @@ -1,309 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ - -package akka.actor - -import akka.stm.Ref -import akka.config.RemoteAddress -import akka.japi.{Function => JFunc, Procedure => JProc} -import akka.AkkaException - -import java.util.concurrent.atomic.AtomicReference -import java.util.concurrent.CountDownLatch - -class AgentException private[akka](message: String) extends AkkaException(message) - -/** -* The Agent class was strongly inspired by the agent principle in Clojure. -*

-* -* Agents provide independent, asynchronous change of individual locations. -* Agents are bound to a single storage location for their lifetime, and -* only allow mutation of that location (to a new state) to occur as a -* result of an action. Actions are functions (with, optionally, additional -* arguments) that are asynchronously applied to an Agent's state and whose -* return value becomes the Agent's new state. Because the set of functions -* is open, the set of actions supported by an Agent is also open, a sharp -* contrast to pattern matching message handling loops provided by Actors. -*

-* -* Agents are reactive, not autonomous - there is no imperative message loop -* and no blocking receive. The state of an Agent should be itself immutable -* (preferably an instance of one of Akka's persistent collections), and the -* state of an Agent is always immediately available for reading by any -* thread (using the '()' function) without any messages, i.e. observation -* does not require cooperation or coordination. -*

-* -* The actions of all Agents get interleaved amongst threads in a thread pool. -* At any point in time, at most one action for each Agent is being executed. -* Actions dispatched to an agent from another single agent or thread will -* occur in the order they were sent, potentially interleaved with actions -* dispatched to the same agent from other sources. -*

-* -* If an Agent is used within an enclosing transaction, then it will -* participate in that transaction. -*

-* -* Example of usage: -*

-* val agent = Agent(5)
-*
-* agent send (_ + 1)
-* agent send (_ * 2)
-*
-* val result = agent()
-* ... // use result
-*
-* agent.close
-* 
-*

-* -* Agent is also monadic, which means that you can compose operations using -* for-comprehensions. In monadic usage the original agents are not touched -* but new agents are created. So the old values (agents) are still available -* as-is. They are so-called 'persistent'. -*

-* -* Example of monadic usage: -*

-* val agent1 = Agent(3)
-* val agent2 = Agent(5)
-*
-* for (value <- agent1) {
-*   result = value + 1
-* }
-*
-* val agent3 =
-*   for (value <- agent1) yield value + 1
-*
-* val agent4 = for {
-*   value1 <- agent1
-*   value2 <- agent2
-* } yield value1 + value2
-*
-* agent1.close
-* agent2.close
-* agent3.close
-* agent4.close
-* 
-*

-* -* IMPORTANT: -*

-* You can *not* call 'agent.get', 'agent()' or use the monadic 'foreach', -* 'map' and 'flatMap' within an enclosing transaction since that would block -* the transaction indefinitely. But all other operations are fine. The system -* will raise an error (e.g. *not* deadlock) if you try to do so, so as long as -* you test your application thoroughly you should be fine. -* -* @author Viktor Klang -* @author Jonas Bonér -*/ -sealed class Agent[T] private (initialValue: T, remote: Option[RemoteAddress] = None) { - - import Agent._ - import Actor._ - - val dispatcher = remote match { - case Some(address) => - val d = actorOf(new AgentDispatcher[T]()) - d.makeRemote(remote.get.hostname, remote.get.port) - d.start - d ! Value(initialValue) - d - case None => - actorOf(new AgentDispatcher(initialValue)).start - } - - /** - * Submits a request to read the internal state. - * - * A copy of the internal state will be returned, depending on the underlying - * effective copyStrategy. Internally leverages the asynchronous getValue() - * method and then waits for its result on a CountDownLatch. - */ - final def get: T = { - if (dispatcher.isTransactionInScope) throw new AgentException( - "Can't call Agent.get within an enclosing transaction."+ - "\n\tWould block indefinitely.\n\tPlease refactor your code.") - val f = (dispatcher.!!![T](Read, java.lang.Long.MAX_VALUE)).await - if (f.exception.isDefined) throw f.exception.get - else f.result.getOrElse(throw new IllegalStateException("Agent remote request timed out")) - } - - /** - * Submits a request to read the internal state. A copy of the internal state will be - * returned, depending on the underlying effective copyStrategy. Internally leverages - * the asynchronous getValue() method and then waits for its result on a CountDownLatch. - */ - final def apply(): T = get - - /** - * Submits the provided function for execution against the internal agent's state. - */ - final def apply(message: (T => T)): Unit = dispatcher ! Function(message) - - /** - * Submits the provided function for execution against the internal agent's state. - * Java API - */ - final def apply(message: JFunc[T,T]): Unit = dispatcher ! Function((t: T) => message(t)) - - - /** - * Submits a new value to be set as the new agent's internal state. - */ - final def apply(message: T): Unit = dispatcher ! Value(message) - - /** - * Submits the provided function of type 'T => T' for execution against the internal agent's state. - */ - final def send(message: (T) => T): Unit = dispatcher ! Function(message) - - /** - * Submits the provided function of type 'T => T' for execution against the internal agent's state. - * Java API - */ - final def send(message: JFunc[T,T]): Unit = dispatcher ! Function((t: T) => message(t)) - - /** - * Submits a new value to be set as the new agent's internal state. - */ - final def send(message: T): Unit = dispatcher ! Value(message) - - /** - * Asynchronously submits a procedure of type 'T => Unit' to read the internal state. - * The supplied procedure will be executed on the returned internal state value. A copy - * of the internal state will be used, depending on the underlying effective copyStrategy. - * Does not change the value of the agent (this). - */ - final def sendProc(f: (T) => Unit): Unit = dispatcher ! Procedure(f) - - /** - * Asynchronously submits a procedure of type 'T => Unit' to read the internal state. - * The supplied procedure will be executed on the returned internal state value. A copy - * of the internal state will be used, depending on the underlying effective copyStrategy. - * Does not change the value of the agent (this). - * Java API - */ - final def sendProc(f: JProc[T]): Unit = dispatcher ! Procedure((t: T) => f(t)) - - /** - * Applies function with type 'T => B' to the agent's internal state and then returns a new agent with the result. - * Does not change the value of the agent (this). - */ - final def map[B](f: (T) => B): Agent[B] = Agent(f(get), remote) - - /** - * Applies function with type 'T => B' to the agent's internal state and then returns a new agent with the result. - * Does not change the value of the agent (this). - */ - final def flatMap[B](f: (T) => Agent[B]): Agent[B] = Agent(f(get)(), remote) - - /** - * Applies function with type 'T => B' to the agent's internal state. - * Does not change the value of the agent (this). - */ - final def foreach(f: (T) => Unit): Unit = f(get) - - /** - * Applies function with type 'T => B' to the agent's internal state and then returns a new agent with the result. - * Does not change the value of the agent (this). - * Java API - */ - final def map[B](f: JFunc[T, B]): Agent[B] = Agent(f(get), remote) - - /** - * Applies function with type 'T => B' to the agent's internal state and then returns a new agent with the result. - * Does not change the value of the agent (this). - * Java API - */ - final def flatMap[B](f: JFunc[T, Agent[B]]): Agent[B] = Agent(f(get)(), remote) - - /** - * Applies procedure with type T to the agent's internal state. - * Does not change the value of the agent (this). - * Java API - */ - final def foreach(f: JProc[T]): Unit = f(get) - - /** - * Closes the agents and makes it eligable for garbage collection. - * - * A closed agent can never be used again. - */ - def close = dispatcher.stop -} - -/** - * Provides factory methods to create Agents. - * - * @author Viktor Klang - * @author Jonas Bonér - */ -object Agent { - import Actor._ - - /** - * The internal messages for passing around requests. - */ - private[akka] case class Value[T](value: T) - private[akka] case class Function[T](fun: ((T) => T)) - private[akka] case class Procedure[T](fun: ((T) => Unit)) - private[akka] case object Read - - /** - * Creates a new Agent of type T with the initial value of value. - */ - def apply[T](value: T): Agent[T] = - apply(value, None) - - /** - * Creates an Agent backed by a client managed Actor if Some(remoteAddress) - * or a local agent if None - */ - def apply[T](value: T, remoteAddress: Option[RemoteAddress]): Agent[T] = - new Agent[T](value, remoteAddress) - - /** - * Creates an Agent backed by a client managed Actor - */ - def apply[T](value: T, remoteAddress: RemoteAddress): Agent[T] = - apply(value, Some(remoteAddress)) -} - -/** - * Agent dispatcher Actor. - * - * @author Jonas Bonér - */ -final class AgentDispatcher[T] private (ref: Ref[T]) extends Transactor { - import Agent._ - - private[akka] def this(initialValue: T) = this(Ref(initialValue)) - private[akka] def this() = this(Ref[T]()) - - private val value = ref - - log.debug("Starting up Agent [%s]", self.uuid) - - /** - * Periodically handles incoming messages. - */ - def receive = { - case Value(v: T) => swap(v) - case Read => self.reply_?(value.get()) - case Function(fun: (T => T)) => swap(fun(value.getOrWait)) - case Procedure(proc: (T => Unit)) => proc(value.getOrElse( - throw new AgentException("Could not read Agent's value; value is null"))) - } - - /** - * Performs a CAS operation, atomically swapping the internal state with the value - * provided as a by-name parameter. - */ - private def swap(newData: => T): Unit = value.swap(newData) -} diff --git a/akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActor.java b/akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActor.java deleted file mode 100644 index a257204daf..0000000000 --- a/akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActor.java +++ /dev/null @@ -1,12 +0,0 @@ -package akka.actor; - -public interface NestedTransactionalTypedActor { - public String getMapState(String key); - public String getVectorState(); - public String getRefState(); - public void setMapState(String key, String msg); - public void setVectorState(String msg); - public void setRefState(String msg); - public void success(String key, String msg); - public String failure(String key, String msg, TypedActorFailer failer); -} diff --git a/akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActorImpl.java b/akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActorImpl.java deleted file mode 100644 index bbc7ae9306..0000000000 --- a/akka-stm/disabled-src/test/java/akka/actor/NestedTransactionalTypedActorImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -package akka.actor; - -import akka.actor.*; -import akka.stm.*; - -public class NestedTransactionalTypedActorImpl extends TypedTransactor implements NestedTransactionalTypedActor { - private TransactionalMap mapState; - private TransactionalVector vectorState; - private Ref refState; - private boolean isInitialized = false; - - @Override - public void preStart() { - if (!isInitialized) { - mapState = new TransactionalMap(); - vectorState = new TransactionalVector(); - refState = new Ref(); - isInitialized = true; - } - } - - public String getMapState(String key) { - return (String) mapState.get(key).get(); - } - - public String getVectorState() { - return (String) vectorState.last(); - } - - public String getRefState() { - return (String) refState.get(); - } - - public void setMapState(String key, String msg) { - mapState.put(key, msg); - } - - public void setVectorState(String msg) { - vectorState.add(msg); - } - - public void setRefState(String msg) { - refState.swap(msg); - } - - public void success(String key, String msg) { - mapState.put(key, msg); - vectorState.add(msg); - refState.swap(msg); - } - - public String failure(String key, String msg, TypedActorFailer failer) { - mapState.put(key, msg); - vectorState.add(msg); - refState.swap(msg); - failer.fail(); - return msg; - } -} diff --git a/akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActor.java b/akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActor.java deleted file mode 100644 index 4c7b262772..0000000000 --- a/akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActor.java +++ /dev/null @@ -1,14 +0,0 @@ -package akka.actor; - -public interface TransactionalTypedActor { - public String getMapState(String key); - public String getVectorState(); - public String getRefState(); - public void setMapState(String key, String msg); - public void setVectorState(String msg); - public void setRefState(String msg); - public void success(String key, String msg); - public void success(String key, String msg, NestedTransactionalTypedActor nested); - public String failure(String key, String msg, TypedActorFailer failer); - public String failure(String key, String msg, NestedTransactionalTypedActor nested, TypedActorFailer failer); -} diff --git a/akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActorImpl.java b/akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActorImpl.java deleted file mode 100644 index 49a2b493c0..0000000000 --- a/akka-stm/disabled-src/test/java/akka/actor/TransactionalTypedActorImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -package akka.actor; - -import akka.actor.*; -import akka.stm.*; - -public class TransactionalTypedActorImpl extends TypedTransactor implements TransactionalTypedActor { - private TransactionalMap mapState; - private TransactionalVector vectorState; - private Ref refState; - private boolean isInitialized = false; - - @Override - public void preStart() { - if (!isInitialized) { - isInitialized = new Atomic() { - public Boolean atomically() { - mapState = new TransactionalMap(); - vectorState = new TransactionalVector(); - refState = new Ref(); - return true; - } - }.execute(); - } - } - - public String getMapState(String key) { - return (String)mapState.get(key).get(); - } - - public String getVectorState() { - return (String)vectorState.last(); - } - - public String getRefState() { - return (String)refState.get(); - } - - public void setMapState(String key, String msg) { - mapState.put(key, msg); - } - - public void setVectorState(String msg) { - vectorState.add(msg); - } - - public void setRefState(String msg) { - refState.swap(msg); - } - - public void success(String key, String msg) { - mapState.put(key, msg); - vectorState.add(msg); - refState.swap(msg); - } - - public void success(String key, String msg, NestedTransactionalTypedActor nested) { - mapState.put(key, msg); - vectorState.add(msg); - refState.swap(msg); - nested.success(key, msg); - } - - public String failure(String key, String msg, TypedActorFailer failer) { - mapState.put(key, msg); - vectorState.add(msg); - refState.swap(msg); - failer.fail(); - return msg; - } - - public String failure(String key, String msg, NestedTransactionalTypedActor nested, TypedActorFailer failer) { - mapState.put(key, msg); - vectorState.add(msg); - refState.swap(msg); - nested.failure(key, msg, failer); - return msg; - } - - @Override - public void preRestart(Throwable e) { - System.out.println("################ PRE RESTART"); - } - - @Override - public void postRestart(Throwable e) { - System.out.println("################ POST RESTART"); - } -} diff --git a/akka-stm/disabled-src/test/scala/actor/AgentSpec.scala b/akka-stm/disabled-src/test/scala/actor/AgentSpec.scala deleted file mode 100644 index 6a3af2bb75..0000000000 --- a/akka-stm/disabled-src/test/scala/actor/AgentSpec.scala +++ /dev/null @@ -1,111 +0,0 @@ -package akka.actor - -import org.scalatest.Suite -import org.scalatest.junit.JUnitRunner -import org.scalatest.matchers.MustMatchers -import Actor._ - -import org.junit.runner.RunWith -import org.junit.Test - -import java.util.concurrent.{TimeUnit, CountDownLatch} - -@RunWith(classOf[JUnitRunner]) -class AgentSpec extends junit.framework.TestCase with Suite with MustMatchers { - - @Test def testSendFun = { - val agent = Agent(5) - agent send (_ + 1) - agent send (_ * 2) - val result = agent() - result must be(12) - agent.close - } - - @Test def testSendValue = { - val agent = Agent(5) - agent send 6 - val result = agent() - result must be(6) - agent.close - } - - @Test def testSendProc = { - val agent = Agent(5) - var result = 0 - val latch = new CountDownLatch(2) - agent sendProc { e => result += e; latch.countDown } - agent sendProc { e => result += e; latch.countDown } - assert(latch.await(5, TimeUnit.SECONDS)) - result must be(10) - agent.close - } - - @Test def testOneAgentsendWithinEnlosingTransactionSuccess = { - case object Go - val agent = Agent(5) - val latch = new CountDownLatch(1) - val tx = actorOf( new Transactor { - def receive = { case Go => agent send { e => latch.countDown; e + 1 } } - } ).start - tx ! Go - assert(latch.await(5, TimeUnit.SECONDS)) - val result = agent() - result must be(6) - agent.close - tx.stop - } - -/* - // Strange test - do we really need it? - @Test def testDoingAgentGetInEnlosingTransactionShouldYieldException = { - case object Go - val latch = new CountDownLatch(1) - val agent = Agent(5) - val tx = transactor { - case Go => - agent send (_ * 2) - try { agent() } - catch { - case _ => latch.countDown - } - } - tx ! Go - assert(latch.await(5, TimeUnit.SECONDS)) - agent.close - tx.stop - assert(true) - } -*/ - - @Test def testAgentForeach = { - val agent1 = Agent(3) - var result = 0 - for (first <- agent1) { - result = first + 1 - } - result must be(4) - agent1.close - } - - @Test def testAgentMap = { - val agent1 = Agent(3) - val result = for (first <- agent1) yield first + 1 - result() must be(4) - result.close - agent1.close - } - - @Test def testAgentFlatMap = { - val agent1 = Agent(3) - val agent2 = Agent(5) - val result = for { - first <- agent1 - second <- agent2 - } yield second + first - result() must be(8) - result.close - agent1.close - agent2.close - } -} diff --git a/akka-stm/disabled-src/test/scala/actor/TransactorSpec.scala b/akka-stm/disabled-src/test/scala/actor/TransactorSpec.scala deleted file mode 100644 index be182df870..0000000000 --- a/akka-stm/disabled-src/test/scala/actor/TransactorSpec.scala +++ /dev/null @@ -1,255 +0,0 @@ -package akka.actor - -import java.util.concurrent.{TimeUnit, CountDownLatch} -import org.scalatest.junit.JUnitSuite -import org.junit.Test - -import akka.stm.{Ref, TransactionalMap, TransactionalVector} -import Actor._ - -object TransactorSpec { - case class GetMapState(key: String) - case object GetVectorState - case object GetVectorSize - case object GetRefState - - case class SetMapState(key: String, value: String) - case class SetVectorState(key: String) - case class SetRefState(key: String) - case class Success(key: String, value: String) - case class Failure(key: String, value: String, failer: ActorRef) - - case class SetMapStateOneWay(key: String, value: String) - case class SetVectorStateOneWay(key: String) - case class SetRefStateOneWay(key: String) - case class SuccessOneWay(key: String, value: String) - case class FailureOneWay(key: String, value: String, failer: ActorRef) - - case object GetNotifier -} -import TransactorSpec._ - -class StatefulTransactor(expectedInvocationCount: Int) extends Transactor { - def this() = this(0) - self.timeout = 5000 - - val notifier = new CountDownLatch(expectedInvocationCount) - - private val mapState = TransactionalMap[String, String]() - private val vectorState = TransactionalVector[String]() - private val refState = Ref[String]() - - def receive = { - case GetNotifier => - self.reply(notifier) - case GetMapState(key) => - self.reply(mapState.get(key).get) - notifier.countDown - case GetVectorSize => - self.reply(vectorState.length.asInstanceOf[AnyRef]) - notifier.countDown - case GetRefState => - self.reply(refState.get) - notifier.countDown - case SetMapState(key, msg) => - mapState.put(key, msg) - self.reply(msg) - notifier.countDown - case SetVectorState(msg) => - vectorState.add(msg) - self.reply(msg) - notifier.countDown - case SetRefState(msg) => - refState.swap(msg) - self.reply(msg) - notifier.countDown - case Success(key, msg) => - mapState.put(key, msg) - vectorState.add(msg) - refState.swap(msg) - self.reply(msg) - notifier.countDown - case Failure(key, msg, failer) => - mapState.put(key, msg) - vectorState.add(msg) - refState.swap(msg) - failer !! "Failure" - self.reply(msg) - notifier.countDown - case SetMapStateOneWay(key, msg) => - mapState.put(key, msg) - notifier.countDown - case SetVectorStateOneWay(msg) => - vectorState.add(msg) - notifier.countDown - case SetRefStateOneWay(msg) => - refState.swap(msg) - notifier.countDown - case SuccessOneWay(key, msg) => - mapState.put(key, msg) - vectorState.add(msg) - refState.swap(msg) - notifier.countDown - case FailureOneWay(key, msg, failer) => - mapState.put(key, msg) - vectorState.add(msg) - refState.swap(msg) - notifier.countDown - failer ! "Failure" - } -} - -@serializable -class FailerTransactor extends Transactor { - - def receive = { - case "Failure" => - throw new RuntimeException("Expected exception; to test fault-tolerance") - } -} - -class TransactorSpec extends JUnitSuite { - - @Test - def shouldOneWayMapShouldNotRollbackStateForStatefulServerInCaseOfSuccess = { - val stateful = actorOf(new StatefulTransactor(2)) - stateful.start - stateful ! SetMapStateOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state - stateful ! SuccessOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - val notifier = (stateful !! GetNotifier).as[CountDownLatch] - assert(notifier.get.await(1, TimeUnit.SECONDS)) - assert("new state" === (stateful !! GetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess")).get) - } - - @Test - def shouldMapShouldNotRollbackStateForStatefulServerInCaseOfSuccess = { - val stateful = actorOf[StatefulTransactor] - stateful.start - stateful !! SetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state - stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - assert("new state" === (stateful !! GetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess")).get) - } - - @Test - def shouldOneWayMapShouldRollbackStateForStatefulServerInCaseOfFailure = { - val stateful = actorOf(new StatefulTransactor(2)) - stateful.start - val failer = actorOf[FailerTransactor] - failer.start - stateful ! SetMapStateOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state - stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - val notifier = (stateful !! GetNotifier).as[CountDownLatch] - assert(notifier.get.await(5, TimeUnit.SECONDS)) - assert("init" === (stateful !! GetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure")).get) // check that state is == init state - } - - @Test - def shouldMapShouldRollbackStateForStatefulServerInCaseOfFailure = { - val stateful = actorOf[StatefulTransactor] - stateful.start - stateful !! SetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state - val failer = actorOf[FailerTransactor] - failer.start - try { - stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - fail("should have thrown an exception") - } catch {case e: RuntimeException => {}} - assert("init" === (stateful !! GetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure")).get) // check that state is == init state - } - - @Test - def shouldOneWayVectorShouldNotRollbackStateForStatefulServerInCaseOfSuccess = { - val stateful = actorOf(new StatefulTransactor(2)) - stateful.start - stateful ! SetVectorStateOneWay("init") // set init state - stateful ! SuccessOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - val notifier = (stateful !! GetNotifier).as[CountDownLatch] - assert(notifier.get.await(1, TimeUnit.SECONDS)) - assert(2 === (stateful !! GetVectorSize).get) - } - - @Test - def shouldVectorShouldNotRollbackStateForStatefulServerInCaseOfSuccess = { - val stateful = actorOf[StatefulTransactor] - stateful.start - stateful !! SetVectorState("init") // set init state - stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - assert(2 === (stateful !! GetVectorSize).get) - } - - @Test - def shouldOneWayVectorShouldRollbackStateForStatefulServerInCaseOfFailure = { - val stateful = actorOf(new StatefulTransactor(2)) - stateful.start - stateful ! SetVectorStateOneWay("init") // set init state - Thread.sleep(1000) - val failer = actorOf[FailerTransactor] - failer.start - stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - val notifier = (stateful !! GetNotifier).as[CountDownLatch] - assert(notifier.get.await(1, TimeUnit.SECONDS)) - assert(1 === (stateful !! GetVectorSize).get) - } - - @Test - def shouldVectorShouldRollbackStateForStatefulServerInCaseOfFailure = { - val stateful = actorOf[StatefulTransactor] - stateful.start - stateful !! SetVectorState("init") // set init state - val failer = actorOf[FailerTransactor] - failer.start - try { - stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - fail("should have thrown an exception") - } catch {case e: RuntimeException => {}} - assert(1 === (stateful !! GetVectorSize).get) - } - - @Test - def shouldOneWayRefShouldNotRollbackStateForStatefulServerInCaseOfSuccess = { - val stateful = actorOf(new StatefulTransactor(2)) - stateful.start - stateful ! SetRefStateOneWay("init") // set init state - stateful ! SuccessOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - val notifier = (stateful !! GetNotifier).as[CountDownLatch] - assert(notifier.get.await(1, TimeUnit.SECONDS)) - assert("new state" === (stateful !! GetRefState).get) - } - - @Test - def shouldRefShouldNotRollbackStateForStatefulServerInCaseOfSuccess = { - val stateful = actorOf[StatefulTransactor] - stateful.start - stateful !! SetRefState("init") // set init state - stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - assert("new state" === (stateful !! GetRefState).get) - } - - @Test - def shouldOneWayRefShouldRollbackStateForStatefulServerInCaseOfFailure = { - val stateful = actorOf(new StatefulTransactor(2)) - stateful.start - stateful ! SetRefStateOneWay("init") // set init state - Thread.sleep(1000) - val failer = actorOf[FailerTransactor] - failer.start - stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - val notifier = (stateful !! GetNotifier).as[CountDownLatch] - assert(notifier.get.await(1, TimeUnit.SECONDS)) - assert("init" === (stateful !! (GetRefState, 1000000)).get) // check that state is == init state - } - - @Test - def shouldRefShouldRollbackStateForStatefulServerInCaseOfFailure = { - val stateful = actorOf[StatefulTransactor] - stateful.start - stateful !! SetRefState("init") // set init state - val failer = actorOf[FailerTransactor] - failer.start - try { - stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - fail("should have thrown an exception") - } catch {case e: RuntimeException => {}} - assert("init" === (stateful !! GetRefState).get) // check that state is == init state - } -} diff --git a/akka-stm/disabled-src/test/scala/remote/RemoteAgentSpec.scala b/akka-stm/disabled-src/test/scala/remote/RemoteAgentSpec.scala deleted file mode 100644 index 183158a6dc..0000000000 --- a/akka-stm/disabled-src/test/scala/remote/RemoteAgentSpec.scala +++ /dev/null @@ -1,37 +0,0 @@ -package akka.actor.remote - -import org.scalatest.junit.JUnitSuite -import org.junit.{Test, Before, After} -import akka.config.RemoteAddress -import akka.actor.Agent -import akka.remote. {RemoteClient, RemoteServer} - - -class RemoteAgentSpec extends JUnitSuite { - var server: RemoteServer = _ - - val HOSTNAME = "localhost" - val PORT = 9992 - - @Before def startServer { - val s = new RemoteServer() - s.start(HOSTNAME, PORT) - server = s - Thread.sleep(1000) - } - - @After def stopServer { - val s = server - server = null - s.shutdown - RemoteClient.shutdownAll - } - - @Test def remoteAgentShouldInitializeProperly { - val a = Agent(10,RemoteAddress(HOSTNAME,PORT)) - assert(a() == 10, "Remote agent should have the proper initial value") - a(20) - assert(a() == 20, "Remote agent should be updated properly") - a.close - } -} diff --git a/akka-stm/disabled-src/test/scala/remote/RemoteTransactionalTypedActorSpec.scala b/akka-stm/disabled-src/test/scala/remote/RemoteTransactionalTypedActorSpec.scala deleted file mode 100644 index 0e5d94aeee..0000000000 --- a/akka-stm/disabled-src/test/scala/remote/RemoteTransactionalTypedActorSpec.scala +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ - -package akka.actor - -import org.scalatest.Spec -import org.scalatest.Assertions -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.BeforeAndAfterAll -import org.scalatest.junit.JUnitRunner -import org.junit.runner.RunWith -import org.junit.{Test, Before, After} - -import akka.config.Config -import akka.config.TypedActorConfigurator -import akka.remote.{RemoteNode, RemoteServer, RemoteClient} - -object RemoteTransactionalTypedActorSpec { - val HOSTNAME = "localhost" - val PORT = 9988 - var server: RemoteServer = null -} - -@RunWith(classOf[JUnitRunner]) -class RemoteTransactionalTypedActorSpec extends - Spec with - ShouldMatchers with - BeforeAndAfterAll { - - import RemoteTransactionalTypedActorSpec._ - Config.config - - private val conf = new TypedActorConfigurator - private var messageLog = "" - - override def beforeAll = { - server = new RemoteServer() - server.start(HOSTNAME, PORT) - Thread.sleep(1000) - } - - override def afterAll = { - conf.stop - try { - server.shutdown - RemoteClient.shutdownAll - Thread.sleep(1000) - } catch { - case e => () - } - } - - describe("Remote transactional in-memory TypedActor ") { -/* - it("map should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newRemoteInstance(classOf[TransactionalTypedActor], 1000, HOSTNAME, PORT) - stateful.setMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - stateful.getMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess") should equal("new state") - } - - it("map should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newRemoteInstance(classOf[TransactionalTypedActor], 1000, HOSTNAME, PORT) - stateful.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state - val failer =TypedActor.newRemoteInstance(classOf[TypedActorFailer], 1000, HOSTNAME, PORT) //conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure") should equal("init") - } - - it("vector should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newRemoteInstance(classOf[TransactionalTypedActor], 1000, HOSTNAME, PORT) - stateful.setVectorState("init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - stateful.getVectorState should equal("new state") - } - - it("vector should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newRemoteInstance(classOf[TransactionalTypedActor], 1000, HOSTNAME, PORT) - stateful.setVectorState("init") // set init state - val failer =TypedActor.newRemoteInstance(classOf[TypedActorFailer], 1000, HOSTNAME, PORT) //conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getVectorState should equal("init") - } - - it("ref should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newRemoteInstance(classOf[TransactionalTypedActor], 1000, HOSTNAME, PORT) - stateful.setRefState("init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - stateful.getRefState should equal("new state") - } - - it("ref should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newRemoteInstance(classOf[TransactionalTypedActor], 1000, HOSTNAME, PORT) - stateful.setRefState("init") // set init state - val failer =TypedActor.newRemoteInstance(classOf[TypedActorFailer], 1000, HOSTNAME, PORT) //conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getRefState should equal("init") - } - */ - } -} diff --git a/akka-stm/disabled-src/test/scala/typed-actor/NestedTransactionalTypedActorSpec.scala b/akka-stm/disabled-src/test/scala/typed-actor/NestedTransactionalTypedActorSpec.scala deleted file mode 100644 index 7111e60980..0000000000 --- a/akka-stm/disabled-src/test/scala/typed-actor/NestedTransactionalTypedActorSpec.scala +++ /dev/null @@ -1,102 +0,0 @@ - /** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ - -package akka.actor - -import org.scalatest.Spec -import org.scalatest.Assertions -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.BeforeAndAfterAll -import org.scalatest.junit.JUnitRunner -import org.junit.runner.RunWith - -import akka.actor._ - -@RunWith(classOf[JUnitRunner]) -class NestedTransactionalTypedActorSpec extends - Spec with - ShouldMatchers with - BeforeAndAfterAll { - - private var messageLog = "" - - override def afterAll { - // ActorRegistry.shutdownAll - } - - describe("Declaratively nested supervised transactional in-memory TypedActor") { - - it("map should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state - val nested = TypedActor.newInstance(classOf[NestedTransactionalTypedActor], classOf[NestedTransactionalTypedActorImpl]) - nested.setMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state", nested) // transactionrequired - stateful.getMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess") should equal("new state") - nested.getMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess") should equal("new state") - } - - it("map should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state - val nested = TypedActor.newInstance(classOf[NestedTransactionalTypedActor], classOf[NestedTransactionalTypedActorImpl]) - nested.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state - val failer = TypedActor.newInstance(classOf[TypedActorFailer], classOf[TypedActorFailerImpl]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", nested, failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure") should equal("init") - nested.getMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure") should equal("init") - } - - it("vector should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setVectorState("init") // set init state - val nested = TypedActor.newInstance(classOf[NestedTransactionalTypedActor], classOf[NestedTransactionalTypedActorImpl]) - nested.setVectorState("init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state", nested) // transactionrequired - stateful.getVectorState should equal("new state") - nested.getVectorState should equal("new state") - } - - it("vector should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setVectorState("init") // set init state - val nested = TypedActor.newInstance(classOf[NestedTransactionalTypedActor], classOf[NestedTransactionalTypedActorImpl]) - nested.setVectorState("init") // set init state - val failer = TypedActor.newInstance(classOf[TypedActorFailer], classOf[TypedActorFailerImpl]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", nested, failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getVectorState should equal("init") - nested.getVectorState should equal("init") - } - - it("ref should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - val nested = TypedActor.newInstance(classOf[NestedTransactionalTypedActor], classOf[NestedTransactionalTypedActorImpl]) - stateful.setRefState("init") // set init state - nested.setRefState("init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state", nested) - stateful.getRefState should equal("new state") - nested.getRefState should equal("new state") - } - - it("ref should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - val nested = TypedActor.newInstance(classOf[NestedTransactionalTypedActor], classOf[NestedTransactionalTypedActorImpl]) - stateful.setRefState("init") // set init state - nested.setRefState("init") // set init state - val failer = TypedActor.newInstance(classOf[TypedActorFailer], classOf[TypedActorFailerImpl]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", nested, failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getRefState should equal("init") - nested.getRefState should equal("init") - } - } -} diff --git a/akka-stm/disabled-src/test/scala/typed-actor/RestartNestedTransactionalTypedActorSpec.scala b/akka-stm/disabled-src/test/scala/typed-actor/RestartNestedTransactionalTypedActorSpec.scala deleted file mode 100644 index d35ec3c280..0000000000 --- a/akka-stm/disabled-src/test/scala/typed-actor/RestartNestedTransactionalTypedActorSpec.scala +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ - -package akka.actor - -import org.scalatest.Spec -import org.scalatest.Assertions -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.BeforeAndAfterAll -import org.scalatest.junit.JUnitRunner -import org.junit.runner.RunWith - -import akka.config.Config -import akka.config._ -import akka.config.TypedActorConfigurator -import akka.config.Supervision._ -import akka.actor._ - -@RunWith(classOf[JUnitRunner]) -class RestartNestedTransactionalTypedActorSpec extends - Spec with - ShouldMatchers with - BeforeAndAfterAll { - - private val conf = new TypedActorConfigurator - private var messageLog = "" - - override def beforeAll { - /* - Config.config - conf.configure( - new RestartStrategy(new AllForOne, 3, 5000, List(classOf[Exception]).toArray), - List( - new Component(classOf[TransactionalTypedActor], - new Permanent, - 10000), - new Component(classOf[NestedTransactionalTypedActor], - new Permanent, - 10000), - new Component(classOf[TypedActorFailer], - new Permanent, - 10000) - ).toArray).supervise - */ - } - - override def afterAll { - /* - conf.stop - ActorRegistry.shutdownAll - */ - } - - describe("Restart nested supervised transactional Typed Actor") { -/* - it("map should rollback state for stateful server in case of failure") { - val stateful = conf.getInstance(classOf[TransactionalTypedActor]) - stateful.init - stateful.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state - - val nested = conf.getInstance(classOf[NestedTransactionalTypedActor]) - nested.init - nested.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state - - val failer = conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", nested, failer) - - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure") should equal("init") - - nested.getMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure") should equal("init") - } - - it("vector should rollback state for stateful server in case of failure") { - val stateful = conf.getInstance(classOf[TransactionalTypedActor]) - stateful.init - stateful.setVectorState("init") // set init state - - val nested = conf.getInstance(classOf[NestedTransactionalTypedActor]) - nested.init - nested.setVectorState("init") // set init state - - val failer = conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", nested, failer) - - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getVectorState should equal("init") - - nested.getVectorState should equal("init") - } - - it("ref should rollback state for stateful server in case of failure") { - val stateful = conf.getInstance(classOf[TransactionalTypedActor]) - stateful.init - val nested = conf.getInstance(classOf[NestedTransactionalTypedActor]) - nested.init - stateful.setRefState("init") // set init state - - nested.setRefState("init") // set init state - - val failer = conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", nested, failer) - - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getRefState should equal("init") - - nested.getRefState should equal("init") - } - */ - } -} diff --git a/akka-stm/disabled-src/test/scala/typed-actor/RestartTransactionalTypedActorSpec.scala b/akka-stm/disabled-src/test/scala/typed-actor/RestartTransactionalTypedActorSpec.scala deleted file mode 100644 index a06975c291..0000000000 --- a/akka-stm/disabled-src/test/scala/typed-actor/RestartTransactionalTypedActorSpec.scala +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ - -package akka.actor - -import org.scalatest.Spec -import org.scalatest.Assertions -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.BeforeAndAfterAll -import org.scalatest.junit.JUnitRunner -import org.junit.runner.RunWith - -import akka.config.Supervision._ -import akka.actor._ -import akka.config.{Config, TypedActorConfigurator} - -@RunWith(classOf[JUnitRunner]) -class RestartTransactionalTypedActorSpec extends - Spec with - ShouldMatchers with - BeforeAndAfterAll { - - private val conf = new TypedActorConfigurator - private var messageLog = "" - - def before { - Config.config - conf.configure( - AllForOneStrategy(List(classOf[Exception]), 3, 5000), - List( - new SuperviseTypedActor( - classOf[TransactionalTypedActor], - Temporary, - 10000), - new SuperviseTypedActor( - classOf[TypedActorFailer], - Temporary, - 10000) - ).toArray).supervise - } - - def after { - conf.stop - ActorRegistry.shutdownAll - } - - describe("Restart supervised transactional Typed Actor ") { -/* - it("map should rollback state for stateful server in case of failure") { - before - val stateful = conf.getInstance(classOf[TransactionalTypedActor]) - stateful.init - stateful.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") - val failer = conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure") should equal("init") - after - } - - it("vector should rollback state for stateful server in case of failure") { - before - val stateful = conf.getInstance(classOf[TransactionalTypedActor]) - stateful.init - stateful.setVectorState("init") // set init state - val failer = conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getVectorState should equal("init") - after - } - - it("ref should rollback state for stateful server in case of failure") { - val stateful = conf.getInstance(classOf[TransactionalTypedActor]) - stateful.init - stateful.setRefState("init") // set init state - val failer = conf.getInstance(classOf[TypedActorFailer]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getRefState should equal("init") - } -*/ } -} diff --git a/akka-stm/disabled-src/test/scala/typed-actor/TransactionalTypedActorSpec.scala b/akka-stm/disabled-src/test/scala/typed-actor/TransactionalTypedActorSpec.scala deleted file mode 100644 index 7f1c23ed3c..0000000000 --- a/akka-stm/disabled-src/test/scala/typed-actor/TransactionalTypedActorSpec.scala +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ - -package akka.actor - -import org.scalatest.Spec -import org.scalatest.Assertions -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.BeforeAndAfterAll -import org.scalatest.junit.JUnitRunner -import org.junit.runner.RunWith - -import akka.actor._ - -@RunWith(classOf[JUnitRunner]) -class TransactionalTypedActorSpec extends - Spec with - ShouldMatchers with - BeforeAndAfterAll { - - private var messageLog = "" - - override def afterAll { -// ActorRegistry.shutdownAll - } - - describe("Declaratively supervised transactional in-memory Typed Actor ") { - it("map should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") - stateful.getMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess") should equal("new state") - } - - it("map should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") - val failer = TypedActor.newInstance(classOf[TypedActorFailer], classOf[TypedActorFailerImpl]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure") should equal("init") - } - - it("vector should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setVectorState("init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") - stateful.getVectorState should equal("new state") - } - - it("vector should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setVectorState("init") // set init state - val failer = TypedActor.newInstance(classOf[TypedActorFailer], classOf[TypedActorFailerImpl]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getVectorState should equal("init") - } - - it("ref should not rollback state for stateful server in case of success") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setRefState("init") // set init state - stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") - stateful.getRefState should equal("new state") - } - - it("ref should rollback state for stateful server in case of failure") { - val stateful = TypedActor.newInstance(classOf[TransactionalTypedActor], classOf[TransactionalTypedActorImpl]) - stateful.setRefState("init") // set init state - val failer = TypedActor.newInstance(classOf[TypedActorFailer], classOf[TypedActorFailerImpl]) - try { - stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) - fail("should have thrown an exception") - } catch { case e => {} } - stateful.getRefState should equal("init") - } - } -}