@Test
 public void testFindOne() {
   dataRepository.save(genEvent());
   Event e = dataRepository.get(new Object[] {1, "TEST_USER", 1434441175000l, 1434441177000l});
   System.out.println(e);
   Assert.assertNotNull(e);
 }
 @Test
 public void testDeleteById() {
   Event event = genEvent();
   dataRepository.save(event);
   dataRepository.delete(event.getId());
   Assert.assertFalse(dataRepository.exists(event.getId()));
 }
 @Test
 public void testExists() {
   dataRepository.save(genEvent());
   boolean isExist =
       dataRepository.exists(new Object[] {1, "TEST_USER", 1434441175000l, 1434441177000l});
   Assert.assertTrue(isExist);
 }
  @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 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 testSaveBatch() {
   List<Event> events = new LinkedList<Event>();
   for (int i = 0; i < 10; i++) {
     events.add(genEvent());
   }
   dataRepository.save(events);
   for (Event e : events) {
     Assert.assertTrue(dataRepository.exists(e.getId()));
   }
 }
 @Test
 public void testDeleteByIdBatch() {
   List<Event> events = new LinkedList<Event>();
   for (int i = 0; i < 10; i++) {
     events.add(genEvent());
   }
   dataRepository.save(events);
   List<Object[]> ids = new LinkedList<Object[]>();
   for (Event e : events) {
     Assert.assertTrue(dataRepository.exists(e.getId()));
     ids.add(e.getId());
   }
   dataRepository.delete(ids);
   for (Event e : events) {
     Assert.assertFalse(dataRepository.exists(e.getId()));
     ids.add(e.getId());
   }
 }
 @Test
 public void testSave() {
   Event Event = genEvent();
   dataRepository.save(Event);
   Assert.assertTrue(dataRepository.exists(Event.getId()));
 }