Package org.mokai.persist.jdbc

Examples of org.mokai.persist.jdbc.MessageHandler


    messageStore.saveOrUpdate(message);
  }

  @Test(expectedExceptions=RejectedException.class)
  public void shouldFailToUpdateIfNotSupported() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);

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

    Message message = new Message();
View Full Code Here


    messageStore.saveOrUpdate(message);
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldFailToSaveOrUpdateWithNullMessage() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);

    messageStore.saveOrUpdate(null);
  }
View Full Code Here

    messageStore.saveOrUpdate(null);
  }

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

      .updateMessagesStatus(any(Connection.class), any(MessageCriteria.class), anyByte());
  }

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

    messageStore.updateStatus(null, Message.STATUS_RETRYING);
View Full Code Here

      .updateMessagesStatus(any(Connection.class), any(MessageCriteria.class), anyByte());
  }

  @Test
  public void testUpdateStatusWithTypeAndDirectionCriteria() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    when(handler.supportsDirection(any(Direction.class))).thenReturn(true);

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

    MessageCriteria criteria = new MessageCriteria()
View Full Code Here

      .updateMessagesStatus(any(Connection.class), any(MessageCriteria.class), anyByte());
  }

  @Test
  public void testUpdateStatusWithNotSupportedDirectionCriteria() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    when(handler.supportsDirection(any(Direction.class))).thenReturn(false);

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

    MessageCriteria criteria = new MessageCriteria()
View Full Code Here

      .updateMessagesStatus(any(Connection.class), any(MessageCriteria.class), anyByte());
  }

  @Test
  public void testListWithEmptyCriteria() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    when(handler.listMessages(any(Connection.class), any(MessageCriteria.class)))
      .thenReturn(Collections.singleton(new Message()));

    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);
View Full Code Here

    Assert.assertEquals(1, messages.size());
  }

  @Test
  public void testListWithNullCriteria() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    when(handler.listMessages(any(Connection.class), any(MessageCriteria.class)))
      .thenReturn(Collections.singleton(new Message()));

    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);
View Full Code Here

    Assert.assertEquals(1, messages.size());
  }

  @Test
  public void testListWithTypeAndDirectionCriteria() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    when(handler.supportsDirection(any(Direction.class))).thenReturn(true);
    when(handler.listMessages(any(Connection.class), any(MessageCriteria.class)))
      .thenReturn(Collections.singleton(new Message()));

    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);
View Full Code Here

    Assert.assertEquals(1, messages.size());
  }

  @Test
  public void testListHandlerReturnsNull() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
    when(handler.listMessages(any(Connection.class), any(MessageCriteria.class)))
      .thenReturn(null);

    DataSource dataSource = mockDataSource();
    JdbcMessageStore messageStore = createMessageStore(dataSource, handler);
View Full Code Here

TOP

Related Classes of org.mokai.persist.jdbc.MessageHandler

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.