That is a good point. about unit testing the file handling part without 
running in it in actors.

On Friday, February 13, 2015 at 6:00:26 AM UTC-6, Patrik Nordwall wrote:
>
> You can probably get some ideas from 
>
> http://doc.akka.io/docs/akka/2.3.9/scala/testing.html
> or
> http://doc.akka.io/docs/akka/2.3.9/java/testing.html
>
> I would probably unit test the file handling part without running it in 
> actors, and that might influence how you design it.
>
> Regards,
> Patrik
>
> On Fri, Feb 6, 2015 at 2:14 AM, Marco Polo <[email protected] 
> <javascript:>> wrote:
>
>> I am a relative newbie to testing Akka actors.
>>
>> What I am trying to accomplish is: How do I unit test the following Actor 
>> whose description I have laid out below:
>>
>> *Description:*
>> I am trying to test an Actor class that is peering into a directory, and 
>> inspecting the files inside of it. This action of the actor, I call it, a 
>> "task".
>> The class extends an Actor with a FileActionable trait
>> This class field variables a follows:
>> 1) A val "taskID"
>> 2)  An ActorRef 
>> 3)  an anonmymous function that takes takes into in a parameter - a val 
>> of type FileMetaDataInfo, and returns a 
>> Future[MetaDataAssociatedWithActionsTakenOnFile] which is stored in a val 
>> that I call: postActionsTakenOnFileFunction
>>
>> Note: MetaDataAssociatedWithActionsTakenOnFile is a case class and 
>> represents a few things like, when the file was last worked on, what is the 
>> file path,
>> a flag to indicate something was detected in the file, no of characters 
>> in the file, etc]
>>
>>
>> There are methods in the class as follows:
>>
>> def postActionsTakenOnFile(<<a file>>, <<report>>) = 
>> postActionsTakenOnFileFunction
>>
>> def initializeActionsTakenOnFile(filesList:List[FileMetaDataInfo ) : 
>> Option[Int] = { some code, that basically checks the  List.headOption to 
>> explicitly handle the case of an empty list, does some logic that basically 
>> decides if the Actor how it would decide to exercise actions on the files 
>> based on some prior load metric or something.
>>
>> [Note: filesList represents a List of case class entities representing 
>> metadata like file path, when the file was last modified, the length of the 
>> file>>
>>
>> Then of course, we have a receive method that basically goes through some 
>> cases and has a case message to log an error reporting something it cant 
>> handle..
>>
>> -----------------------------------------
>> I would like to know what testcases I can possibly write and how a test 
>> case or case code will look. I am studying up on the ScalaTest site and 
>> also the Akka documentation on testing actors.* I would like to write 
>> testcases using ScalaTest.*
>> Any pointers are appreciated. Thanks in advance.
>>
>>
>>
>>  -- 
>> >>>>>>>>>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
>
> [image: Scala Days] <http://event.scaladays.org/scaladays-sanfran-2015>
>
>  

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
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