@Test public void an_event_about_created_signup_triggers_signUpCreatedAdminNotificationService_with_included_signup_data() { 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); handlerToTest.receiveAsyncMessage(request); verify(mockedSignUpRequestedAdminNotificationService).notify(userMessage); }
@Override public void receiveAsyncMessage(DomainMessage request) { MessageID messageId = request.getMessageId(); LOG.debug("received domain request: {}", request); switch (messageId) { case USER_NEW_API_TOKEN_REQUESTED: handlNewAPITokenRequested(request.get(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO)); break; case USER_API_TOKEN_CHANGED: handleUserApiTokenChanged(request.get(MessageDataKeys.USER_API_TOKEN_DATA)); break; case USER_DELETED: handleUserDeleted(request.get(MessageDataKeys.USER_DELETE_DATA)); break; case USER_SIGNUP_REQUESTED: handleSignupRequested(request.get(MessageDataKeys.USER_SIGNUP_DATA)); break; case USER_BECOMES_SUPERADMIN: handleUserBecomesSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case USER_NO_LONGER_SUPERADMIN: handleUserNoLongerSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_DISABLED: handleSchedulerJobProcessingDisabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_ENABLED: handleSchedulerJobProcessingEnabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case PROJECT_DELETED: handleProjectDeleted(request.get(MessageDataKeys.PROJECT_DELETE_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_CANCELED: handleJobCanceled(request.get(MessageDataKeys.JOB_CANCEL_DATA)); break; case JOB_RESTART_CANCELED: handleRestartJobCanceled(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESTART_TRIGGERED: handleRestartJobTriggered(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESULTS_PURGED: handleJobResultsPurged(request.get(MessageDataKeys.SECHUB_UUID), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_STARTED: handleSchedulerStarted(request.get(MessageDataKeys.ENVIRONMENT_CLUSTER_MEMBER_STATUS), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; default: throw new IllegalStateException("unhandled message id:" + messageId); } }
NotificationMessageHandler implements AsynchronMessageHandler { @Override public void receiveAsyncMessage(DomainMessage request) { MessageID messageId = request.getMessageId(); LOG.debug("received domain request: {}", request); switch (messageId) { case USER_NEW_API_TOKEN_REQUESTED: handlNewAPITokenRequested(request.get(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO)); break; case USER_API_TOKEN_CHANGED: handleUserApiTokenChanged(request.get(MessageDataKeys.USER_API_TOKEN_DATA)); break; case USER_DELETED: handleUserDeleted(request.get(MessageDataKeys.USER_DELETE_DATA)); break; case USER_SIGNUP_REQUESTED: handleSignupRequested(request.get(MessageDataKeys.USER_SIGNUP_DATA)); break; case USER_BECOMES_SUPERADMIN: handleUserBecomesSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case USER_NO_LONGER_SUPERADMIN: handleUserNoLongerSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_DISABLED: handleSchedulerJobProcessingDisabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_ENABLED: handleSchedulerJobProcessingEnabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case PROJECT_DELETED: handleProjectDeleted(request.get(MessageDataKeys.PROJECT_DELETE_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_CANCELED: handleJobCanceled(request.get(MessageDataKeys.JOB_CANCEL_DATA)); break; case JOB_RESTART_CANCELED: handleRestartJobCanceled(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESTART_TRIGGERED: handleRestartJobTriggered(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESULTS_PURGED: handleJobResultsPurged(request.get(MessageDataKeys.SECHUB_UUID), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_STARTED: handleSchedulerStarted(request.get(MessageDataKeys.ENVIRONMENT_CLUSTER_MEMBER_STATUS), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; default: throw new IllegalStateException("unhandled message id:" + messageId); } } }
NotificationMessageHandler implements AsynchronMessageHandler { @Override public void receiveAsyncMessage(DomainMessage request) { MessageID messageId = request.getMessageId(); LOG.debug("received domain request: {}", request); switch (messageId) { case USER_NEW_API_TOKEN_REQUESTED: handlNewAPITokenRequested(request.get(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO)); break; case USER_API_TOKEN_CHANGED: handleUserApiTokenChanged(request.get(MessageDataKeys.USER_API_TOKEN_DATA)); break; case USER_DELETED: handleUserDeleted(request.get(MessageDataKeys.USER_DELETE_DATA)); break; case USER_SIGNUP_REQUESTED: handleSignupRequested(request.get(MessageDataKeys.USER_SIGNUP_DATA)); break; case USER_BECOMES_SUPERADMIN: handleUserBecomesSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case USER_NO_LONGER_SUPERADMIN: handleUserNoLongerSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_DISABLED: handleSchedulerJobProcessingDisabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_ENABLED: handleSchedulerJobProcessingEnabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case PROJECT_DELETED: handleProjectDeleted(request.get(MessageDataKeys.PROJECT_DELETE_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_CANCELED: handleJobCanceled(request.get(MessageDataKeys.JOB_CANCEL_DATA)); break; case JOB_RESTART_CANCELED: handleRestartJobCanceled(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESTART_TRIGGERED: handleRestartJobTriggered(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESULTS_PURGED: handleJobResultsPurged(request.get(MessageDataKeys.SECHUB_UUID), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_STARTED: handleSchedulerStarted(request.get(MessageDataKeys.ENVIRONMENT_CLUSTER_MEMBER_STATUS), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; default: throw new IllegalStateException("unhandled message id:" + messageId); } }  }
NotificationMessageHandler implements AsynchronMessageHandler { @Override public void receiveAsyncMessage(DomainMessage request) { MessageID messageId = request.getMessageId(); LOG.debug("received domain request: {}", request); switch (messageId) { case USER_NEW_API_TOKEN_REQUESTED: handlNewAPITokenRequested(request.get(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO)); break; case USER_API_TOKEN_CHANGED: handleUserApiTokenChanged(request.get(MessageDataKeys.USER_API_TOKEN_DATA)); break; case USER_DELETED: handleUserDeleted(request.get(MessageDataKeys.USER_DELETE_DATA)); break; case USER_SIGNUP_REQUESTED: handleSignupRequested(request.get(MessageDataKeys.USER_SIGNUP_DATA)); break; case USER_BECOMES_SUPERADMIN: handleUserBecomesSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case USER_NO_LONGER_SUPERADMIN: handleUserNoLongerSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_DISABLED: handleSchedulerJobProcessingDisabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_ENABLED: handleSchedulerJobProcessingEnabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case PROJECT_DELETED: handleProjectDeleted(request.get(MessageDataKeys.PROJECT_DELETE_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_CANCELED: handleJobCanceled(request.get(MessageDataKeys.JOB_CANCEL_DATA)); break; case JOB_RESTART_CANCELED: handleRestartJobCanceled(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESTART_TRIGGERED: handleRestartJobTriggered(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESULTS_PURGED: handleJobResultsPurged(request.get(MessageDataKeys.SECHUB_UUID), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_STARTED: handleSchedulerStarted(request.get(MessageDataKeys.ENVIRONMENT_CLUSTER_MEMBER_STATUS), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; default: throw new IllegalStateException("unhandled message id:" + messageId); } }  @Override void receiveAsyncMessage(DomainMessage request); }
NotificationMessageHandler implements AsynchronMessageHandler { @Override public void receiveAsyncMessage(DomainMessage request) { MessageID messageId = request.getMessageId(); LOG.debug("received domain request: {}", request); switch (messageId) { case USER_NEW_API_TOKEN_REQUESTED: handlNewAPITokenRequested(request.get(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO)); break; case USER_API_TOKEN_CHANGED: handleUserApiTokenChanged(request.get(MessageDataKeys.USER_API_TOKEN_DATA)); break; case USER_DELETED: handleUserDeleted(request.get(MessageDataKeys.USER_DELETE_DATA)); break; case USER_SIGNUP_REQUESTED: handleSignupRequested(request.get(MessageDataKeys.USER_SIGNUP_DATA)); break; case USER_BECOMES_SUPERADMIN: handleUserBecomesSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case USER_NO_LONGER_SUPERADMIN: handleUserNoLongerSuperAdmin(request.get(MessageDataKeys.USER_CONTACT_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_DISABLED: handleSchedulerJobProcessingDisabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_JOB_PROCESSING_ENABLED: handleSchedulerJobProcessingEnabled(request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case PROJECT_DELETED: handleProjectDeleted(request.get(MessageDataKeys.PROJECT_DELETE_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_CANCELED: handleJobCanceled(request.get(MessageDataKeys.JOB_CANCEL_DATA)); break; case JOB_RESTART_CANCELED: handleRestartJobCanceled(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESTART_TRIGGERED: handleRestartJobTriggered(request.get(MessageDataKeys.JOB_RESTART_DATA), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case JOB_RESULTS_PURGED: handleJobResultsPurged(request.get(MessageDataKeys.SECHUB_UUID), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; case SCHEDULER_STARTED: handleSchedulerStarted(request.get(MessageDataKeys.ENVIRONMENT_CLUSTER_MEMBER_STATUS), request.get(MessageDataKeys.ENVIRONMENT_BASE_URL)); break; default: throw new IllegalStateException("unhandled message id:" + messageId); } }  @Override void receiveAsyncMessage(DomainMessage request);  }