PublicApiTest.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package com.uas.ps.inquiry;
  2. import com.alibaba.fastjson.JSON;
  3. import com.uas.ps.inquiry.util.HttpUtil;
  4. import org.junit.Test;
  5. import java.util.HashMap;
  6. /**
  7. * @author dongbw
  8. * @since 2018年9月26日
  9. */
  10. public class PublicApiTest extends BaseJunitTest {
  11. /**
  12. * localhost
  13. */
  14. private static final String localhost = "http://10.1.51.82:24002";
  15. /**
  16. * dev
  17. */
  18. private static final String dev_url = "http://192.168.253.12:24000";
  19. /**
  20. * userUU
  21. */
  22. private static final Long userUU = 1000002503L;
  23. /**
  24. * enUU
  25. */
  26. private static final Long enUU = 10041166L;
  27. /**
  28. * /sum/publish/personal
  29. * @throws Exception
  30. */
  31. @Test
  32. public void sumPersonalPublish() throws Exception {
  33. HashMap<String, Object> params = new HashMap<>();
  34. params.put("useruu", userUU);
  35. params.put("enuu", enUU);
  36. params.put("starttime", System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2);
  37. params.put("endtime", System.currentTimeMillis());
  38. HttpUtil.Response res = HttpUtil.sendGetRequest(localhost+ "/inquiry/api/sum/publish/personal", params);
  39. System.out.println(JSON.toJSON(res));
  40. }
  41. /**
  42. * /sum/publish/enterprise
  43. * @throws Exception
  44. */
  45. @Test
  46. public void sumEnterprisePublish() throws Exception {
  47. HashMap<String, Object> params = new HashMap<>();
  48. params.put("enuu", enUU);
  49. params.put("starttime", System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2);
  50. params.put("endtime", System.currentTimeMillis());
  51. HttpUtil.Response res = HttpUtil.sendGetRequest("http://10.1.51.82:24002" + "/inquiry/api/sum/publish/enterprise", params);
  52. System.out.println(JSON.toJSON(res));
  53. }
  54. /**
  55. * /sum/reply/personal
  56. * @throws Exception
  57. */
  58. @Test
  59. public void sumPersonalReply() throws Exception {
  60. HashMap<String, Object> params = new HashMap<>();
  61. params.put("useruu", userUU);
  62. params.put("enuu", enUU);
  63. params.put("starttime", System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2);
  64. params.put("endtime", System.currentTimeMillis());
  65. HttpUtil.Response res = HttpUtil.sendGetRequest(localhost+ "/inquiry/api/sum/reply/personal", params);
  66. System.out.println(JSON.toJSON(res));
  67. }
  68. /**
  69. * /sum/reply/enterprise
  70. * @throws Exception
  71. */
  72. @Test
  73. public void sumEnterpriseReply() throws Exception {
  74. HashMap<String, Object> params = new HashMap<>();
  75. params.put("enuu", enUU);
  76. params.put("starttime", System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2);
  77. params.put("endtime", System.currentTimeMillis());
  78. HttpUtil.Response res = HttpUtil.sendGetRequest(localhost + "/inquiry/api/sum/reply/enterprise", params);
  79. System.out.println(JSON.toJSON(res));
  80. }
  81. /**
  82. * /sum/all/time
  83. * @throws Exception
  84. */
  85. @Test
  86. public void sumPublishWithTime() throws Exception {
  87. HttpUtil.Response res = HttpUtil.sendGetRequest(localhost + "/inquiry/api/sum/all/time?time=" + System.currentTimeMillis(), null);
  88. System.out.println(JSON.toJSON(res));
  89. }
  90. /**
  91. * /sum/all/scope
  92. * @throws Exception
  93. */
  94. @Test
  95. public void sumPublishWithTimeScope() throws Exception {
  96. HashMap<String, Object> params = new HashMap<>();
  97. params.put("starttime", System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 7);
  98. params.put("endtime", System.currentTimeMillis());
  99. HttpUtil.Response res = HttpUtil.sendGetRequest(localhost + "/inquiry/api/sum/all/scope", params);
  100. System.out.println(JSON.toJSON(res));
  101. }
  102. }