Showing
8 changed files
with
69 additions
and
36 deletions
@@ -5,9 +5,11 @@ package com.xkl; | @@ -5,9 +5,11 @@ package com.xkl; | ||
5 | */ | 5 | */ |
6 | public interface Constants { | 6 | public interface Constants { |
7 | 7 | ||
8 | -// String URL_PREFIX = "http://127.0.0.1:8090"; | 8 | + // String URL_PREFIX = "http://127.0.0.1:8090"; |
9 | // String URL_PREFIX = "http://139.129.166.85:8090"; | 9 | // String URL_PREFIX = "http://139.129.166.85:8090"; |
10 | String URL_PREFIX = "https://www.hanhezy.com:8090/"; | 10 | String URL_PREFIX = "https://www.hanhezy.com:8090/"; |
11 | 11 | ||
12 | String KEY = "weixin"; | 12 | String KEY = "weixin"; |
13 | + String KEY_ID = "1"; | ||
14 | + | ||
13 | } | 15 | } |
@@ -27,9 +27,8 @@ public class OpenIdTest { | @@ -27,9 +27,8 @@ public class OpenIdTest { | ||
27 | params.put("password",EncodeTools.encode("MD5","pass1")); | 27 | params.put("password",EncodeTools.encode("MD5","pass1")); |
28 | params.put("openId","abcdefghijklmnopqrstuvwxyz123456"); | 28 | params.put("openId","abcdefghijklmnopqrstuvwxyz123456"); |
29 | params.put("openIdType","0"); | 29 | params.put("openIdType","0"); |
30 | - | ||
31 | params.put("t",HttpTools.getNow()); | 30 | params.put("t",HttpTools.getNow()); |
32 | - params.put("type","1"); | 31 | + params.put("type",Constants.KEY_ID); |
33 | params.put("sign",HttpTools.getSign(params)); | 32 | params.put("sign",HttpTools.getSign(params)); |
34 | String response = HttpTools.requestByMap(URL_OPEN_ID,"POST",params); | 33 | String response = HttpTools.requestByMap(URL_OPEN_ID,"POST",params); |
35 | return response; | 34 | return response; |
@@ -47,7 +46,7 @@ public class OpenIdTest { | @@ -47,7 +46,7 @@ public class OpenIdTest { | ||
47 | params.put("openIdType","0"); | 46 | params.put("openIdType","0"); |
48 | 47 | ||
49 | params.put("t",HttpTools.getNow()); | 48 | params.put("t",HttpTools.getNow()); |
50 | - params.put("type","1"); | 49 | + params.put("type",Constants.KEY_ID); |
51 | params.put("sign",HttpTools.getSign(params)); | 50 | params.put("sign",HttpTools.getSign(params)); |
52 | String response = HttpTools.requestByMap(URL_OPEN_ID,"DELETE",params); | 51 | String response = HttpTools.requestByMap(URL_OPEN_ID,"DELETE",params); |
53 | System.out.println(response); | 52 | System.out.println(response); |
@@ -68,7 +67,7 @@ public class OpenIdTest { | @@ -68,7 +67,7 @@ public class OpenIdTest { | ||
68 | params.put("openIdType",openIdType); | 67 | params.put("openIdType",openIdType); |
69 | 68 | ||
70 | params.put("t",HttpTools.getNow()); | 69 | params.put("t",HttpTools.getNow()); |
71 | - params.put("type","1"); | 70 | + params.put("type",Constants.KEY_ID); |
72 | params.put("sign",HttpTools.getSign(params)); | 71 | params.put("sign",HttpTools.getSign(params)); |
73 | String response = HttpTools.requestByMap(URL_LOGIN,"POST",params); | 72 | String response = HttpTools.requestByMap(URL_LOGIN,"POST",params); |
74 | 73 |
@@ -34,7 +34,7 @@ public class ReportTest { | @@ -34,7 +34,7 @@ public class ReportTest { | ||
34 | public void testList(){ | 34 | public void testList(){ |
35 | Map<String,String> params = new HashMap<String, String>(); | 35 | Map<String,String> params = new HashMap<String, String>(); |
36 | params.put("t",HttpTools.getNow()); | 36 | params.put("t",HttpTools.getNow()); |
37 | - params.put("type","1"); | 37 | + params.put("type",Constants.KEY_ID); |
38 | params.put("sign",HttpTools.getSign(params)); | 38 | params.put("sign",HttpTools.getSign(params)); |
39 | String response = HttpTools.requestByMapWithToken(URL_REPORT_LIST,"GET",params,token); | 39 | String response = HttpTools.requestByMapWithToken(URL_REPORT_LIST,"GET",params,token); |
40 | System.out.println(response); | 40 | System.out.println(response); |
@@ -46,39 +46,25 @@ public class ReportTest { | @@ -46,39 +46,25 @@ public class ReportTest { | ||
46 | @Test | 46 | @Test |
47 | public void testDetail(){ | 47 | public void testDetail(){ |
48 | Map<String,String> params = new HashMap<String, String>(); | 48 | Map<String,String> params = new HashMap<String, String>(); |
49 | - params.put("report_id","77"); | 49 | + params.put("report_id","141"); |
50 | params.put("t",HttpTools.getNow()); | 50 | params.put("t",HttpTools.getNow()); |
51 | - params.put("type","1"); | 51 | + params.put("type",Constants.KEY_ID); |
52 | params.put("sign",HttpTools.getSign(params)); | 52 | params.put("sign",HttpTools.getSign(params)); |
53 | String response = HttpTools.requestByMapWithToken(URL_REPORT_DETAIL,"GET",params,token); | 53 | String response = HttpTools.requestByMapWithToken(URL_REPORT_DETAIL,"GET",params,token); |
54 | System.out.println(response); | 54 | System.out.println(response); |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | - * 健康评分接口 | ||
59 | - */ | ||
60 | - @Test | ||
61 | - public void testScore(){ | ||
62 | - Map<String,String> params = new HashMap<String, String>(); | ||
63 | - params.put("report_id","77"); | ||
64 | - params.put("t",HttpTools.getNow()); | ||
65 | - params.put("type","1"); | ||
66 | - params.put("sign",HttpTools.getSign(params)); | ||
67 | - String response = HttpTools.requestByMap(URL_REPORT_SCORE,"GET",params); | ||
68 | - System.out.println(response); | ||
69 | - } | ||
70 | - | ||
71 | - /** | ||
72 | * 体检报告指标解释查询接口 | 58 | * 体检报告指标解释查询接口 |
73 | */ | 59 | */ |
74 | @Test | 60 | @Test |
75 | public void testItemInfo(){ | 61 | public void testItemInfo(){ |
76 | Map<String,String> params = new HashMap<String, String>(); | 62 | Map<String,String> params = new HashMap<String, String>(); |
77 | params.put("itemId","10"); | 63 | params.put("itemId","10"); |
78 | - params.put("status","0"); | 64 | + params.put("status","2"); |
79 | params.put("isPureHtml","false"); | 65 | params.put("isPureHtml","false"); |
80 | params.put("t",HttpTools.getNow()); | 66 | params.put("t",HttpTools.getNow()); |
81 | - params.put("type","1"); | 67 | + params.put("type",Constants.KEY_ID); |
82 | params.put("sign",HttpTools.getSign(params)); | 68 | params.put("sign",HttpTools.getSign(params)); |
83 | String response = HttpTools.requestByMapWithToken(URL_ITEM_INFO,"GET",params,token); | 69 | String response = HttpTools.requestByMapWithToken(URL_ITEM_INFO,"GET",params,token); |
84 | System.out.println(response); | 70 | System.out.println(response); |
@@ -94,7 +80,7 @@ public class ReportTest { | @@ -94,7 +80,7 @@ public class ReportTest { | ||
94 | params.put("status","1"); | 80 | params.put("status","1"); |
95 | params.put("isPureHtml","true"); | 81 | params.put("isPureHtml","true"); |
96 | params.put("t",HttpTools.getNow()); | 82 | params.put("t",HttpTools.getNow()); |
97 | - params.put("type","1"); | 83 | + params.put("type",Constants.KEY_ID); |
98 | params.put("sign",HttpTools.getSign(params)); | 84 | params.put("sign",HttpTools.getSign(params)); |
99 | String response = HttpTools.requestByMapWithToken(URL_ITEM_INFO,"GET",params,token); | 85 | String response = HttpTools.requestByMapWithToken(URL_ITEM_INFO,"GET",params,token); |
100 | System.out.println(response); | 86 | System.out.println(response); |
@@ -110,7 +96,7 @@ public class ReportTest { | @@ -110,7 +96,7 @@ public class ReportTest { | ||
110 | params.put("stime","2010-01-01 10:32:00"); | 96 | params.put("stime","2010-01-01 10:32:00"); |
111 | params.put("etime","2019-12-22 10:32:00"); | 97 | params.put("etime","2019-12-22 10:32:00"); |
112 | params.put("t",HttpTools.getNow()); | 98 | params.put("t",HttpTools.getNow()); |
113 | - params.put("type","1"); | 99 | + params.put("type",Constants.KEY_ID); |
114 | params.put("sign",HttpTools.getSign(params)); | 100 | params.put("sign",HttpTools.getSign(params)); |
115 | String response = HttpTools.requestByMapWithToken(URL_ITEM_GRAPH,"GET",params,token); | 101 | String response = HttpTools.requestByMapWithToken(URL_ITEM_GRAPH,"GET",params,token); |
116 | System.out.println(response); | 102 | System.out.println(response); |
@@ -124,7 +110,7 @@ public class ReportTest { | @@ -124,7 +110,7 @@ public class ReportTest { | ||
124 | Map<String,String> params = new HashMap<String, String>(); | 110 | Map<String,String> params = new HashMap<String, String>(); |
125 | params.put("report_id","77"); | 111 | params.put("report_id","77"); |
126 | params.put("t",HttpTools.getNow()); | 112 | params.put("t",HttpTools.getNow()); |
127 | - params.put("type","1"); | 113 | + params.put("type",Constants.KEY_ID); |
128 | params.put("sign",HttpTools.getSign(params)); | 114 | params.put("sign",HttpTools.getSign(params)); |
129 | String response = HttpTools.requestByMapWithToken(URL_COMPARE,"POST",params,token); | 115 | String response = HttpTools.requestByMapWithToken(URL_COMPARE,"POST",params,token); |
130 | System.out.println(response); | 116 | System.out.println(response); |
@@ -18,7 +18,7 @@ public class TokenTest { | @@ -18,7 +18,7 @@ public class TokenTest { | ||
18 | params.put("username",user); | 18 | params.put("username",user); |
19 | params.put("password",EncodeTools.encode("MD5",pass)); | 19 | params.put("password",EncodeTools.encode("MD5",pass)); |
20 | params.put("t",HttpTools.getNow()); | 20 | params.put("t",HttpTools.getNow()); |
21 | - params.put("type","1"); | 21 | + params.put("type",Constants.KEY_ID); |
22 | params.put("sign",HttpTools.getSign(params)); | 22 | params.put("sign",HttpTools.getSign(params)); |
23 | String response = HttpTools.requestByMap(URL_LOGIN,"POST",params); | 23 | String response = HttpTools.requestByMap(URL_LOGIN,"POST",params); |
24 | System.out.println("response:"+ response); | 24 | System.out.println("response:"+ response); |
@@ -43,7 +43,7 @@ public class TokenTest { | @@ -43,7 +43,7 @@ public class TokenTest { | ||
43 | String token = loginAndGetToken("user1","pass1"); | 43 | String token = loginAndGetToken("user1","pass1"); |
44 | Map<String,String> params = new HashMap<String, String>(); | 44 | Map<String,String> params = new HashMap<String, String>(); |
45 | params.put("t",HttpTools.getNow()); | 45 | params.put("t",HttpTools.getNow()); |
46 | - params.put("type","1"); | 46 | + params.put("type",Constants.KEY_ID); |
47 | params.put("sign",HttpTools.getSign(params)); | 47 | params.put("sign",HttpTools.getSign(params)); |
48 | String response = HttpTools.requestByMapWithToken(URL_LOGIN,"DELETE",params,token); | 48 | String response = HttpTools.requestByMapWithToken(URL_LOGIN,"DELETE",params,token); |
49 | System.out.println(response); | 49 | System.out.println(response); |
@@ -32,7 +32,7 @@ public class UserInfoTest { | @@ -32,7 +32,7 @@ public class UserInfoTest { | ||
32 | Map<String,String> params = new HashMap<String, String>(); | 32 | Map<String,String> params = new HashMap<String, String>(); |
33 | params.put("password",EncodeTools.encode("MD5","pass152_new")); | 33 | params.put("password",EncodeTools.encode("MD5","pass152_new")); |
34 | params.put("t",HttpTools.getNow()); | 34 | params.put("t",HttpTools.getNow()); |
35 | - params.put("type","1"); | 35 | + params.put("type",Constants.KEY_ID); |
36 | params.put("sign",HttpTools.getSign(params)); | 36 | params.put("sign",HttpTools.getSign(params)); |
37 | //获取token | 37 | //获取token |
38 | String token = loginAndGetToken("15211112222","pass152"); | 38 | String token = loginAndGetToken("15211112222","pass152"); |
@@ -48,7 +48,7 @@ public class UserInfoTest { | @@ -48,7 +48,7 @@ public class UserInfoTest { | ||
48 | public void testGetUserInfo(){ | 48 | public void testGetUserInfo(){ |
49 | Map<String,String> params = new HashMap<String, String>(); | 49 | Map<String,String> params = new HashMap<String, String>(); |
50 | params.put("t",HttpTools.getNow()); | 50 | params.put("t",HttpTools.getNow()); |
51 | - params.put("type","1"); | 51 | + params.put("type",Constants.KEY_ID); |
52 | params.put("sign",HttpTools.getSign(params)); | 52 | params.put("sign",HttpTools.getSign(params)); |
53 | //获取token | 53 | //获取token |
54 | String token = loginAndGetToken("user1","pass1"); | 54 | String token = loginAndGetToken("user1","pass1"); |
@@ -62,7 +62,7 @@ public class UserInfoTest { | @@ -62,7 +62,7 @@ public class UserInfoTest { | ||
62 | params.put("username",user); | 62 | params.put("username",user); |
63 | params.put("password",EncodeTools.encode("MD5",pass)); | 63 | params.put("password",EncodeTools.encode("MD5",pass)); |
64 | params.put("t",HttpTools.getNow()); | 64 | params.put("t",HttpTools.getNow()); |
65 | - params.put("type","1"); | 65 | + params.put("type",Constants.KEY_ID); |
66 | params.put("sign",HttpTools.getSign(params)); | 66 | params.put("sign",HttpTools.getSign(params)); |
67 | String response = HttpTools.requestByMap(URL_USER,"POST",params); | 67 | String response = HttpTools.requestByMap(URL_USER,"POST",params); |
68 | System.out.println(response); | 68 | System.out.println(response); |
@@ -77,7 +77,7 @@ public class UserInfoTest { | @@ -77,7 +77,7 @@ public class UserInfoTest { | ||
77 | params.put("username","15211112222"); | 77 | params.put("username","15211112222"); |
78 | params.put("password",EncodeTools.encode("MD5","pass152")); | 78 | params.put("password",EncodeTools.encode("MD5","pass152")); |
79 | params.put("t",HttpTools.getNow()); | 79 | params.put("t",HttpTools.getNow()); |
80 | - params.put("type","1"); | 80 | + params.put("type",Constants.KEY_ID); |
81 | params.put("sign","nosign"); | 81 | params.put("sign","nosign"); |
82 | String response = HttpTools.requestByMap(URL_USER,"POST",params); | 82 | String response = HttpTools.requestByMap(URL_USER,"POST",params); |
83 | System.out.println(response); | 83 | System.out.println(response); |
@@ -92,7 +92,7 @@ public class UserInfoTest { | @@ -92,7 +92,7 @@ public class UserInfoTest { | ||
92 | params.put("username","15211112222"); | 92 | params.put("username","15211112222"); |
93 | params.put("password",EncodeTools.encode("MD5","pass152")); | 93 | params.put("password",EncodeTools.encode("MD5","pass152")); |
94 | params.put("t",HttpTools.getNow()+100000); | 94 | params.put("t",HttpTools.getNow()+100000); |
95 | - params.put("type","1"); | 95 | + params.put("type",Constants.KEY_ID); |
96 | params.put("sign",HttpTools.getSign(params)); | 96 | params.put("sign",HttpTools.getSign(params)); |
97 | String response = HttpTools.requestByMap(URL_USER,"POST",params); | 97 | String response = HttpTools.requestByMap(URL_USER,"POST",params); |
98 | System.out.println(response); | 98 | System.out.println(response); |
1 | +package com.xkl.inneruse; | ||
2 | + | ||
3 | +import com.xkl.Constants; | ||
4 | +import com.xkl.HttpTools; | ||
5 | +import org.junit.BeforeClass; | ||
6 | +import org.junit.Test; | ||
7 | + | ||
8 | +import java.util.HashMap; | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +import static com.xkl.TokenTest.loginAndGetToken; | ||
12 | + | ||
13 | +/** | ||
14 | + * Created by win7 on 2016/12/26. | ||
15 | + * 报告相关 | ||
16 | + */ | ||
17 | +public class ReportTest { | ||
18 | + private static final String URL_REPORT_LIST = Constants.URL_PREFIX + "/report/list"; | ||
19 | + private static final String URL_REPORT_DETAIL = Constants.URL_PREFIX + "/report/detail"; | ||
20 | + private static final String URL_REPORT_SCORE = Constants.URL_PREFIX + "/report/score"; | ||
21 | + private static final String URL_ITEM_INFO = Constants.URL_PREFIX + "/report/itemInfo"; | ||
22 | + private static final String URL_ITEM_GRAPH = Constants.URL_PREFIX + "/report/itemGraph"; | ||
23 | + private static final String URL_COMPARE = Constants.URL_PREFIX + "/report/compare"; | ||
24 | + private static String token; | ||
25 | + | ||
26 | + @BeforeClass | ||
27 | + public static void init(){ | ||
28 | + token = loginAndGetToken("user1","pass1"); | ||
29 | +// String token =OpenIdTest.bindWithOpenIdAndLoginAndGetToken("abcdefghijklmnopqrstuvwxyz123456","0"); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * 健康评分接口 | ||
34 | + */ | ||
35 | + @Test | ||
36 | + public void testScore(){ | ||
37 | + Map<String,String> params = new HashMap<String, String>(); | ||
38 | + params.put("report_id","77"); | ||
39 | + params.put("t",HttpTools.getNow()); | ||
40 | + params.put("type",Constants.KEY_ID); | ||
41 | + params.put("sign",HttpTools.getSign(params)); | ||
42 | + String response = HttpTools.requestByMap(URL_REPORT_SCORE,"GET",params); | ||
43 | + System.out.println(response); | ||
44 | + } | ||
45 | + | ||
46 | +} |
@@ -45,7 +45,7 @@ public class ReportTest { | @@ -45,7 +45,7 @@ public class ReportTest { | ||
45 | public void testDelReport() { | 45 | public void testDelReport() { |
46 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); | 46 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); |
47 | Map<String, String> params = new HashMap<String, String>(); | 47 | Map<String, String> params = new HashMap<String, String>(); |
48 | - params.put("report_id", "107"); | 48 | + params.put("report_id", "143"); |
49 | String response = HttpTools.requestByMapWithToken(URL_REPORT, "DELETE", params, token); | 49 | String response = HttpTools.requestByMapWithToken(URL_REPORT, "DELETE", params, token); |
50 | System.out.println("delete report:" + response); | 50 | System.out.println("delete report:" + response); |
51 | } | 51 | } |
-
Please register or login to post a comment