Package org.mokai.persist.jdbc

Examples of org.mokai.persist.jdbc.JdbcMessageStore.saveOrUpdate()


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

    Message message = new Message();
    messageStore.saveOrUpdate(message);

    Assert.assertEquals(10L, ((Long) message.getId()).longValue());

    verify(handler).insertMessage(any(Connection.class), any(Message.class));
    verify(handler, never()).updateMessage(any(Connection.class), any(Message.class));
View Full Code Here


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

    Message message = new Message();
    messageStore.saveOrUpdate(message);
  }

  @Test
  public void testUpdateMessage() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
View Full Code Here

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

    Message message = new Message();
    message.setId(10);
    messageStore.saveOrUpdate(message);

    verify(handler).updateMessage(any(Connection.class), any(Message.class));
    verify(handler, never()).insertMessage(any(Connection.class), any(Message.class));
  }
View Full Code Here

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

    Message message = new Message();
    message.setId(10);
    messageStore.saveOrUpdate(message);
  }

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

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

    Message message = new Message();
    message.setId(10);
    messageStore.saveOrUpdate(message);
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void shouldFailToSaveOrUpdateWithNullMessage() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
View Full Code Here

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

    messageStore.saveOrUpdate(null);
  }

  @Test
  public void testUpdateStatusWithEmptyCriteria() throws Exception {
    MessageHandler handler = mock(MessageHandler.class);
View Full Code Here

  }

  @Test(expectedExceptions=IllegalStateException.class)
  public void shouldFailSaveOrUpdateWithNullDataSource() throws Exception {
    JdbcMessageStore messageStore = createMessageStoreNoDataSource();
    messageStore.saveOrUpdate(new Message());
  }

  @Test(expectedExceptions=IllegalStateException.class)
  public void shouldFailUpdateStatusWithNullDataSource() throws Exception {
    JdbcMessageStore messageStore = createMessageStoreNoDataSource();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.