Package org.mokai.persist

Examples of org.mokai.persist.MessageCriteria


    Connection conn = mock(Connection.class);
    MessageHandler handler = createMessageHandler(outHandler, inHandler);

    Collection<Message> message = handler.listMessages(conn,
        new MessageCriteria().direction(Direction.TO_CONNECTIONS));
    Assert.assertEquals(1, message.size());

    verify(inHandler, never()).listMessages(any(Connection.class), any(MessageCriteria.class));
  }
View Full Code Here


    Connection conn = mock(Connection.class);
    MessageHandler handler = createMessageHandler(outHandler, inHandler);

    Collection<Message> message = handler.listMessages(conn,
        new MessageCriteria().direction(Direction.TO_APPLICATIONS));
    Assert.assertEquals(1, message.size());

    verify(outHandler, never()).listMessages(any(Connection.class), any(MessageCriteria.class));
  }
View Full Code Here

    MessageHandler inHandler = mock(MessageHandler.class);

    Connection conn = mock(Connection.class);
    MessageHandler handler = createMessageHandler(outHandler, inHandler);

    Collection<Message> message = handler.listMessages(conn, new MessageCriteria());
    Assert.assertEquals(0, message.size());

    verify(outHandler).listMessages(any(Connection.class), any(MessageCriteria.class));
    verify(inHandler).listMessages(any(Connection.class), any(MessageCriteria.class));
  }
View Full Code Here

  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

    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());
View Full Code Here

    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

    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

  public void testUpdateStatusWithEmptyCriteria() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);

    messageStore.updateStatus(new MessageCriteria(), Message.STATUS_RETRYING);

    verify(handler)
      .updateMessagesStatus(any(Connection.class), any(MessageCriteria.class), anyByte());
  }
View Full Code Here

    when(handler.supportsDirection(any(Direction.class))).thenReturn(true);

    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);

    MessageCriteria criteria = new MessageCriteria()
      .direction(Direction.TO_APPLICATIONS);
    messageStore.updateStatus(criteria, Message.STATUS_RETRYING);

    verify(handler)
      .updateMessagesStatus(any(Connection.class), any(MessageCriteria.class), anyByte());
View Full Code Here

    when(handler.supportsDirection(any(Direction.class))).thenReturn(false);

    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);

    MessageCriteria criteria = new MessageCriteria()
      .direction(Direction.TO_APPLICATIONS);
    messageStore.updateStatus(criteria, Message.STATUS_RETRYING);

    verify(handler, never())
      .updateMessagesStatus(any(Connection.class), any(MessageCriteria.class), anyByte());
View Full Code Here

TOP

Related Classes of org.mokai.persist.MessageCriteria

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.