>
> Yes, 
> http://doc.akka.io/docs/akka/snapshot/scala/persistence.html#state-machines
>

thank you for the pointer.

The problem was that I had overwritten preStart, with something like:

super.preStart()
self ! Message

and that did not play well with Processor.
Since it is probably not a good idea, I have refactored my FSM and I am not 
overwriting #preStart anymore.

Now, in "normal" condition, my Processor-FSM runs fine but I have a new 
problem.

I have some tests for the FSM, I  have just updated to last scalatest 
version to be sure to use the most up to date stuff:

"com.typesafe.akka" %% "akka-actor" % "2.3.2",
"com.typesafe.akka" %% "akka-persistence-experimental" % "2.3.2",

"org.scalatest" %% "scalatest" % "2.1.5" % "test",
"com.typesafe.akka" %% "akka-testkit" % "2.3.2" % "test",
"org.mockito" % "mockito-core" % "1.9.5" % "test"

One test is a mixin between FunSpec and akka TestKit and looks like:

>-------------
val brain = mock[SchedulerBrain]
when(brain.timeoutFor).thenReturn(Map[Symbol, 
FiniteDuration]().withDefaultValue(50.seconds))
when(brain.schedule(Mock.gate, Map())).thenReturn(Map("123" -> 
"/collector/123"))
fsmRef = createFsmRef(brain)
Thread.sleep(100)
assert(fsmRef.stateName === Waiting)
assert(fsmRef.stateData === Map("123" -> "/collector/123"))
verify(brain).schedule(Mock.gate, Map())
-------------<

When my FSM is an Actor (not a Processor), the test run successfully and 
this is the log:

[DEBUG] [05/04/2014 13:57:35.228] [default-scheduler-1] 
[akka://default/user/$$a] transition 
org.peach.moma.schedulers.CollectorsScheduler$Waiting$@7a7d0e26 -> 
org.peach.moma.schedulers.CollectorsScheduler$Scheduling$@62170848
[DEBUG] [05/04/2014 13:57:35.229] [default-scheduler-1] 
[akka://default/user/$$a] processing Event(Scheduled(Map(123 -> 
/collector/123)),Map()) from TestActor[akka://default/user/$$a]
[DEBUG] [05/04/2014 13:57:35.230] [default-scheduler-1] 
[akka://default/user/$$a] transition 
org.peach.moma.schedulers.CollectorsScheduler$Scheduling$@62170848 -> 
org.peach.moma.schedulers.CollectorsScheduler$Waiting$@7a7d0e26

When my FSM is a Processor, then I have this assertion error:
Map() did not equal Map("123" -> "/collector/123")
and no logs related to the FSM transitions (???).

The only difference is about extending Actor or Processor, I am not yet 
using any Persistent message so the behaviour should not vary, I think.

I have another test related to that FSM and also it is green with Actor, 
red with Processor, so it really seems that persistence is affecting tests 
in a bad way.

Any idea?
Thanks

>  

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to