-
-
Save gbeaty/8194a40706355e7013ef to your computer and use it in GitHub Desktop.
Trying to reproduce null entity var issue.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.fwbrasil.activate.ActivateContext | |
import net.fwbrasil.activate.storage.memory.TransientMemoryStorage | |
import net.fwbrasil.activate.entity.Entity | |
import org.specs2.mutable._ | |
import akka.util._ | |
import akka.actor._ | |
object Context extends ActivateContext { | |
lazy val storage = new TransientMemoryStorage | |
val system = ActorSystem("EntityInitTests") | |
} | |
import Context._ | |
class Tester(a: A) extends Actor { | |
def receive = { | |
case 0 => assert(a.uuids != null) | |
} | |
} | |
class A extends Entity { | |
var uuids = for(i <- 1 to 100) yield java.util.UUID.randomUUID.toString | |
def tester = system.actorOf(Props(new Tester(this))) | |
} | |
class EntityInitTests extends Specification { | |
"Entities" should { | |
"Initialize" in { | |
transactional { | |
val as = for(i <- 1 to 10) yield i | |
as.par.foreach { _ => | |
val a = new A | |
a.tester ! 0 | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment