Package org.axonframework.commandhandling.callbacks

Examples of org.axonframework.commandhandling.callbacks.VoidCallback


        AggregateAnnotationCommandHandler.subscribe(testSubject, commandBus);
    }

    @Test
    public void testAggregateConstructorThrowsException() {
        commandBus.dispatch(asCommandMessage(new FailingCreateCommand("id", "parameter")), new VoidCallback() {
            @Override
            protected void onSuccess() {
                fail("Expected exception");
            }
View Full Code Here


    public void testAggregateCommandHandlerThrowsException() {
        String aggregateIdentifier = "abc123";
        when(mockRepository.load(eq(aggregateIdentifier), anyLong()))
                .thenReturn(new StubCommandAnnotatedAggregate(aggregateIdentifier));
        commandBus.dispatch(asCommandMessage(new FailingUpdateCommand(aggregateIdentifier, "parameter")),
                            new VoidCallback() {
                                @Override
                                protected void onSuccess() {
                                    fail("Expected exception");
                                }
View Full Code Here

        assertTrue("Bean doesn't implement Subscribable",
                   Subscribable.class.isInstance(transactionalHandler));
        ((CommandHandler<Integer>) transactionalHandler).handle(GenericCommandMessage.asCommandMessage(12), null);
        assertEquals(2, transactionalHandler.getInvocations());

        commandBus.dispatch(GenericCommandMessage.asCommandMessage(new Object()), new VoidCallback() {
            @Override
            protected void onSuccess() {
                fail("Expected a security exception");
            }
View Full Code Here

    }

    private static void readAndSendMessages() throws Exception {
        String messageBase = UUID.randomUUID().toString();
        for (int t = 0; t < MESSAGE_COUNT; t++) {
            dcb.dispatch(new GenericCommandMessage<String>(messageBase + " #" + t), new VoidCallback() {
                @Override
                protected void onSuccess() {
                    System.out.println("Successfully receive response");
                }
View Full Code Here

                    }
                    for (int t = 0; t < COMMAND_PER_THREAD_COUNT; t++) {
                        commandBus.dispatch(asCommandMessage(new ProblematicCommand(aggregateId)),
                                SilentCallback.INSTANCE);
                        commandBus.dispatch(asCommandMessage(new UpdateStubAggregateCommand(aggregateId)),
                                new VoidCallback() {
                                    @Override
                                    protected void onSuccess() {
                                        successCounter.incrementAndGet();
                                    }

                                    @Override
                                    public void onFailure(Throwable cause) {
                                        failCounter.incrementAndGet();
                                    }
                                });
                    }
                    cdl.countDown();
                }
            });
            thread.setUncaughtExceptionHandler(ConcurrentModificationTest_OptimisticLocking.this);
            thread.start();
        }
        starter.countDown();
        cdl.await((THREAD_COUNT * COMMAND_PER_THREAD_COUNT) / 4, TimeUnit.SECONDS);
        if (uncaughtExceptions.size() > 0) {
            System.out.println("*** Uncaught Exceptions ***");
            for (Throwable uncaught : uncaughtExceptions) {
                uncaught.printStackTrace();
            }
        }
        assertEquals("Got exceptions", 0, uncaughtExceptions.size());
        assertEquals(successCounter.get() + 1, registeringEventHandler.getCapturedEvents().size());
        assertEquals(THREAD_COUNT * COMMAND_PER_THREAD_COUNT, successCounter.get(), failCounter.get());

        reportOutOfSyncEvents();

        logger.info("Results: {} successful, {} failed.", successCounter.get(), failCounter.get());

        // to prove that all locks are properly cleared, this command must succeed.
        commandBus.dispatch(asCommandMessage(new UpdateStubAggregateCommand(aggregateId)), new VoidCallback() {
            @Override
            protected void onSuccess() {

            }

View Full Code Here

                                                                     new AggregateCreatedEvent(aggregateIdentifier),
                                                                     null
                )));
        reset(eventStore);

        reportErrorCallback = new VoidCallback() {
            @Override
            protected void onSuccess() {

            }
View Full Code Here

TOP

Related Classes of org.axonframework.commandhandling.callbacks.VoidCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.