Package org.mokai.persist.jdbc.sms

Examples of org.mokai.persist.jdbc.sms.ConnectionsSmsHandler


      DriverManager.getConnection("jdbc:derby:;shutdown=true");
    } catch (Exception e) {}
  }

  public void testSupportsOutboundDirection() throws Exception {
    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    Assert.assertTrue(handler.supportsDirection(Direction.TO_CONNECTIONS));
    Assert.assertFalse(handler.supportsDirection(Direction.TO_APPLICATIONS));
    Assert.assertFalse(handler.supportsDirection(Direction.UNKNOWN));
    Assert.assertFalse(handler.supportsDirection(null));
  }
View Full Code Here


    message.setProperty("from", "1111");
    message.setProperty("to", "2222");
    message.setProperty("text", "text");
    message.setProperty("other", "other value");

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    long id = handler.insertMessage(connection, message);

    validateMessage(id, new MessageValidator() {

      @Override
      public void validate(ResultSet rs) throws SQLException {
View Full Code Here

    message.setStatus(Message.STATUS_RETRYING);
    message.setDestination("test");
    message.setProperty("receiptStatus", "DELIVRD");
    message.setProperty("other", "other value");

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    boolean found = handler.updateMessage(connection, message);

    Assert.assertTrue(found);

    validateMessage(id, new MessageValidator() {
View Full Code Here

    final Message message = new Message();
    message.setId(1L);
    message.setStatus(Message.STATUS_RETRYING);
    message.setDestination("test");

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    boolean found = handler.updateMessage(connection, message);

    Assert.assertFalse(found);
  }
View Full Code Here

  @Test
  public void testUpdateStatusToAllMessages() throws Exception {
    generateTestData();
    Assert.assertEquals(getNumMessagesByStatus(Message.STATUS_FAILED), 3);

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    handler.updateMessagesStatus(connection, null, Message.STATUS_RETRYING);

    Assert.assertEquals(getNumMessagesByStatus(Message.STATUS_FAILED), 0);
    Assert.assertEquals(getNumMessagesByStatus(Message.STATUS_RETRYING), 9);
  }
View Full Code Here

  @Test
  public void testUpdateStatusToFailedMessages() throws Exception {
    generateTestData();
    Assert.assertEquals(getNumMessagesByStatus(Message.STATUS_FAILED), 3);

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    handler.updateMessagesStatus(connection, new MessageCriteria().addStatus(Message.STATUS_FAILED), Message.STATUS_RETRYING);

    Assert.assertEquals(getNumMessagesByStatus(Message.STATUS_FAILED), 0);
    Assert.assertEquals(getNumMessagesByStatus(Message.STATUS_RETRYING), 3);
  }
View Full Code Here

  @Test
  public void testRetrieveAllMessages() throws Exception {
    generateTestData();

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    handler.setSqlEngine(new DerbyEngine(dataSource));

    Collection<Message> messages = handler.listMessages(connection, null);

    Assert.assertFalse(messages.isEmpty());
    Assert.assertEquals(messages.size(), 9);
  }
View Full Code Here

  @Test
  public void testRetrieveSomeMessages() throws Exception {
    generateTestData();

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    handler.setSqlEngine(new DerbyEngine(dataSource));

    MessageCriteria criteria = new MessageCriteria()
      .lowerLimit(3)
      .numRecords(3);
    Collection<Message> messages = handler.listMessages(connection, criteria);

    Assert.assertFalse(messages.isEmpty());
    Assert.assertEquals(messages.size(), 3);
  }
View Full Code Here

  @Test
  public void testRetrieveMessageId() throws Exception {
    generateTestData();

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    handler.setSqlEngine(new DerbyEngine(dataSource));

    MessageCriteria criteria = new MessageCriteria()
      .addProperty("smsc_messageid", "8");

    Collection<Message> messages = handler.listMessages(connection, criteria);

    Assert.assertEquals(messages.size(), 1);
  }
View Full Code Here

  @Test
  public void testRetrieveMessagesByStatus() throws Exception {
    generateTestData();

    ConnectionsSmsHandler handler = new ConnectionsSmsHandler();
    handler.setSqlEngine(new DerbyEngine(dataSource));

    MessageCriteria criteria = new MessageCriteria()
      .addStatus(Message.STATUS_FAILED);

    Collection<Message> messages = handler.listMessages(connection, criteria);

    Assert.assertEquals(messages.size(), 3);
  }
View Full Code Here

TOP

Related Classes of org.mokai.persist.jdbc.sms.ConnectionsSmsHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.