Renamed ActiveObject factory object to TypedActor. Improved network protocol for TypedActor. Remote TypedActors now identified by UUID.
35 lines
1.2 KiB
Java
35 lines
1.2 KiB
Java
package se.scalablesolutions.akka.api;
|
|
|
|
import static se.scalablesolutions.akka.actor.TypedActor.link;
|
|
import static se.scalablesolutions.akka.actor.TypedActor.newInstance;
|
|
|
|
import org.junit.Assert;
|
|
import org.junit.Test;
|
|
|
|
import se.scalablesolutions.akka.config.OneForOneStrategy;
|
|
import junit.framework.TestCase;
|
|
|
|
/**
|
|
* <p>Small misc tests that do not fit anywhere else and does not require a separate testcase</p>
|
|
*
|
|
* @author johanrask
|
|
*
|
|
*/
|
|
public class MiscTypedActorTest extends TestCase {
|
|
|
|
|
|
/**
|
|
* Verifies that both preRestart and postRestart methods are invoked when
|
|
* an actor is restarted
|
|
*/
|
|
public void testFailingPostRestartInvocation() throws InterruptedException {
|
|
SimpleJavaPojo pojo = newInstance(SimpleJavaPojo.class,500);
|
|
SimpleJavaPojo supervisor = newInstance(SimpleJavaPojo.class,500);
|
|
link(supervisor,pojo,new OneForOneStrategy(3, 2000),new Class[]{Throwable.class});
|
|
pojo.throwException();
|
|
Thread.sleep(500);
|
|
Assert.assertTrue(pojo.pre);
|
|
Assert.assertTrue(pojo.post);
|
|
}
|
|
|
|
}
|