@Test public void testProcessOpenSessions() { Date now = new Date(); Date oneMinuteAgo = addToDate(now, GregorianCalendar.MINUTE, -1); Date oneMinuteLessBundlingDelayAgo = addToDate(now, GregorianCalendar.MINUTE, (int)intellivrBean.getBundlingDelay()*-1); IVRCallSession session = new IVRCallSession(recipientId1, phone1, english.getName(), IVRCallSession.OUTBOUND, 0, 0, IVRCallSession.OPEN, oneMinuteLessBundlingDelayAgo, oneMinuteAgo); List<IVRCallSession> expectedDaoResponse = new ArrayList<IVRCallSession>(); expectedDaoResponse.add(session); IVRDAO mockDao = createMock(IVRDAO.class); intellivrBean.setIvrDao(mockDao); Integer[] states = { IVRCallSession.OPEN }; expect(mockDao.loadIVRCallSessionsByStateNextAttemptBeforeDate(EasyMock.aryEq(states), (Date)EasyMock.anyObject())).andReturn(expectedDaoResponse); replay(mockDao); intellivrBean.processOpenSessions(); assertEquals(IVRCallSession.SEND_WAIT, session.getState()); verify(mockDao); }
@Transactional public void processOpenSessions() { log.debug("Start processing OPEN IVRCallSessions"); Integer[] states = {IVRCallSession.OPEN}; List<IVRCallSession> sessions = ivrDao.loadIVRCallSessionsByStateNextAttemptBeforeDate(states, new Date()); for (IVRCallSession session : sessions) { log.debug("Changing to SEND_WAIT state session " + session); session.setState(IVRCallSession.SEND_WAIT); } log.debug("End processing OPEN IVRCallSessions"); }
IntellIVRBean implements GatewayManager, GetIVRConfigRequestHandler, IVRCallRequester, IVRCallSessionProcessor, IVRCallStatsProvider, ReportHandler { @Transactional public void processOpenSessions() { log.debug("Start processing OPEN IVRCallSessions"); Integer[] states = {IVRCallSession.OPEN}; List<IVRCallSession> sessions = ivrDao.loadIVRCallSessionsByStateNextAttemptBeforeDate(states, new Date()); for (IVRCallSession session : sessions) { log.debug("Changing to SEND_WAIT state session " + session); session.setState(IVRCallSession.SEND_WAIT); } log.debug("End processing OPEN IVRCallSessions"); } }
IntellIVRBean implements GatewayManager, GetIVRConfigRequestHandler, IVRCallRequester, IVRCallSessionProcessor, IVRCallStatsProvider, ReportHandler { @Transactional public void processOpenSessions() { log.debug("Start processing OPEN IVRCallSessions"); Integer[] states = {IVRCallSession.OPEN}; List<IVRCallSession> sessions = ivrDao.loadIVRCallSessionsByStateNextAttemptBeforeDate(states, new Date()); for (IVRCallSession session : sessions) { log.debug("Changing to SEND_WAIT state session " + session); session.setState(IVRCallSession.SEND_WAIT); } log.debug("End processing OPEN IVRCallSessions"); }  }
IntellIVRBean implements GatewayManager, GetIVRConfigRequestHandler, IVRCallRequester, IVRCallSessionProcessor, IVRCallStatsProvider, ReportHandler { @Transactional public void processOpenSessions() { log.debug("Start processing OPEN IVRCallSessions"); Integer[] states = {IVRCallSession.OPEN}; List<IVRCallSession> sessions = ivrDao.loadIVRCallSessionsByStateNextAttemptBeforeDate(states, new Date()); for (IVRCallSession session : sessions) { log.debug("Changing to SEND_WAIT state session " + session); session.setState(IVRCallSession.SEND_WAIT); } log.debug("End processing OPEN IVRCallSessions"); }  @Transactional void init(); void cleanUp(); String getMessageStatus(GatewayResponse response); MStatus mapMessageStatus(GatewayResponse response); @Transactional Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest); @Transactional void processOpenSessions(); @Transactional void processWaitingSessions(); @Transactional void requestCall(IVRCallSession session, String externalId); RequestType createIVRRequest(IVRCallSession session, String externalId); @Transactional ResponseType handleRequest(GetIVRConfigRequest request); @SuppressWarnings("unchecked") @Transactional ResponseType handleRequest(GetIVRConfigRequest request, String externalId); @Transactional ResponseType handleReport(ReportType report); @Transactional int getCountIVRCallSessions(); @Transactional int getCountIVRSessionsInLastMinutes(int minutes); @Transactional int getCountIVRCallSessionsInLastHours(int hours); @Transactional int getCountIVRCallSessionsInLastDays(int days); @Transactional int getCountIVRCalls(); @Transactional int getCountIVRCallsInLastMinutes(int minutes); @Transactional int getCountIVRCallsInLastHours(int hours); @Transactional int getCountIVRCallsInLastDays(int days); @Transactional int getCountIVRCallsWithStatus(IVRCallStatus status); @Transactional int getCountIVRCallsInLastMinutesWithStatus(int minutes, IVRCallStatus status); @Transactional int getCountIVRCallsInLastHoursWithStatus(int hours, IVRCallStatus status); @Transactional int getCountIVRCallsInLastDaysWithStatus(int days, IVRCallStatus status); @Transactional List<IVRRecordingStat> getIVRRecordingStats(); @Transactional List<IVRCallStatusStat> getIVRCallStatusStats(); @Transactional List<IVRCallStatusStat> getIVRCallStatusStatsFromLastMinutes(int minutes); @Transactional List<IVRCallStatusStat> getIVRCallStatusStatsFromLastHours(int hours); @Transactional List<IVRCallStatusStat> getIVRCallStatusStatsFromLastDays(int days); @Transactional List<IVRCallSession> getIVRCallSessions(); @Transactional List<IVRCallSession> getIVRCallSessionsInLastMinutes(int minutes); @Transactional List<IVRCallSession> getIVRCallSessionsInLastHours(int hours); @Transactional List<IVRCallSession> getIVRCallSessionsInLastDays(int days); @Transactional List<IVRCallSession> getIVRCallSessionsForUser(String user); @Transactional List<IVRCallSession> getIVRCallSessionsForPhone(String phone); void setMessageHandler(GatewayMessageHandler messageHandler); GatewayMessageHandler getMessageHandler(); String getReportURL(); void setReportURL(String reportURL); String getApiID(); void setApiID(String apiID); IntellIVRServer getIvrServer(); void setIvrServer(IntellIVRServer ivrServer); String getMethod(); void setMethod(String method); String getDefaultLanguage(); void setDefaultLanguage(String defaultLanguage); String getDefaultTree(); void setDefaultTree(String defaultTree); String getDefaultReminder(); void setDefaultReminder(String defaultReminder); MessageStatusStore getStatusStore(); void setStatusStore(MessageStatusStore statusStore); long getBundlingDelay(); void setBundlingDelay(long bundlingDelay); int getRetryDelay(); void setRetryDelay(int retryDelay); int getMaxAttempts(); void setMaxAttempts(int maxAttempts); int getMaxDays(); void setMaxDays(int maxDays); int getAvailableDays(); void setAvailableDays(int availableDays); int getCallCompletedThreshold(); void setCallCompletedThreshold(int callCompletedThreshold); int getPreReminderDelay(); void setPreReminderDelay(int preReminderDelay); boolean isAccelerateRetries(); void setAccelerateRetries(boolean accelerateRetries); String getNoPendingMessagesRecordingName(); void setNoPendingMessagesRecordingName(
            String noPendingMessagesRecordingName); String getWelcomeMessageRecordingName(); void setWelcomeMessageRecordingName(String welcomeMessageRecordingName); Resource getMappingResource(); void setMappingResource(Resource mappingsFile); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); RegistrarService getRegistrarService(); void setRegistrarService(RegistrarService registrarService); IVRDAO getIvrDao(); void setIvrDao(IVRDAO ivrDao); IVRCallRequester getIvrCallRequester(); void setIvrCallRequester(IVRCallRequester ivrCallRequester); }
