CommonTest.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. package com.izouma.nineth;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.serializer.SerializerFeature;
  4. import com.github.kevinsawicki.http.HttpRequest;
  5. import com.google.common.base.Splitter;
  6. import com.izouma.nineth.config.Constants;
  7. import com.izouma.nineth.domain.BaseEntity;
  8. import com.izouma.nineth.domain.BlindBoxItem;
  9. import com.izouma.nineth.domain.User;
  10. import com.izouma.nineth.dto.PageQuery;
  11. import com.izouma.nineth.service.IdentityAuthService;
  12. import com.izouma.nineth.utils.AESEncryptUtil;
  13. import com.izouma.nineth.utils.TokenUtils;
  14. import com.izouma.nineth.web.BaseController;
  15. import io.ipfs.api.IPFS;
  16. import io.ipfs.api.MerkleNode;
  17. import io.ipfs.api.NamedStreamable;
  18. import io.ipfs.multihash.Multihash;
  19. import io.jsonwebtoken.Claims;
  20. import io.jsonwebtoken.Jwts;
  21. import io.jsonwebtoken.SignatureAlgorithm;
  22. import lombok.SneakyThrows;
  23. import net.coobird.thumbnailator.Thumbnails;
  24. import org.apache.commons.codec.EncoderException;
  25. import org.apache.commons.codec.net.URLCodec;
  26. import org.apache.commons.io.FileUtils;
  27. import org.apache.commons.lang3.RandomStringUtils;
  28. import org.apache.commons.lang3.RandomUtils;
  29. import org.apache.commons.lang3.Range;
  30. import org.apache.commons.text.CaseUtils;
  31. import org.apache.http.NameValuePair;
  32. import org.apache.http.client.utils.URLEncodedUtils;
  33. import org.apache.poi.util.TempFile;
  34. import org.bouncycastle.util.encoders.Base64;
  35. import org.bytedeco.javacv.FFmpegFrameGrabber;
  36. import org.bytedeco.javacv.Frame;
  37. import org.bytedeco.javacv.Java2DFrameConverter;
  38. import org.junit.Test;
  39. import org.libjpegturbo.turbojpeg.processor.api.ImageProcessException;
  40. import org.libjpegturbo.turbojpeg.processor.api.ImageProcessInfo;
  41. import org.libjpegturbo.turbojpeg.processor.api.ImageProcessor;
  42. import org.libjpegturbo.turbojpeg.processor.impl.ImageProcessorImpl;
  43. import org.libjpegturbo.turbojpeg.processor.utils.ImageProcessorUtils;
  44. import org.pngquant.PngQuant;
  45. import org.reflections.ReflectionUtils;
  46. import org.reflections.Reflections;
  47. import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
  48. import org.springframework.util.FileCopyUtils;
  49. import org.springframework.web.bind.annotation.GetMapping;
  50. import org.springframework.web.bind.annotation.PostMapping;
  51. import org.springframework.web.bind.annotation.RequestMapping;
  52. import org.springframework.web.bind.annotation.RestController;
  53. import javax.imageio.ImageIO;
  54. import java.awt.*;
  55. import java.awt.font.FontRenderContext;
  56. import java.awt.geom.AffineTransform;
  57. import java.awt.image.BufferedImage;
  58. import java.io.File;
  59. import java.io.IOException;
  60. import java.lang.reflect.Method;
  61. import java.math.BigDecimal;
  62. import java.math.BigInteger;
  63. import java.math.RoundingMode;
  64. import java.nio.charset.StandardCharsets;
  65. import java.nio.file.Files;
  66. import java.nio.file.Paths;
  67. import java.security.NoSuchAlgorithmException;
  68. import java.util.List;
  69. import java.util.*;
  70. import java.util.concurrent.ExecutorService;
  71. import java.util.concurrent.Executors;
  72. import java.util.concurrent.ForkJoinPool;
  73. import java.util.regex.Pattern;
  74. import java.util.stream.IntStream;
  75. import static java.nio.file.StandardOpenOption.CREATE;
  76. import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
  77. public class CommonTest {
  78. @Test
  79. public void getGenericsClass() {
  80. List<User> data = new ArrayList<>();
  81. data.add(new User());
  82. System.out.println(data.get(0).getClass().getSimpleName());
  83. System.out.println(data.getClass());
  84. Reflections reflections = new Reflections(this.getClass().getPackage().getName() + ".domain");
  85. Set<Class<? extends BaseEntity>> allClasses = reflections.getSubTypesOf(BaseEntity.class);
  86. for (Class<? extends BaseEntity> allClass : allClasses) {
  87. System.out.println(allClass.getName());
  88. }
  89. }
  90. @Test
  91. public void getapis() {
  92. List<Map<String, String>> entities = new ArrayList<>();
  93. Reflections classReflections = new Reflections(this.getClass().getPackage().getName());
  94. Set<Class<? extends BaseController>> controllers = classReflections.getSubTypesOf(BaseController.class);
  95. Set<Class<? extends BaseController>> list = ReflectionUtils
  96. .getAll(controllers, ReflectionUtils.withAnnotation(RestController.class));
  97. System.out.println(list);
  98. for (Class<? extends BaseController> aClass : list) {
  99. RequestMapping requestMapping = aClass.getAnnotation(RequestMapping.class);
  100. String baseUrl = requestMapping.value()[0];
  101. for (Method method : ReflectionUtils.getMethods(aClass, ReflectionUtils.withAnnotation(GetMapping.class))) {
  102. GetMapping getMapping = method.getAnnotation(GetMapping.class);
  103. System.out.println(getMapping.value()[0]);
  104. }
  105. for (Method method : ReflectionUtils
  106. .getMethods(aClass, ReflectionUtils.withAnnotation(PostMapping.class))) {
  107. PostMapping postMapping = method.getAnnotation(PostMapping.class);
  108. System.out.println(postMapping.value()[0]);
  109. }
  110. }
  111. }
  112. @Test
  113. public void testCaseUtils() {
  114. System.out.println(CaseUtils.toCamelCase("test_Model", true, '_'));
  115. }
  116. @Test
  117. public void testMeasureText() throws IOException, FontFormatException {
  118. AffineTransform affinetransform = new AffineTransform();
  119. FontRenderContext frc = new FontRenderContext(affinetransform, true, true);
  120. Font font = Font.createFont(Font.TRUETYPE_FONT, this.getClass()
  121. .getResourceAsStream("/font/SourceHanSansCN-Normal.ttf"));
  122. System.out.println((int) (font.deriveFont(14f).getStringBounds("aaa", frc).getWidth()));
  123. }
  124. @Test
  125. public void testIdNoRegexp() {
  126. boolean b = Pattern
  127. .matches("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0-2]\\d)|3[0-1])\\d{3}$|^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0-2]\\d)|3[0-1])\\d{3}[0-9xX]$", "32100219950830461X");
  128. System.out.println(b);
  129. }
  130. @Test
  131. public void tesSms() throws IOException {
  132. Reflections reflections = new Reflections(this.getClass().getPackage().getName() + ".enums");
  133. Set<Class<? extends Enum>> entitySet = reflections.getSubTypesOf(Enum.class);
  134. StringBuilder idxJs = new StringBuilder();
  135. for (Class<? extends Enum> entity : entitySet) {
  136. idxJs.append("import ").append(entity.getSimpleName()).append(" from \"./").append(entity.getSimpleName())
  137. .append("\";\n");
  138. StringBuilder str = new StringBuilder("export default {\n");
  139. for (Enum enumConstant : entity.getEnumConstants()) {
  140. str.append(" ").append(enumConstant.name()).append(": \"").append(enumConstant.name())
  141. .append("\",\n");
  142. }
  143. str.append("}");
  144. Files.write(Paths.get(System.getProperty("user.dir"), "src", "main", "vue", "src", "constants", entity
  145. .getSimpleName() + ".js"), str.toString()
  146. .getBytes(StandardCharsets.UTF_8), CREATE, TRUNCATE_EXISTING);
  147. Files.write(Paths.get(System.getProperty("user.dir"), "src", "main", "zmj_mp", "src", "constants", entity
  148. .getSimpleName() + ".js"), str.toString()
  149. .getBytes(StandardCharsets.UTF_8), CREATE, TRUNCATE_EXISTING);
  150. }
  151. idxJs.append("export default {\n");
  152. for (Class<? extends Enum> entity : entitySet) {
  153. idxJs.append(" ").append(entity.getSimpleName()).append(": ").append(entity.getSimpleName())
  154. .append(",\n");
  155. }
  156. idxJs.append("}");
  157. System.out.println(idxJs.toString());
  158. Files.write(Paths
  159. .get(System.getProperty("user.dir"), "src", "main", "vue", "src", "constants", "index.js"), idxJs
  160. .toString().getBytes(StandardCharsets.UTF_8), CREATE, TRUNCATE_EXISTING);
  161. Files.write(Paths
  162. .get(System.getProperty("user.dir"), "src", "main", "zmj_mp", "src", "constants", "index.js"), idxJs
  163. .toString().getBytes(StandardCharsets.UTF_8), CREATE, TRUNCATE_EXISTING);
  164. }
  165. @Test
  166. public void gen() {
  167. System.out.println(RandomStringUtils.randomAlphabetic(32));
  168. }
  169. @Test
  170. public void password() {
  171. String password = new BCryptPasswordEncoder().encode("123456");
  172. System.out.println(password);
  173. }
  174. @SneakyThrows
  175. @Test
  176. public void pngquant() {
  177. PngQuant pngQuant = new PngQuant();
  178. ImageIO.write(pngQuant
  179. .getRemapped(ImageIO.read(new File("/Users/drew/Downloads/2021-11-01-18-07-04JCDfFxKb.HEIC"))),
  180. "jpg", new File("/Users/drew/Downloads/111.jpg"));
  181. }
  182. @SneakyThrows
  183. @Test
  184. public void mozjpeg() {
  185. File out = TempFile.createTempFile("kljasdlkhfasldg", ".jpg");
  186. ImageProcessor processor = new ImageProcessorImpl();
  187. ImageProcessInfo processInfo = ImageProcessInfo.fromMap(ImageProcessorUtils.compressImage(processor,
  188. new File("/Users/drew/Downloads/2020-09-08-17-07-21zwBhaHeQ.jpg"),
  189. out, 75));
  190. FileCopyUtils.copy(out, new File("/Users/drew/Desktop/111.jpg"));
  191. System.out.println(out);
  192. }
  193. @Test
  194. public void thumbnailator() throws IOException, ImageProcessException {
  195. Thumbnails.of(new File("/Users/drew/Downloads/2021-11-01-17-47-55zMwbSlgJ.jpeg"))
  196. .size(3000, 3000)
  197. .outputFormat("jpg")
  198. .toFile("/Users/drew/Desktop/1.jpg");
  199. PngQuant pngQuant = new PngQuant();
  200. ImageIO.write(pngQuant
  201. .getRemapped(ImageIO.read(new File("/Users/drew/Desktop/1.jpg"))),
  202. "jpg", new File("/Users/drew/Desktop/2.jpg"));
  203. ImageProcessor processor = new ImageProcessorImpl();
  204. ImageProcessInfo processInfo = ImageProcessInfo.fromMap(ImageProcessorUtils.compressImage(processor,
  205. new File("/Users/drew/Desktop/1.jpg"),
  206. new File("/Users/drew/Desktop/3.jpg"), 75));
  207. }
  208. @Test
  209. public void base64() {
  210. System.out.println(Base64.decode("e6e6vQJYhGmIkcA1pfnsipTovp10wJ"));
  211. }
  212. @Test
  213. public void resolveUrl() {
  214. try {
  215. System.out.println(new URLCodec().encode("http://www.baidu.com"));
  216. } catch (EncoderException e) {
  217. e.printStackTrace();
  218. }
  219. }
  220. @Test
  221. public void testIPFS() throws IOException {
  222. IPFS ipfs = new IPFS("121.40.132.44", 5001);
  223. HttpRequest request = HttpRequest.get("https://awesomeadmin.oss-cn-hangzhou.aliyuncs.com/image/2021-10-21-16-44-52kZqxuwhH.gif");
  224. File file = File.createTempFile("ipfs", ".tmp");
  225. request.receive(file);
  226. NamedStreamable.FileWrapper file1 = new NamedStreamable.FileWrapper(file);
  227. MerkleNode put = ipfs.add(file1).get(0);
  228. Multihash multihash = ipfs.pin.add(put.hash).get(0);
  229. System.out.println(put.hash.toBase58());
  230. System.out.println(multihash.toBase58());
  231. }
  232. @Test
  233. public void testWin() {
  234. List<BlindBoxItem> items = new ArrayList<>();
  235. items.add(BlindBoxItem.builder()
  236. .name("普通1")
  237. .total(100)
  238. .stock(100)
  239. .build());
  240. items.add(BlindBoxItem.builder()
  241. .name("普通2")
  242. .total(100)
  243. .stock(100)
  244. .build());
  245. items.add(BlindBoxItem.builder()
  246. .name("稀有1")
  247. .total(5)
  248. .stock(5)
  249. .rare(true)
  250. .build());
  251. items.add(BlindBoxItem.builder()
  252. .name("稀有2")
  253. .total(5)
  254. .stock(5)
  255. .rare(true)
  256. .build());
  257. for (int k = 0; k < items.stream().mapToInt(BlindBoxItem::getTotal).sum(); k++) {
  258. Map<BlindBoxItem, Range<Integer>> randomRange = new HashMap<>();
  259. int c = 0, sum = 0;
  260. for (BlindBoxItem item : items) {
  261. randomRange.put(item, Range.between(c, c + item.getStock()));
  262. c += item.getStock();
  263. sum += item.getStock();
  264. }
  265. boolean win = false;
  266. int retry = 0;
  267. BlindBoxItem winItem = null;
  268. while (winItem == null) {
  269. int rand = RandomUtils.nextInt(0, sum + 1);
  270. for (Map.Entry<BlindBoxItem, Range<Integer>> entry : randomRange.entrySet()) {
  271. BlindBoxItem item = entry.getKey();
  272. Range<Integer> range = entry.getValue();
  273. if (rand >= range.getMinimum() && rand < range.getMaximum()) {
  274. int total = items.stream().filter(i -> !i.isRare())
  275. .mapToInt(BlindBoxItem::getTotal).sum();
  276. int stock = items.stream().filter(i -> !i.isRare())
  277. .mapToInt(BlindBoxItem::getStock).sum();
  278. if (item.isRare()) {
  279. double nRate = stock / (double) total;
  280. double rRate = (item.getStock() - 1) / (double) item.getTotal();
  281. if (Math.abs(nRate - rRate) < (1 / (double) item.getTotal()) || retry > 1 || rRate == 0) {
  282. if (!(nRate > 0.1 && item.getStock() == 1)) {
  283. winItem = item;
  284. }
  285. } else {
  286. retry++;
  287. }
  288. } else {
  289. double nRate = (stock - 1) / (double) total;
  290. double rRate = item.getStock() / (double) item.getTotal();
  291. if (Math.abs(nRate - rRate) < 0.2 || retry > 1 || nRate == 0) {
  292. winItem = item;
  293. } else {
  294. retry++;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. winItem.setStock(winItem.getStock() - 1);
  301. System.out.println(winItem.getName() + (winItem.isRare() ? "\t+++" : ""));
  302. }
  303. }
  304. @Test
  305. public void testGrabFrame() throws IOException {
  306. FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber("/Users/drew/Downloads/video1627914878375.mp4");
  307. frameGrabber.start();
  308. Java2DFrameConverter aa = new Java2DFrameConverter();
  309. int length = frameGrabber.getLengthInVideoFrames();
  310. Frame frame = null;
  311. int i = 0;
  312. while (frame == null && i < length) {
  313. frame = frameGrabber.grabKeyFrame();
  314. i++;
  315. }
  316. Objects.requireNonNull(frame);
  317. BufferedImage thumbBi = aa.convert(frame);
  318. ImageIO.write(thumbBi, "jpg", new File("/Users/drew/Desktop/1.jpg"));
  319. }
  320. @Test
  321. public void testQuality() throws IOException {
  322. Thumbnails.of("/Users/drew/Desktop/2021-11-04-11-28-36VAOoasUd.jpeg")
  323. .size(1000, 1000)
  324. .outputFormat("jpg")
  325. .outputQuality(1)
  326. .toFile("/Users/drew/Desktop/1.jpg");
  327. Thumbnails.of("/Users/drew/Desktop/2021-11-04-11-28-36VAOoasUd.jpeg")
  328. .size(1000, 1000)
  329. .outputFormat("jpg")
  330. .outputQuality(0.6)
  331. .toFile("/Users/drew/Desktop/2.jpg");
  332. }
  333. @Test
  334. public void testJwt() {
  335. String token = Jwts.builder()
  336. .setClaims(new HashMap<>())
  337. .setSubject("15077886171")
  338. .setIssuedAt(new Date())
  339. .setExpiration(new Date(new Date().getTime() + 10 * 60 * 1000)) //10min
  340. .signWith(SignatureAlgorithm.HS512, Constants.SMS_TOKEN_SECRET)
  341. .compact();
  342. System.out.println(token);
  343. Claims claims = Jwts.parser()
  344. .setSigningKey(Constants.SMS_TOKEN_SECRET)
  345. .parseClaimsJws(token)
  346. .getBody();
  347. System.out.println(claims.getSubject());
  348. System.out.println(claims.getExpiration());
  349. }
  350. @Test
  351. public void testReplace() {
  352. System.out.println("15077886171".replaceAll("(?<=.{3}).*(?=.{4})", "**"));
  353. }
  354. @Test
  355. public void sfsdf() {
  356. System.out.println(BigDecimal.valueOf(11111110.5).setScale(2, RoundingMode.HALF_UP).toPlainString());
  357. }
  358. @Test
  359. public void random256() throws NoSuchAlgorithmException {
  360. String tokenId = TokenUtils.genTokenId();
  361. System.out.println(tokenId);
  362. System.out.println(new BigInteger(tokenId, 16));
  363. }
  364. @Test
  365. public void dd() throws IOException {
  366. String[] arr1 = FileUtils.readFileToString(new File("/Users/drew/Desktop/未命名文件夹 2/111")).split("\n");
  367. List<String> arr2 = Arrays.asList(FileUtils.readFileToString(new File("/Users/drew/Desktop/未命名文件夹 2/222"))
  368. .split("\n"));
  369. for (String s : arr1) {
  370. if (!arr2.contains(s)) {
  371. System.out.println(s);
  372. }
  373. }
  374. }
  375. @Test
  376. public void jj() {
  377. final int parallelism = 4;
  378. ForkJoinPool forkJoinPool = null;
  379. try {
  380. forkJoinPool = new ForkJoinPool(parallelism);
  381. forkJoinPool.submit(() ->
  382. // Parallel task here, for example
  383. IntStream.range(1, 1_000_000).parallel()
  384. .forEach(i -> {
  385. })
  386. );
  387. } finally {
  388. if (forkJoinPool != null) {
  389. forkJoinPool.shutdown();
  390. }
  391. }
  392. }
  393. @Test
  394. public void testnewSingleThreadScheduledExecutor() throws InterruptedException {
  395. ExecutorService service = Executors.newFixedThreadPool(10);
  396. final int[] c = {0};
  397. for (int i = 0; i < 1000; i++) {
  398. service.submit(new Runnable() {
  399. @SneakyThrows
  400. @Override
  401. public void run() {
  402. Thread.sleep(300);
  403. System.out.println(++c[0]);
  404. }
  405. });
  406. }
  407. Thread.sleep(20000);
  408. }
  409. @Test
  410. public void testaes() throws Exception {
  411. String encrypted = "ccd97379f001d47895eb4293144b74f28de4fcf5b56daf4ce73d2db34f381984b2c2260f821593968e387dccdc11713a5b558a571b17aaae3e9e91a0b9dc576e";
  412. String qs = AESEncryptUtil.decrypt(encrypted);
  413. System.out.println(qs);
  414. List<NameValuePair> list = URLEncodedUtils.parse(qs, StandardCharsets.UTF_8);
  415. System.out.println(JSON.toJSONString(list, SerializerFeature.PrettyFormat));
  416. final Map<String, String> map = Splitter.on('&').trimResults().withKeyValueSeparator('=').split(qs);
  417. System.out.println(map);
  418. }
  419. @Test
  420. public void aasdf() {
  421. System.out.println(new BCryptPasswordEncoder().matches("123456", "$2a$10$hYKQk3SKDqpK2QPDFqGdLekKWFcHs8rvou0hV4TxFy.ylL8PTBo5a"));
  422. }
  423. @Test
  424. public void testBCrypt() {
  425. BCryptPasswordEncoder encoder1 = new BCryptPasswordEncoder(4);
  426. BCryptPasswordEncoder encoder2 = new BCryptPasswordEncoder(4);
  427. String pwd = "$2a$10$oAWnGIHR2Cvc0BsMN7YCtOjvXsBLBygYxiVG3E1fuUmhM3sEOYhQe";
  428. System.out.println(encoder1.matches("123456", pwd));
  429. System.out.println(encoder2.matches("123456", pwd));
  430. System.out.println(encoder1.matches("1234561", pwd));
  431. System.out.println(encoder2.matches("1234561", pwd));
  432. long encode1 = 0;
  433. long match1 = 0;
  434. for (int i = 0; i < 10; i++) {
  435. long t = System.currentTimeMillis();
  436. encoder1.encode("123456");
  437. encode1 += System.currentTimeMillis() - t;
  438. t = System.currentTimeMillis();
  439. encoder1.matches("123456", pwd);
  440. match1 += System.currentTimeMillis() - t;
  441. }
  442. System.out.println("avg encode = " + encode1 / 10 + "ms");
  443. System.out.println("avg match = " + match1 / 10 + "ms");
  444. long encode2 = 0;
  445. long match2 = 0;
  446. for (int i = 0; i < 10; i++) {
  447. long t = System.currentTimeMillis();
  448. encoder2.encode("123456");
  449. encode2 += System.currentTimeMillis() - t;
  450. t = System.currentTimeMillis();
  451. encoder2.matches("123456", pwd);
  452. match2 += System.currentTimeMillis() - t;
  453. }
  454. System.out.println("avg encode = " + encode2 / 10 + "ms");
  455. System.out.println("avg match = " + match2 / 10 + "ms");
  456. }
  457. @Test
  458. public void testParseToken() {
  459. long t1 = 0;
  460. long t2 = 0;
  461. for (int i = 0; i < 1000; i++) {
  462. long t = System.currentTimeMillis();
  463. String token = Jwts.builder()
  464. .setClaims(new HashMap<>())
  465. .setSubject("a" + i)
  466. .setIssuedAt(new Date())
  467. .setExpiration(new Date(new Date().getTime() + 10000000))
  468. .signWith(SignatureAlgorithm.HS256, "123456")
  469. .compact();
  470. t1 += System.currentTimeMillis() - t;
  471. System.out.println(token);
  472. t = System.currentTimeMillis();
  473. Claims claims = Jwts.parser()
  474. .setSigningKey("123456")
  475. .parseClaimsJws(token)
  476. .getBody();
  477. System.out.println(claims.getSubject());
  478. t2 += System.currentTimeMillis() - t;
  479. }
  480. System.out.println(t1);
  481. System.out.println(t2);
  482. System.out.println(t1 / 1000);
  483. System.out.println(t2 / 1000);
  484. }
  485. @Test
  486. public void testHashCode() {
  487. long t = System.currentTimeMillis();
  488. new PageQuery().hashCode();
  489. System.out.println(System.currentTimeMillis() - t);
  490. }
  491. @Test
  492. public void testAuth() {
  493. IdentityAuthService.validate ("班祥佳", "17025596046", "45213119921012413X");
  494. }
  495. }