Skip to content

Commit 4dcdf4b

Browse files
xiezefanJaven
authored andcommitted
review the code. fix some spelling issue
1 parent f3914d8 commit 4dcdf4b

File tree

6 files changed

+51
-13
lines changed

6 files changed

+51
-13
lines changed

src/cn/jpush/api/JPushClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public PushResult sendPush(PushPayload pushPayload) throws APIConnectionExceptio
6868
*
6969
* Attention: globally settings cannot be affect this type of Push.
7070
*
71-
* @param pushPayload payload of a push.
71+
* @param payloadString payload of a push.
7272
* @return PushResult. Can be printed to a JSON.
7373
* @throws APIConnectionException
7474
* @throws APIRequestException

src/cn/jpush/api/common/IHttpClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public enum RequestMethod {
2222
DELETE
2323
}
2424

25-
public static final String IO_ERROR_MESSAGE = "Conneciton IO error. \n"
26-
+ "Chould not connect to JPush Server. "
25+
public static final String IO_ERROR_MESSAGE = "Connection IO error. \n"
26+
+ "Can not connect to JPush Server. "
2727
+ "Please ensure your internet connection is ok. \n"
2828
+ "If the problem persists, please let us know at support@jpush.cn.";
2929

src/cn/jpush/api/push/PushClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Can be used directly.
2020
*/
2121
public class PushClient {
22-
public static String HOST_NAME_SSL = "https://api.jpush.cn";
22+
public static final String HOST_NAME_SSL = "https://api.jpush.cn";
2323
public static final String PUSH_PATH = "/v3/push";
2424

2525
private final NativeHttpClient _httpClient;
@@ -58,17 +58,17 @@ public PushClient(String masterSecret, String appKey) {
5858
*
5959
* @param masterSecret API access secret of the appKey.
6060
* @param appKey The KEY of one application on JPush.
61-
* @param masxRetryTimes
61+
* @param maxRetryTimes max retry times
6262
*/
63-
public PushClient(String masterSecret, String appKey, int masxRetryTimes) {
63+
public PushClient(String masterSecret, String appKey, int maxRetryTimes) {
6464
this._masterSecret = masterSecret;
6565
this._appKey = appKey;
6666

6767
ServiceHelper.checkBasic(appKey, masterSecret);
6868

6969
this._authCode = ServiceHelper.getAuthorizationBase64(_appKey, _masterSecret);
7070
this._baseUrl = HOST_NAME_SSL + PUSH_PATH;
71-
this._httpClient = new NativeHttpClient(masxRetryTimes);
71+
this._httpClient = new NativeHttpClient(maxRetryTimes);
7272
}
7373

7474
/**

src/cn/jpush/api/push/model/Message.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public Builder addExtra(String key, Boolean value) {
132132

133133
public Message build() {
134134
Preconditions.checkArgument(! (null == msgContent),
135-
"msgConent should be set");
135+
"msgContent should be set");
136136
return new Message(title, msgContent, contentType,
137137
(null == extrasBuilder) ? null : extrasBuilder.build(),
138138
(null == numberExtrasBuilder) ? null : numberExtrasBuilder.build(),

src/cn/jpush/api/utils/StringUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ public static String encodeParam(String param) {
4848
return encodeParam;
4949
}
5050

51-
public static String arrayToString(String[] vlaues) {
52-
StringBuffer buffer = new StringBuffer(vlaues.length);
53-
if (vlaues != null) {
54-
for (int i = 0; i < vlaues.length; i++) {
55-
buffer.append(vlaues[i]).append(",");
51+
public static String arrayToString(String[] values) {
52+
StringBuffer buffer = new StringBuffer(values.length);
53+
if (values != null) {
54+
for (int i = 0; i < values.length; i++) {
55+
buffer.append(values[i]).append(",");
5656
}
5757
}
5858
if (buffer.length() > 0) {

test/cn/jpush/api/report/ReportFunctionTests.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.junit.Assert.*;
44

5+
import cn.jpush.api.common.TimeUnit;
56
import org.junit.Before;
67
import org.junit.Test;
78

@@ -33,5 +34,42 @@ public void getReceivedsFixed2() throws Exception {
3334
assertTrue(result.received_list.size() > 0);
3435
}
3536

37+
@Test
38+
public void getMessagesTest() throws Exception {
39+
MessagesResult result = jpushClient.getReportMessages("1613113584");
40+
assertTrue(result.isResultOK());
41+
assertTrue(result.messages.size() > 0);
42+
}
43+
44+
@Test
45+
public void getMessagesTest2() throws Exception {
46+
MessagesResult result = jpushClient.getReportMessages("1613113584, ,1229760629, ");
47+
assertTrue(result.isResultOK());
48+
assertTrue(result.messages.size() > 0);
49+
}
50+
51+
@Test
52+
public void getUsersTest() throws Exception {
53+
UsersResult result = jpushClient.getReportUsers(TimeUnit.MONTH, "2014-05", 1);
54+
assertTrue(result.isResultOK());
55+
assertTrue(result.items.size() > 0);
56+
}
57+
58+
@Test
59+
public void getUserTest2() throws Exception {
60+
UsersResult result = jpushClient.getReportUsers(TimeUnit.DAY, "2014-05-10", 5);
61+
assertTrue(result.isResultOK());
62+
assertTrue(result.items.size() > 0);
63+
}
64+
65+
@Test
66+
public void getUserTest3() throws Exception {
67+
UsersResult result = jpushClient.getReportUsers(TimeUnit.HOUR, "2014-05-10 06", 10);
68+
assertTrue(result.isResultOK());
69+
assertTrue(result.items.size() > 0);
70+
}
71+
72+
73+
3674
}
3775

0 commit comments

Comments
 (0)