Ejemplo n.º 1
0
 @Before
 public void setUp() throws Exception {
   fixture = Fixtures.newGivenWhenThenFixture(Author.class);
   AuthorCommandHandler handler = new AuthorCommandHandler(fixture.getRepository());
   fixture.registerAnnotatedCommandHandler(handler);
   authorId = IdentifierFactory.getInstance().generateIdentifier();
 }
 @Override
 public ScheduleToken schedule(Duration triggerDuration, Object event) {
   String tokenId = IdentifierFactory.getInstance().generateIdentifier();
   ScheduledFuture<?> future =
       executorService.schedule(
           new PublishEventTask(event, tokenId),
           triggerDuration.getMillis(),
           TimeUnit.MILLISECONDS);
   tokens.put(tokenId, future);
   return new SimpleScheduleToken(tokenId);
 }
 public SimpleAnnotatedAggregate() {
   // don't ever do this in production code!!
   identifier = IdentifierFactory.getInstance().generateIdentifier();
 }
 @CommandHandler
 public SimpleAnnotatedAggregate(CreateSimpleAggregateCommand command) {
   identifier = IdentifierFactory.getInstance().generateIdentifier();
 }