use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class AuthMessageHandler method handleUserRolesChanged.
@IsReceivingAsyncMessage(MessageID.USER_ROLES_CHANGED)
private void handleUserRolesChanged(DomainMessage request) {
UserMessage userMessage = request.get(MessageDataKeys.USER_ROLES_DATA);
userAuthUpdateRolesService.updateRoles(userMessage.getUserId(), userMessage.getRoles());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class AuthMessageHandler method handleUserDeleted.
@IsReceivingAsyncMessage(MessageID.USER_DELETED)
private void handleUserDeleted(DomainMessage request) {
UserMessage userMessage = request.get(MessageDataKeys.USER_DELETE_DATA);
userAuthDeleteService.deleteUser(userMessage.getUserId());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class UserEmailAddressUpdateServiceTest method sends_event_with_user_data_when_parameters_are_valid.
@Test
void sends_event_with_user_data_when_parameters_are_valid() {
/* prepare */
User knownUser1 = createKnownUser1();
when(userRepository.findOrFailUser(KNOWN_USER1)).thenReturn(knownUser1);
/* execute */
serviceToTest.updateUserEmailAddress(KNOWN_USER1, "new.user1@example.com");
/* test */
// check event is sent with expected data
ArgumentCaptor<DomainMessage> messageCaptor = ArgumentCaptor.forClass(DomainMessage.class);
verify(eventBusService).sendAsynchron(messageCaptor.capture());
UserMessage userMessage = messageCaptor.getValue().get(MessageDataKeys.USER_EMAIL_ADDRESS_CHANGE_DATA);
assertNotNull(userMessage);
assertEquals(KNOWN_USER1, userMessage.getUserId());
assertEquals("new.user1@example.com", userMessage.getEmailAdress());
assertEquals("former.user1@example.com", userMessage.getFormerEmailAddress());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class NotificationMessageHandlerTest method an_event_about_deleted_user_triggers_UserDeletedNotificationService.
@Test
public void an_event_about_deleted_user_triggers_UserDeletedNotificationService() {
/* prepare */
UserMessage userMessage = mock(UserMessage.class);
DomainMessage request = mock(DomainMessage.class);
when(request.getMessageId()).thenReturn(MessageID.USER_DELETED);
when(request.get(MessageDataKeys.USER_DELETE_DATA)).thenReturn(userMessage);
/* execute */
handlerToTest.receiveAsyncMessage(request);
/* test */
verify(mockedUserDeletedNotificationService).notify(userMessage);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage in project sechub by mercedes-benz.
the class NotificationMessageHandlerTest method an_event_about_created_signup_triggers_signUpCreatedAdminNotificationService_with_included_signup_data.
@Test
public void an_event_about_created_signup_triggers_signUpCreatedAdminNotificationService_with_included_signup_data() {
/* prepare */
UserMessage userMessage = mock(UserMessage.class);
DomainMessage request = mock(DomainMessage.class);
when(request.getMessageId()).thenReturn(MessageID.USER_SIGNUP_REQUESTED);
when(request.get(MessageDataKeys.USER_SIGNUP_DATA)).thenReturn(userMessage);
/* execute */
handlerToTest.receiveAsyncMessage(request);
/* test */
verify(mockedSignUpRequestedAdminNotificationService).notify(userMessage);
}
Aggregations