@Test public void test_should_update_messages() { final Tenant tenant = new Tenant(TENANT_ID); final String module = "module"; final AuthenticatedUser user = new AuthenticatedUser(1L); final MessageIdentity messageIdentity1 = MessageIdentity.builder() .code("core.msg.OTPvalidated") .locale(MR_IN) .module(module) .tenant(tenant) .build(); Message message1 = Message.builder() .messageIdentity(messageIdentity1) .message("OTP यशस्वीपणे प्रमाणित") .build(); final MessageIdentity messageIdentity2 = MessageIdentity.builder() .code("core.lbl.imageupload") .locale(MR_IN) .module(module) .tenant(tenant) .build(); Message message2 = Message.builder() .messageIdentity(messageIdentity2) .message("प्रतिमा यशस्वीरित्या अपलोड") .build(); List<Message> modelMessages = Arrays.asList(message1, message2); messageService.updateMessagesForModule(tenant, modelMessages, user); verify(messageRepository).update(TENANT_ID, MR_IN, module, modelMessages, user); }
public void updateMessagesForModule(Tenant tenant, List<Message> messages, AuthenticatedUser user) { if (CollectionUtils.isEmpty(messages)) { throw new IllegalArgumentException("update message list cannot be empty"); } final Message message = messages.get(0); messageRepository.update(message.getTenant(), message.getLocale(), message.getModule(), messages, user); bustCacheEntriesForMessages(tenant, messages); }
MessageService { public void updateMessagesForModule(Tenant tenant, List<Message> messages, AuthenticatedUser user) { if (CollectionUtils.isEmpty(messages)) { throw new IllegalArgumentException("update message list cannot be empty"); } final Message message = messages.get(0); messageRepository.update(message.getTenant(), message.getLocale(), message.getModule(), messages, user); bustCacheEntriesForMessages(tenant, messages); } }
MessageService { public void updateMessagesForModule(Tenant tenant, List<Message> messages, AuthenticatedUser user) { if (CollectionUtils.isEmpty(messages)) { throw new IllegalArgumentException("update message list cannot be empty"); } final Message message = messages.get(0); messageRepository.update(message.getTenant(), message.getLocale(), message.getModule(), messages, user); bustCacheEntriesForMessages(tenant, messages); } MessageService(MessageRepository messageRepository, MessageCacheRepository messageCacheRepository); }
MessageService { public void updateMessagesForModule(Tenant tenant, List<Message> messages, AuthenticatedUser user) { if (CollectionUtils.isEmpty(messages)) { throw new IllegalArgumentException("update message list cannot be empty"); } final Message message = messages.get(0); messageRepository.update(message.getTenant(), message.getLocale(), message.getModule(), messages, user); bustCacheEntriesForMessages(tenant, messages); } MessageService(MessageRepository messageRepository, MessageCacheRepository messageCacheRepository); void upsert(Tenant tenant, List<Message> messages, AuthenticatedUser user); void create(Tenant tenant, List<Message> messages, AuthenticatedUser user); void updateMessagesForModule(Tenant tenant, List<Message> messages, AuthenticatedUser user); void bustCache(); List<Message> getFilteredMessages(MessageSearchCriteria searchCriteria); void delete(List<MessageIdentity> messageIdentities); }
MessageService { public void updateMessagesForModule(Tenant tenant, List<Message> messages, AuthenticatedUser user) { if (CollectionUtils.isEmpty(messages)) { throw new IllegalArgumentException("update message list cannot be empty"); } final Message message = messages.get(0); messageRepository.update(message.getTenant(), message.getLocale(), message.getModule(), messages, user); bustCacheEntriesForMessages(tenant, messages); } MessageService(MessageRepository messageRepository, MessageCacheRepository messageCacheRepository); void upsert(Tenant tenant, List<Message> messages, AuthenticatedUser user); void create(Tenant tenant, List<Message> messages, AuthenticatedUser user); void updateMessagesForModule(Tenant tenant, List<Message> messages, AuthenticatedUser user); void bustCache(); List<Message> getFilteredMessages(MessageSearchCriteria searchCriteria); void delete(List<MessageIdentity> messageIdentities);  }