IntellIVRBean implements GatewayManager, GetIVRConfigRequestHandler, IVRCallRequester, IVRCallSessionProcessor, IVRCallStatsProvider, ReportHandler { @Transactional public void processOpenSessions() { log.debug("Start processing OPEN IVRCallSessions"); Integer[] states = {IVRCallSession.OPEN}; List<IVRCallSession> sessions = ivrDao.loadIVRCallSessionsByStateNextAttemptBeforeDate(states, new Date()); for (IVRCallSession session : sessions) { log.debug("Changing to SEND_WAIT state session " + session); session.setState(IVRCallSession.SEND_WAIT); } log.debug("End processing OPEN IVRCallSessions"); }  @Transactional void init(); void cleanUp(); String getMessageStatus(GatewayResponse response); MStatus mapMessageStatus(GatewayResponse response); @Transactional Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest); @Transactional void processOpenSessions(); @Transactional void processWaitingSessions(); @Transactional void requestCall(IVRCallSession session, String externalId); RequestType createIVRRequest(IVRCallSession session, String externalId); @Transactional ResponseType handleRequest(GetIVRConfigRequest request); @SuppressWarnings("unchecked") @Transactional ResponseType handleRequest(GetIVRConfigRequest request, String externalId); @Transactional ResponseType handleReport(ReportType report); @Transactional int getCountIVRCallSessions(); @Transactional int getCountIVRSessionsInLastMinutes(int minutes); @Transactional int getCountIVRCallSessionsInLastHours(int hours); @Transactional int getCountIVRCallSessionsInLastDays(int days); @Transactional int getCountIVRCalls(); @Transactional int getCountIVRCallsInLastMinutes(int minutes); @Transactional int getCountIVRCallsInLastHours(int hours); @Transactional int getCountIVRCallsInLastDays(int days); @Transactional int getCountIVRCallsWithStatus(IVRCallStatus status); @Transactional int getCountIVRCallsInLastMinutesWithStatus(int minutes, IVRCallStatus status); @Transactional int getCountIVRCallsInLastHoursWithStatus(int hours, IVRCallStatus status); @Transactional int getCountIVRCallsInLastDaysWithStatus(int days, IVRCallStatus status); @Transactional List<IVRRecordingStat> getIVRRecordingStats(); @Transactional List<IVRCallStatusStat> getIVRCallStatusStats(); @Transactional List<IVRCallStatusStat> getIVRCallStatusStatsFromLastMinutes(int minutes); @Transactional List<IVRCallStatusStat> getIVRCallStatusStatsFromLastHours(int hours); @Transactional List<IVRCallStatusStat> getIVRCallStatusStatsFromLastDays(int days); @Transactional List<IVRCallSession> getIVRCallSessions(); @Transactional List<IVRCallSession> getIVRCallSessionsInLastMinutes(int minutes); @Transactional List<IVRCallSession> getIVRCallSessionsInLastHours(int hours); @Transactional List<IVRCallSession> getIVRCallSessionsInLastDays(int days); @Transactional List<IVRCallSession> getIVRCallSessionsForUser(String user); @Transactional List<IVRCallSession> getIVRCallSessionsForPhone(String phone); void setMessageHandler(GatewayMessageHandler messageHandler); GatewayMessageHandler getMessageHandler(); String getReportURL(); void setReportURL(String reportURL); String getApiID(); void setApiID(String apiID); IntellIVRServer getIvrServer(); void setIvrServer(IntellIVRServer ivrServer); String getMethod(); void setMethod(String method); String getDefaultLanguage(); void setDefaultLanguage(String defaultLanguage); String getDefaultTree(); void setDefaultTree(String defaultTree); String getDefaultReminder(); void setDefaultReminder(String defaultReminder); MessageStatusStore getStatusStore(); void setStatusStore(MessageStatusStore statusStore); long getBundlingDelay(); void setBundlingDelay(long bundlingDelay); int getRetryDelay(); void setRetryDelay(int retryDelay); int getMaxAttempts(); void setMaxAttempts(int maxAttempts); int getMaxDays(); void setMaxDays(int maxDays); int getAvailableDays(); void setAvailableDays(int availableDays); int getCallCompletedThreshold(); void setCallCompletedThreshold(int callCompletedThreshold); int getPreReminderDelay(); void setPreReminderDelay(int preReminderDelay); boolean isAccelerateRetries(); void setAccelerateRetries(boolean accelerateRetries); String getNoPendingMessagesRecordingName(); void setNoPendingMessagesRecordingName(
            String noPendingMessagesRecordingName); String getWelcomeMessageRecordingName(); void setWelcomeMessageRecordingName(String welcomeMessageRecordingName); Resource getMappingResource(); void setMappingResource(Resource mappingsFile); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); RegistrarService getRegistrarService(); void setRegistrarService(RegistrarService registrarService); IVRDAO getIvrDao(); void setIvrDao(IVRDAO ivrDao); IVRCallRequester getIvrCallRequester(); void setIvrCallRequester(IVRCallRequester ivrCallRequester);  }