@Test public void testOnMessage() throws JMSException { String personDomain = "person"; String syncDomain = "syncStatus"; Map message = ImmutableMap .builder() .put("patientIds", this.getPatientIds().toMap()) .build(); Session mockSession = Mockito.mock(Session.class); Message mockMessage = Mockito.mock(Message.class); when(mockVlerService.fetchVlerData((PatientIds)anyObject())).thenReturn(this.getChunks(this.getPatientIds().getUid(), personDomain)); when(converter.fromMessage(mockMessage)).thenReturn(message); when(metrics.timer(anyString())).thenReturn(new Timer()); when(syncStatusDao.findOneByPid(anyString())).thenReturn(SYNCSTATUS_WITH_VLERSITE); when(syncStatusDao.saveMergeSyncStatus(any(SyncStatus.class), (HashSet<String>)anyObject())).thenReturn(new SyncStatus()); handler.onMessage(mockMessage, mockSession); ArgumentCaptor<VistaDataChunk> vistaDataChunkArgumentCaptor = ArgumentCaptor.forClass(VistaDataChunk.class); verify(syncService, times(2)).sendImportVistaDataExtractItemMsg(vistaDataChunkArgumentCaptor.capture()); List<VistaDataChunk> chunks = vistaDataChunkArgumentCaptor.getAllValues(); boolean bFoundPerson = false; boolean bFoundSyncStatus = false; for (VistaDataChunk chunk : chunks) { if (personDomain.equals(chunk.getDomain())) { bFoundPerson = true; } else if (syncDomain.equals(chunk.getDomain())) { bFoundSyncStatus = true; } } assertEquals(bFoundPerson, true); assertEquals(bFoundSyncStatus, true); }
@Override public void onMessage(Message message, Session session) throws JMSException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SyncVlerMessageHandler.onMessage(). Entering method..."); } super.onMessage(message, session); }
SyncVlerMessageHandler extends SecondarySiteSyncMessageHandler { @Override public void onMessage(Message message, Session session) throws JMSException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SyncVlerMessageHandler.onMessage(). Entering method..."); } super.onMessage(message, session); } }
SyncVlerMessageHandler extends SecondarySiteSyncMessageHandler { @Override public void onMessage(Message message, Session session) throws JMSException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SyncVlerMessageHandler.onMessage(). Entering method..."); } super.onMessage(message, session); }  }
SyncVlerMessageHandler extends SecondarySiteSyncMessageHandler { @Override public void onMessage(Message message, Session session) throws JMSException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SyncVlerMessageHandler.onMessage(). Entering method..."); } super.onMessage(message, session); }  @Autowired void setVlerService(IVlerService vlerService); @Override void onMessage(Message message, Session session); }
SyncVlerMessageHandler extends SecondarySiteSyncMessageHandler { @Override public void onMessage(Message message, Session session) throws JMSException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SyncVlerMessageHandler.onMessage(). Entering method..."); } super.onMessage(message, session); }  @Autowired void setVlerService(IVlerService vlerService); @Override void onMessage(Message message, Session session); final static String SITE_ID; static final String TIMER_NAME; }