Package com.dianping.cat.broker.api.app

Examples of com.dianping.cat.broker.api.app.BucketHandler


  @Test
  public void test() throws Exception {
    AppDataService appDataService = null;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    long startTime = sdf.parse("2014-08-19 11:20").getTime();
    BucketHandler handler = new BucketHandler(startTime, appDataService);

    HashMap<Integer, HashMap<String, AppData>> datas = handler.getDatas();
    HashMap<String, AppData> data = new HashMap<String, AppData>();

    datas.put(1, data);

    for (int i = 0; i < 10; i++) {
      AppData createAppData = createAppData(i);
      data.put(createAppData.toString(), createAppData);
    }

    handler.save(file);

    datas.clear();

    handler.load(file);
    AppDataQueue<AppData> queue = handler.getAppDataQueue();

    while (true) {
      AppData appdata = queue.poll();
      if (appdata != null) {

        handler.processEntity(appdata);
      } else {
        break;
      }
    }

    HashMap<String, AppData> temp = handler.getDatas().get(1);
    Assert.assertEquals(10, temp.size());
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.broker.api.app.BucketHandler

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.