@Test public void testIVRSession() { String userid = "1"; String phone = "5555555555"; String language = "English"; Language english = new LanguageImpl(); english.setCode("en"); english.setId(29000000001l); english.setName("English"); NotificationType n1 = new NotificationTypeImpl(); n1.setId(1L); MessageRequest mr1 = new MessageRequestImpl(); mr1.setId(29000000002l); mr1.setLanguage(english); mr1.setRecipientId(userid); mr1.setRequestId("mr1"); mr1.setMessageType(MessageType.VOICE); mr1.setNotificationType(n1); mr1.setPhoneNumberType("PERSONAL"); GatewayRequest r1 = new GatewayRequestImpl(); r1.setId(29000000003l); r1.setMessageRequest(mr1); r1.setMessageStatus(MStatus.PENDING); r1.setRecipientsNumber(phone); NotificationType n2 = new NotificationTypeImpl(); n2.setId(2L); MessageRequest mr2 = new MessageRequestImpl(); mr2.setId(29000000004l); mr2.setLanguage(english); mr2.setRecipientId(userid); mr2.setRequestId("mr2"); mr2.setMessageType(MessageType.VOICE); mr2.setNotificationType(n2); mr2.setPhoneNumberType("PERSONAL"); GatewayRequest r2 = new GatewayRequestImpl(); r2.setId(29000000005l); r2.setMessageRequest(mr2); r2.setMessageStatus(MStatus.PENDING); r2.setRecipientsNumber(phone); IVRSession serverSession = new IVRSession(userid, phone, language); serverSession.addGatewayRequest(r1); serverSession.addGatewayRequest(r2); assertEquals(userid, serverSession.getUserId()); assertEquals(phone, serverSession.getPhone()); assertFalse(serverSession.isUserInitiated()); assertEquals(0, serverSession.getAttempts()); serverSession.setAttempts(serverSession.getAttempts() + 1); assertEquals(1, serverSession.getAttempts()); assertTrue(serverSession.getGatewayRequests().contains(r1)); assertTrue(serverSession.getGatewayRequests().contains(r2)); serverSession.removeGatewayRequest(r2); assertFalse(serverSession.getGatewayRequests().contains(r2)); IVRSession userSession = new IVRSession(userid); userSession.addGatewayRequest(r1); userSession.addGatewayRequest(r2); assertEquals(userid, userSession.getUserId()); assertNull(userSession.getPhone()); assertTrue(userSession.isUserInitiated()); assertEquals(0, userSession.getAttempts()); userSession.setAttempts(userSession.getAttempts() + 1); assertEquals(1, userSession.getAttempts()); assertTrue(userSession.getGatewayRequests().contains(r1)); assertTrue(userSession.getGatewayRequests().contains(r2)); userSession.removeGatewayRequest(r2); assertFalse(userSession.getGatewayRequests().contains(r2)); }
public IVRSession(String userId, String phone, String language) { this.sessionId = UUID.randomUUID().toString(); this.userId = userId; this.phone = phone; this.language = language; this.userInitiated = false; requests = new ArrayList<GatewayRequest>(); }
IVRSession implements Serializable { public IVRSession(String userId, String phone, String language) { this.sessionId = UUID.randomUUID().toString(); this.userId = userId; this.phone = phone; this.language = language; this.userInitiated = false; requests = new ArrayList<GatewayRequest>(); } }
IVRSession implements Serializable { public IVRSession(String userId, String phone, String language) { this.sessionId = UUID.randomUUID().toString(); this.userId = userId; this.phone = phone; this.language = language; this.userInitiated = false; requests = new ArrayList<GatewayRequest>(); } IVRSession(String userId, String phone, String language);  IVRSession(String userId, String phone, String language, int days);  IVRSession(String userId); }
IVRSession implements Serializable { public IVRSession(String userId, String phone, String language) { this.sessionId = UUID.randomUUID().toString(); this.userId = userId; this.phone = phone; this.language = language; this.userInitiated = false; requests = new ArrayList<GatewayRequest>(); } IVRSession(String userId, String phone, String language);  IVRSession(String userId, String phone, String language, int days);  IVRSession(String userId); String getSessionId(); void setSessionId(String sessionId); String getUserId(); void setUserId(String userId); String getPhone(); void setPhone(String phone); String getLanguage(); void setLanguage(String language); boolean isUserInitiated(); void setUserInitiated(boolean userInitiated); int getAttempts(); void setAttempts(int attempts); int getDays(); void setDays(int days); int getState(); void setState(int state); void addGatewayRequest(GatewayRequest r); void removeGatewayRequest(GatewayRequest r); Collection<GatewayRequest> getGatewayRequests(); @Override int hashCode(); @Override boolean equals(Object obj); }
IVRSession implements Serializable { public IVRSession(String userId, String phone, String language) { this.sessionId = UUID.randomUUID().toString(); this.userId = userId; this.phone = phone; this.language = language; this.userInitiated = false; requests = new ArrayList<GatewayRequest>(); } IVRSession(String userId, String phone, String language);  IVRSession(String userId, String phone, String language, int days);  IVRSession(String userId); String getSessionId(); void setSessionId(String sessionId); String getUserId(); void setUserId(String userId); String getPhone(); void setPhone(String phone); String getLanguage(); void setLanguage(String language); boolean isUserInitiated(); void setUserInitiated(boolean userInitiated); int getAttempts(); void setAttempts(int attempts); int getDays(); void setDays(int days); int getState(); void setState(int state); void addGatewayRequest(GatewayRequest r); void removeGatewayRequest(GatewayRequest r); Collection<GatewayRequest> getGatewayRequests(); @Override int hashCode(); @Override boolean equals(Object obj); static int OPEN; static int SEND_WAIT; static int REPORT_WAIT; static int CLOSED; }