@Test
  public void testFindWithLimitAndSort() {
    Event event = genEvent();
    event.setEventTime(new Date(1436390151975l));
    dataRepository.save(event);
    List<Condition> conditions = new LinkedList<Condition>();
    conditions.add(new Condition("uid", PhoenixConditionOperator.EQUAL, "TEST_USER"));
    Condition c1 = new Condition("event_time", PhoenixConditionOperator.EQUAL, 1436390151975l);
    Condition c2 = new Condition("event_time", PhoenixConditionOperator.EQUAL, 1436216440707l);
    conditions.add(new Condition(c1, PhoenixConditionOperator.OR, c2));

    Query query =
        QueryBuilder.newBuilder()
            .conditions(conditions)
            .sort(new Sort(new Order(Direction.DESC, "receipt_time")))
            .limit(1)
            .build();

    List<Event> list = (List<Event>) dataRepository.find(query);
    Assert.assertTrue(!list.isEmpty());

    for (Event e : list) {
      System.out.println(e);
    }
  }
 @Test
 public void testFindAllWithLimit() {
   Query query = QueryBuilder.newBuilder().limit(2).build();
   List<Event> list = (List<Event>) dataRepository.find(query);
   Assert.assertTrue(!list.isEmpty());
   Assert.assertTrue(list.size() == 2);
 }
  @Test
  public void testFind() {
    List<Event> events = new LinkedList<Event>();
    Event event = genEvent();
    event.setEventTime(new Date(1436390151975l));
    events.add(event);
    Event event2 = genEvent();
    event2.setEventTime(new Date(1436216440707l));
    events.add(event2);
    dataRepository.save(events);
    List<Condition> conditions = new LinkedList<Condition>();
    conditions.add(new Condition("uid", PhoenixConditionOperator.EQUAL, "TEST_USER"));
    Condition c1 = new Condition("event_time", PhoenixConditionOperator.IS_NOT_NULL, null);
    Condition c2 = new Condition("event_time", PhoenixConditionOperator.EQUAL, 1436216440707l);
    conditions.add(new Condition(c1, PhoenixConditionOperator.OR, c2));

    Query query = QueryBuilder.newBuilder().conditions(conditions).build();

    List<Event> list = (List<Event>) dataRepository.find(query);
    Assert.assertTrue(!list.isEmpty());

    for (Event e : list) {
      System.out.println(e);
    }
  }
 @Test
 public void testFindAllWithSort() {
   Query query =
       QueryBuilder.newBuilder()
           .sort(
               new Sort(new Order(Direction.DESC, "uid"), new Order(Direction.ASC, "event_time")))
           .build();
   List<Event> list = (List<Event>) dataRepository.find(query);
   Assert.assertTrue(!list.isEmpty());
 }