Package org.mokai.persist

Examples of org.mokai.persist.MessageCriteria


      .thenReturn(Collections.singleton(new Message()));

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

    Collection<Message> messages = messageStore.list(new MessageCriteria());

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


      .thenReturn(Collections.singleton(new Message()));

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

    MessageCriteria criteria = new MessageCriteria()
      .direction(Direction.TO_APPLICATIONS);
    Collection<Message> messages = messageStore.list(criteria);

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

      .thenReturn(null);

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

    Collection<Message> messages = messageStore.list(new MessageCriteria());

    Assert.assertNotNull(messages);
    Assert.assertEquals(0, messages.size());

    verify(handler).listMessages(any(Connection.class), any(MessageCriteria.class));
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);
    Collection<Message> messages = messageStore.list(criteria);
    Assert.assertNotNull(messages);
    Assert.assertEquals(0, messages.size());
View Full Code Here

  }

  @Test(expectedExceptions=IllegalStateException.class)
  public void shouldFailUpdateStatusWithNullDataSource() throws Exception {
    JdbcMessageStore messageStore = createMessageStoreNoDataSource();
    messageStore.updateStatus(new MessageCriteria(), Message.STATUS_CREATED);
  }
View Full Code Here

  }

  @Test(expectedExceptions=IllegalStateException.class)
  public void shouldFailListWithNullDataSource() throws Exception {
    JdbcMessageStore messageStore = createMessageStoreNoDataSource();
    messageStore.list(new MessageCriteria());
  }
View Full Code Here

  public void index(Request request, Response response) {
    List<ConnectorUI> connections = HelperUI.buildConnectorUIs( routingEngine.getConnections() );
    List<ConnectorUI> applications = HelperUI.buildConnectorUIs( routingEngine.getApplications() );

    MessageCriteria criteria = new MessageCriteria()
      .addStatus(Message.STATUS_FAILED)
      .addStatus(Message.STATUS_RETRYING);
    int failed = routingEngine.getMessageStore().list(criteria).size();

    criteria = new MessageCriteria().addStatus(Message.STATUS_UNROUTABLE);
    int unroutable = routingEngine.getMessageStore().list(criteria).size();

    Map<String,Object> root = new HashMap<String,Object>();
    root.put("connections", connections);
    root.put("applications", applications);
View Full Code Here

    createMessageForUpdate(connectionsCol, Message.STATUS_RETRYING);

    MongoMessageStore store = new MongoMessageStore();
    store.setMongo(db);

    store.updateStatus(new MessageCriteria(), Message.STATUS_PROCESSED);

    BasicDBObject obj = (BasicDBObject) applicationsCol.findOne();
    Assert.assertEquals( (byte) obj.getInt("status"), Message.STATUS_PROCESSED);

    obj = (BasicDBObject) connectionsCol.findOne();
View Full Code Here

    String unroutableId = createMessageForUpdate(connectionsCol, Message.STATUS_UNROUTABLE);

    MongoMessageStore store = new MongoMessageStore();
    store.setMongo(db);

    MessageCriteria criteria = new MessageCriteria();
    criteria.setDirection(Direction.TO_CONNECTIONS);
    criteria.addStatus(Message.STATUS_FAILED);
    criteria.addStatus(Message.STATUS_RETRYING);
    store.updateStatus(criteria, Message.STATUS_PROCESSED);

    BasicDBObject obj = (BasicDBObject) applicationsCol.findOne();
    Assert.assertNotNull(obj);
    Assert.assertEquals( (byte) obj.getInt("status"), Message.STATUS_FAILED);
View Full Code Here

    String unroutableId = createMessageForUpdate(applicationsCol, Message.STATUS_UNROUTABLE);

    MongoMessageStore store = new MongoMessageStore();
    store.setMongo(db);

    MessageCriteria criteria = new MessageCriteria();
    criteria.setDirection(Direction.TO_APPLICATIONS);
    criteria.addStatus(Message.STATUS_FAILED);
    criteria.addStatus(Message.STATUS_RETRYING);
    store.updateStatus(criteria, Message.STATUS_PROCESSED);

    BasicDBObject obj = (BasicDBObject) connectionsCol.findOne();
    Assert.assertNotNull(obj);
    Assert.assertEquals( (byte) obj.getInt("status"), Message.STATUS_FAILED);
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.