Hi to all,I have something strange that I cannot understand.
I have this test that worked very well
"give online status NeverLogged for never logged user" in new WithUsersData() {
val auth = createAndAuthenticateUser
val user1 = auth._1
val sid1 = auth._2
val tp1 = TestProbe()
val dispatcher1 = TestActorRef(DispatcherActor.props(tp1.ref))
dispatcher1 ! Presence("rid_test2", sid1)
tp1.expectMsgType[Notification.Presence]
}
Then I added AtLeastOnceDelivery trait to the
DispatcherActor for messages it needs to send to other actors. Keep in mind that in my test, dispatcher1 is receiving a message, not sending one. It broke my tests.It seems to me that dispatcher1 is not ready when I fire the Presence message, since I see no logging from that actor. However if I change the code this way:
for(i <- 0 to 0){
dispatcher1 ! Presence("rid_test2", sid1)
}
or in this way
Thread.sleep(50)
dispatcher1 ! Presence("rid_test2", sid1)
Test is successful. Could you give me some advice in investigating this problem?
Thank you in advance for your precious time.
Giampaolo