The Artima Developer Community
Sponsored Link

Akka Concurrency Forum
Problem testing dead pilot

4 replies on 1 page. Most recent reply: May 10, 2015 1:01 PM by Derek Wyatt

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Tris Nefzger

Posts: 6
Nickname: alacer
Registered: Dec, 2014

Problem testing dead pilot Posted: May 5, 2015 5:47 AM
Reply to this message Reply
Advertisement
As indicated in chapter 8, I configured the Pilot and CoPilot constructors with different number of parameters so the Pilot constructor takes 4 ActorRefs while the CoPilot's takes 3. The problem is that when testing the framework tries to instantiate the CoPilot as a Pilot which fails on an IllegalArgumentException. I thought it was an eclipse IDE issue but the same thing happens when using sbt and it continues to occur even after breaking Pilot and CoPilot out into separate files. Here is the error message:

[akka://PilotsSpec/user/TestPilots/Mary] no matching constructor found on class airway.Pilot for arguments []

I know that refers to the CoPilot because her name is defined as Mary in PilotsSpec.

In pilotsReadyToGo()=>childStarter() the CoPilot test actor is initialized with:

context.actorOf(Props(new CoPilot(testActor, nilActor, nilActor)), copilotName)

Which exactly agrees with the CoPilot's contstructor.

How can the test framework be instructed to initialize the CoPilot instance with the CoPilot's constructor instead of the Pilot's?

Thanks!


Derek Wyatt

Posts: 69
Nickname: dwyatt
Registered: Oct, 2012

Re: Problem testing dead pilot Posted: May 5, 2015 5:55 AM
Reply to this message Reply
I'm not entirely sure I understand the problem. Have you got some code you can show me? Throw up a gist on github, maybe?

Tris Nefzger

Posts: 6
Nickname: alacer
Registered: Dec, 2014

Re: Problem testing dead pilot Posted: May 9, 2015 2:16 PM
Reply to this message Reply
Thank you for getting back to me.

My version of the avionics project through PilotsSpec in chapter 8 is at https://github.com/zalacer/projects-tn/tree/master/Airway -- I am calling it Airway for short with all code in package airway. I repeated the PilotsSpec test today and got the same error which is "[akka://PilotsSpec/user/TestPilots/Mary] no matching constructor found on class airway.Pilot for arguments []". This is odd because Mary is the coPilot in the test. It is probably due to a trivial mistake somewhere or maybe a glitch in a library.

I think Akka Concurrency is a great book about a complex subject written in an innovative style and beyond my expectations. Certainly it is much more readable than most of the Akka reference documentation and gives good big-picture views along with useful details and flavors of the design process with Akka.

Tris Nefzger

Posts: 6
Nickname: alacer
Registered: Dec, 2014

Re: Problem testing dead pilot Posted: May 9, 2015 5:40 PM
Reply to this message Reply
I have been using the 3.0.0-SNAP4 version of scalatest_2.11, mistakenly thinking it was the most recent stable release. After upgrading to 2.2.4, which is actually the latest release, PilotsSpec runs fine with "All tests passed" using the Scala IDE for Eclipse 4.0.0.v_11-201501121809-027320c with a Scala 2.11.6 library container including all jars in the distro, Java 1.8.0_31 at 1.7 compliance, and the full Akka 2.11-2.3.10 distro. It also worked in the IDE with Java at 1.8 compliance. However, the upgrade to scalatest_2.11-2.2.4 did not enable PilotsSpec to work in sbt even after a full rebuild of the project. Never mind that, it appears the issue is related to a bug in scalatest_2.11-3.0.0-SNAP4.

The reason for investigating scalatest is that its MustMatchers was showing up as deprecated. Investigating alternatives I found no documentation 2.11-3.0.0-SNAP4 was available and the latest was for 2.11-2.2.4. Then looking in http://mvnrepository.com I found the latter was actually more recent than the former which appears to have been discontinued making its use ill-advised.

Derek Wyatt

Posts: 69
Nickname: dwyatt
Registered: Oct, 2012

Re: Problem testing dead pilot Posted: May 10, 2015 1:01 PM
Reply to this message Reply
Sounds like you're now good to go.

It's always good to try SNAPSHOT / BETA / RELEASE_CANDIDATE builds, but it's never a good idea to trust them :)

All the best,
Derek

Flat View: This topic has 4 replies on 1 page
Topic: FSM's onTransition, transform and using Previous Topic   Next Topic Topic: Deprecated actorFor?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use