public void testExecuteWhenMessage() throws Exception { System.out.println("testExecuteMessage()"); ActorAgent agent = actorRegistry.actorFor(TestAggregateActor.class); assertNotNull(agent); agent.tell(new TestMessage()); this.stayAlive(200); }
public void testExecuteEvent() throws Exception { System.out.println("testExecuteEvent()"); ActorAgent agent = actorRegistry.actorFor(TestActor.class); assertNotNull(agent); agent.tell(new TestEvent()); this.stayAlive(200); }
public void testExecuteMessage() throws Exception { System.out.println("testExecuteMessage()"); ActorAgent agent = actorRegistry.actorFor(TestActor.class); assertNotNull(agent); agent.tell(new TestMessage()); this.stayAlive(200); }
public void testExecuteCommand() throws Exception { System.out.println("testExecuteCommand()"); ActorAgent agent = actorRegistry.actorFor(TestActor.class); assertNotNull(agent); agent.tell(new TestCommand()); this.stayAlive(500); }
public void testExecuteWhenCommand() throws Exception { System.out.println("testExecuteCommand()"); ActorAgent agent = actorRegistry.actorFor(TestAggregateActor.class); assertNotNull(agent); agent.tell(new TestCommand()); this.stayAlive(100); }
public void testExecuteWhenEvent() throws Exception { System.out.println("testExecuteEvent()"); ActorAgent agent = actorRegistry.actorFor(TestAggregateActor.class); assertNotNull(agent); agent.tell(new TestEvent()); this.stayAlive(200); }
public LocalMailboxFuture( ActorRegistry anActorRegistry, LocalMailboxActorAgent aReceiverActorAgent, Message aMessage, FutureInterest aFutureInterest) { super(); this.setFutureInterest(aFutureInterest); this.setReceiverAgent(aReceiverActorAgent); ActorInitializer initializer = anActorRegistry.newActorInitializer(); initializer.putParameter("future", this); initializer.putParameter("registry", anActorRegistry); ActorAgent senderAgent = anActorRegistry.actorFor(LocalMailboxFutureActor.class, initializer); this.setSenderAgent(senderAgent); aReceiverActorAgent.sendTo(senderAgent, aMessage, true); }
public void testExecuteHowManyAsksIn5Seconds() throws Exception { System.out.println("testExecuteHowManyAsksIn5Seconds()"); this.warmUp(); ActorAgent agent = actorRegistry.actorFor(TestActor.class); assertNotNull(agent); long beforeReceive = new Date().getTime(); FutureCountThread futureCountThread = new FutureCountThread(agent); futureCountThread.start(); this.stayAlive(5000L); futureCountThread.close(); this.stayAlive(1000L); long totalTime = new Date().getTime() - beforeReceive; System.out.println("Total milliseconds: " + totalTime); System.out.println("Ask count: " + futureCountThread.askCount()); System.out.println("Answer count: " + futureCountThread.answerCount()); assertEquals(futureCountThread.askCount(), futureCountThread.answerCount()); }
private void warmUp() { System.out.println("Warming up..."); ActorAgent agent = actorRegistry.actorFor(TestActor.class); FutureCountThread futureCountThread = new FutureCountThread(agent); futureCountThread.start(); this.stayAlive(5000L); futureCountThread.close(); this.stayAlive(100L); } }
public void testExecuteWhenCommandFor5Seconds() throws Exception { System.out.println("testExecuteWhenCommandFor5Seconds()"); ActorAgent agent = actorRegistry.actorFor(TestAggregateActor.class); assertNotNull(agent); RawMessageThoughputCountThread rawMessageThroughput = new RawMessageThoughputCountThread(agent); long beforeReceive = new Date().getTime(); rawMessageThroughput.start(); this.stayAlive(5000L); rawMessageThroughput.close(); this.stayAlive(200L); long totalTime = new Date().getTime() - beforeReceive; System.out.println("Total milliseconds: " + totalTime); System.out.println("Message count: " + rawMessageThroughput.messageCount() + " Average/Second: " + (rawMessageThroughput.messageCount() / (totalTime / 1000))); assertTrue(rawMessageThroughput.messageCount() >= 1000000); }
public void testExecute15Actors() throws Exception { System.out.println("testExecute15Actors()"); this.warmUp(); final int maxActors = 15; final int millis = 1000; ActorAgent[] agents = new ActorAgent[maxActors]; FutureCountThread[] threads = new FutureCountThread[maxActors]; for (int i = 0; i < maxActors; ++i) { agents[i] = actorRegistry.actorFor(TestActor.class); threads[i] = new FutureCountThread(agents[i]); } long beforeReceive = new Date().getTime(); for (int i = 0; i < maxActors; ++i) { threads[i].start(); } this.stayAlive(millis); for (int i = 0; i < maxActors; ++i) { threads[i].close(); } this.stayAlive(500L); long totalTime = new Date().getTime() - beforeReceive; for (int i = 0; i < maxActors; ++i) { askCounter += threads[i].askCount(); answerCounter += threads[i].answerCount(); } System.out.println("Total milliseconds: " + totalTime); System.out.println("Ask count: " + askCounter + " Average/Second: " + (askCounter / (totalTime / 1000))); System.out.println("Answer count: " + answerCounter + " Average/Second: " + (answerCounter / (totalTime / 1000))); }
public void testExecuteAsk() throws Exception { System.out.println("testExecuteAsk()"); ActorAgent agent = actorRegistry.actorFor(TestActor.class); assertNotNull(agent); agent.ask(new TestMessage(), new FutureInterest() { @Override public void completedWith(Future aFuture) { completed = true; System.out.println("Future completed with: " + aFuture.value()); } @Override public void timedOut(Future aFuture) { completed = false; System.out.println("Timed out"); } }); this.stayAlive(500L); assertTrue(completed); }
public void when(PlanBacklogItem aCommand) { ActorInitializer initializer = new ActorInitializer(this.registry()); initializer.putParameter("product", this.self()); initializer.putParameter("summary", aCommand.summary()); initializer.putParameter("story", aCommand.story()); this.registry().actorFor(BacklogItem.class, initializer); }
public void testProductPlanBacklogItem() throws Exception { ActorInitializer initializer = new ActorInitializer(this.actorRegistry); initializer.putParameter("name", "Test Product"); initializer.putParameter("description", "A decsription."); ActorAgent product = this.actorRegistry.actorFor(Product.class, initializer); product.tell(new PlanBacklogItem( "A summary of the backlog item.", "A story about the backlog item.")); this.stayAlive(); this.actorRegistry.expectedMessages(2); this.actorRegistry.expectedMessage(PlanBacklogItem.class); this.actorRegistry.expectedMessage(BacklogItemPlanned.class); }
public void testProductScheduleSprint() throws Exception { ActorInitializer initializer = new ActorInitializer(this.actorRegistry); initializer.putParameter("name", "Test Product"); initializer.putParameter("description", "A decsription."); ActorAgent product = this.actorRegistry.actorFor(Product.class, initializer); product.tell(new ScheduleSprint( "Sprint 1", "The initial sprint.", this.daysFromNow(1), this.daysFromNow(15))); this.stayAlive(); this.actorRegistry.expectedMessages(2); this.actorRegistry.expectedMessage(ScheduleSprint.class); this.actorRegistry.expectedMessage(SprintScheduled.class); }
public void when(ScheduleSprint aCommand) { ActorInitializer initializer = new ActorInitializer(this.registry()); initializer.putParameter("product", this.self()); initializer.putParameter("name", aCommand.name()); initializer.putParameter("goals", aCommand.goals()); initializer.putParameter("begins", aCommand.begins()); initializer.putParameter("ends", aCommand.ends()); this.registry().actorFor(Sprint.class, initializer); }
initializer.putParameter("description", "A decsription."); final ActorAgent product = this.actorRegistry.actorFor(Product.class, initializer);