Package com.dianping.cat.broker

Source Code of com.dianping.cat.broker.IpServiceTest

package com.dianping.cat.broker;

import org.junit.Test;
import org.unidal.lookup.ComponentTestCase;

import com.dianping.cat.service.IpService;
import com.dianping.cat.service.IpService.IpInfo;

public class IpServiceTest extends ComponentTestCase {
  @Test
  public void getSystemTime() throws Exception {
    System.err.println(System.currentTimeMillis() - 60 * 1000 * 2);
  }

  @Test
  public void test() throws Exception {
    IpService service = (IpService) lookup(IpService.class);

    for (int i = 0; i < 10000; i++) {
      String ip = i % 255 + "." + i % 255 + "." + i % 255 + "." + i % 255;
      IpInfo info = service.findIpInfoByString(ip);

      if (info != null) {
        System.out.print(ip + " " + info.getChannel());
        System.out.print(" " + info.getCity());
        System.out.println(" " + info.getProvince());
      }
    }
  }

}
TOP

Related Classes of com.dianping.cat.broker.IpServiceTest

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.