Examples of ChangeContactNameCommand


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

        // beware, we cannot support other updates since that would always give an error when the name is not changed
        if (contactHasErrors(contact, bindingResult)) {
            return "contacts/edit";
        }

        ChangeContactNameCommand command = new ChangeContactNameCommand();
        command.setContactNewName(contact.getName());
        command.setContactId(contact.getIdentifier());

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

        return "contacts/edit";
View Full Code Here

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

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

        ChangeContactNameCommand command = new ChangeContactNameCommand();
        command.setContactNewName(contact.getName());
        command.setContactId(contact.getIdentifier());

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

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

        verify(mockContactNameRepository).cancelContactName("Good name");
    }

    @Test
    public void testHandleChangeNameContactCommand_doubleName() {
        ChangeContactNameCommand command = new ChangeContactNameCommand();
        command.setContactId(UUID.randomUUID().toString());
        command.setContactNewName("Double New Name");

        Contact contact = mock(Contact.class);

        when(mockContactNameRepository.claimContactName("Double New Name")).thenReturn(false);
View Full Code Here

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

        verify(contact, never()).changeName("Double New Name");
    }

    @Test
    public void testHandleChangeNameContactCommand_happypath() {
        ChangeContactNameCommand command = new ChangeContactNameCommand();
        command.setContactId(UUID.randomUUID().toString());
        command.setContactNewName("Good New Name");

        ContactEntry mockContactEntry = mock(ContactEntry.class);

        when(mockContactNameRepository.claimContactName("Good New Name"))
                .thenReturn(true);
        when(mockRepository.load(isA(String.class)))
                .thenReturn(mockContact);
        when(mockContactRepository.loadContactDetails(command.getContactId()))
                .thenReturn(mockContactEntry);
        when(mockContactEntry.getName()).thenReturn("Good Old Name");

        ArgumentCaptor<UnitOfWorkListener> unitOfWorkListenerArgumentCaptor =
                ArgumentCaptor.forClass(UnitOfWorkListener.class);
View Full Code Here

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

        verify(mockContactNameRepository).cancelContactName("Good Old Name");
    }

    @Test
    public void testHandleChangeNameContactCommand_otherProblemWithTransaction() throws Exception {
        ChangeContactNameCommand command = new ChangeContactNameCommand();
        command.setContactId(UUID.randomUUID().toString());
        command.setContactNewName("Good New Name");

        when(mockContactNameRepository.claimContactName("Good New Name")).thenReturn(true);
        when(mockRepository.load(isA(String.class))).thenReturn(mockContact);

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

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

            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());
            changeCommand.setContactId(contact.getIdentifier());
            command = changeCommand;
            message = "Changed name of contact into " + contact.getName();
        }
        commandBus.dispatch(new GenericCommandMessage<Object>(command));
        fireEvent(new FormIsSuccessfullyCommittedEvent(this));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.