@Test public void testNotAbstractChannelEvent() throws Exception { AuditAccessor auditAccessor = Mockito.mock(AuditAccessor.class); JmsTemplate jmsTemplate = Mockito.mock(JmsTemplate.class); ContentConverter contentConverter = Mockito.mock(ContentConverter.class); Mockito.doNothing().when(jmsTemplate).convertAndSend(Mockito.anyString(), Mockito.any(Object.class)); ChannelEventManager eventManager = new ChannelEventManager(contentConverter, jmsTemplate, auditAccessor); LinkableItem subTopic = new LinkableItem("subTopic", "sub topic", null); ProviderMessageContent content = new ProviderMessageContent.Builder() .applyProvider("testProvider", 1L, "testProviderConfig") .applyTopic("testTopic", "topic") .applySubTopic(subTopic.getName(), subTopic.getValue()) .build(); AlertEvent dbStoreEvent = new ContentEvent("", RestConstants.formatDate(new Date()), 1L, "FORMAT", MessageContentGroup.singleton(content)); eventManager.sendEvent(dbStoreEvent); }
@Override @Transactional public void sendEvent(AlertEvent alertEvent) { if (alertEvent instanceof DistributionEvent) { String destination = alertEvent.getDestination(); DistributionEvent distributionEvent = (DistributionEvent) alertEvent; UUID jobId = UUID.fromString(distributionEvent.getConfigId()); Map<Long, Long> notificationIdToAuditId = auditAccessor.createAuditEntry(distributionEvent.getNotificationIdToAuditId(), jobId, distributionEvent.getContent()); distributionEvent.setNotificationIdToAuditId(notificationIdToAuditId); String jsonMessage = getContentConverter().getJsonString(distributionEvent); getJmsTemplate().convertAndSend(destination, jsonMessage); } }
ChannelEventManager extends EventManager { @Override @Transactional public void sendEvent(AlertEvent alertEvent) { if (alertEvent instanceof DistributionEvent) { String destination = alertEvent.getDestination(); DistributionEvent distributionEvent = (DistributionEvent) alertEvent; UUID jobId = UUID.fromString(distributionEvent.getConfigId()); Map<Long, Long> notificationIdToAuditId = auditAccessor.createAuditEntry(distributionEvent.getNotificationIdToAuditId(), jobId, distributionEvent.getContent()); distributionEvent.setNotificationIdToAuditId(notificationIdToAuditId); String jsonMessage = getContentConverter().getJsonString(distributionEvent); getJmsTemplate().convertAndSend(destination, jsonMessage); } } }
ChannelEventManager extends EventManager { @Override @Transactional public void sendEvent(AlertEvent alertEvent) { if (alertEvent instanceof DistributionEvent) { String destination = alertEvent.getDestination(); DistributionEvent distributionEvent = (DistributionEvent) alertEvent; UUID jobId = UUID.fromString(distributionEvent.getConfigId()); Map<Long, Long> notificationIdToAuditId = auditAccessor.createAuditEntry(distributionEvent.getNotificationIdToAuditId(), jobId, distributionEvent.getContent()); distributionEvent.setNotificationIdToAuditId(notificationIdToAuditId); String jsonMessage = getContentConverter().getJsonString(distributionEvent); getJmsTemplate().convertAndSend(destination, jsonMessage); } } @Autowired  ChannelEventManager(ContentConverter contentConverter, JmsTemplate jmsTemplate, AuditAccessor auditAccessor); }
ChannelEventManager extends EventManager { @Override @Transactional public void sendEvent(AlertEvent alertEvent) { if (alertEvent instanceof DistributionEvent) { String destination = alertEvent.getDestination(); DistributionEvent distributionEvent = (DistributionEvent) alertEvent; UUID jobId = UUID.fromString(distributionEvent.getConfigId()); Map<Long, Long> notificationIdToAuditId = auditAccessor.createAuditEntry(distributionEvent.getNotificationIdToAuditId(), jobId, distributionEvent.getContent()); distributionEvent.setNotificationIdToAuditId(notificationIdToAuditId); String jsonMessage = getContentConverter().getJsonString(distributionEvent); getJmsTemplate().convertAndSend(destination, jsonMessage); } } @Autowired  ChannelEventManager(ContentConverter contentConverter, JmsTemplate jmsTemplate, AuditAccessor auditAccessor); @Override @Transactional void sendEvent(AlertEvent alertEvent); }
ChannelEventManager extends EventManager { @Override @Transactional public void sendEvent(AlertEvent alertEvent) { if (alertEvent instanceof DistributionEvent) { String destination = alertEvent.getDestination(); DistributionEvent distributionEvent = (DistributionEvent) alertEvent; UUID jobId = UUID.fromString(distributionEvent.getConfigId()); Map<Long, Long> notificationIdToAuditId = auditAccessor.createAuditEntry(distributionEvent.getNotificationIdToAuditId(), jobId, distributionEvent.getContent()); distributionEvent.setNotificationIdToAuditId(notificationIdToAuditId); String jsonMessage = getContentConverter().getJsonString(distributionEvent); getJmsTemplate().convertAndSend(destination, jsonMessage); } } @Autowired  ChannelEventManager(ContentConverter contentConverter, JmsTemplate jmsTemplate, AuditAccessor auditAccessor); @Override @Transactional void sendEvent(AlertEvent alertEvent);  }