Package org.axonframework.sample.app.api

Examples of org.axonframework.sample.app.api.CreateContactCommand


    public String formNewSubmit(@ModelAttribute("contact") @Valid ContactEntry contact, BindingResult bindingResult) {
        if (contactHasErrors(contact, bindingResult)) {
            return "contacts/new";
        }

        CreateContactCommand command = new CreateContactCommand();
        command.setNewContactName(contact.getName());

        commandBus.dispatch(new GenericCommandMessage<Object>(command));

        return "redirect:/contacts";
    }
View Full Code Here


     */
    @RequestMapping(method = RequestMethod.POST)
    public void create(@RequestBody @Valid ContactEntry contact) throws ContactNameAlreadyTakenException {
        contactHasErrors(contact);

        CreateContactCommand command = new CreateContactCommand();
        command.setNewContactName(contact.getName());

        commandBus.dispatch(new GenericCommandMessage<Object>(command));
    }
View Full Code Here

        contactCommandHandler.setContactRepository(mockContactRepository);
    }

    @Test
    public void testHandleCreateContactCommand_doubleName() throws Exception {
        CreateContactCommand command = new CreateContactCommand();
        command.setContactId(UUID.randomUUID().toString());
        command.setNewContactName("Double name");

        when(mockContactNameRepository.claimContactName("Double name")).thenReturn(false);

        try {
            contactCommandHandler.handle(command, mockUnitOfWork);
View Full Code Here

        verify(mockContactNameRepository).claimContactName("Double name");
    }

    @Test
    public void testHandleCreateContactCommand_otherProblemWithTransaction() throws Exception {
        CreateContactCommand command = new CreateContactCommand();
        command.setContactId(UUID.randomUUID().toString());
        command.setNewContactName("Good name");

        when(mockContactNameRepository.claimContactName("Good name")).thenReturn(true);

        contactCommandHandler.handle(command, mockUnitOfWork);
View Full Code Here

        }
    }

    public void initializeData() {
        if (initialized.compareAndSet(false, true)) {
            CreateContactCommand commandAllard = new CreateContactCommand();
            commandAllard.setNewContactName("Allard");
            String uuidAllard = UUID.randomUUID().toString();
            commandAllard.setContactId(uuidAllard);
            commandBus.dispatch(new GenericCommandMessage<Object>(commandAllard));

            CreateContactCommand commandJettro = new CreateContactCommand();
            commandJettro.setNewContactName("Jettro");
            String uuidJettro = UUID.randomUUID().toString();
            commandJettro.setContactId(uuidJettro);
            commandBus.dispatch(new GenericCommandMessage<Object>(commandJettro));

            RegisterAddressCommand registerPrivateAddressCommand = new RegisterAddressCommand();
            registerPrivateAddressCommand.setAddressType(AddressType.PRIVATE);
            registerPrivateAddressCommand.setCity("The Hague");
View Full Code Here

        AbstractOrderCommand command;
        ContactFormBean contact = obtainContactFormBeanFromDatasource();

        if (newContactMode) {
            newContactMode = false;
            CreateContactCommand createCommand = new CreateContactCommand();
            createCommand.setNewContactName(contact.getName());
            command = createCommand;
            message = "Created new contact with name " + contact.getName();
        } else {
            ChangeContactNameCommand changeCommand = new ChangeContactNameCommand();
            changeCommand.setContactNewName(contact.getName());
View Full Code Here

TOP

Related Classes of org.axonframework.sample.app.api.CreateContactCommand

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.