From 82b713d4bae77c3c44de5f4dcce6b30b534c017c Mon Sep 17 00:00:00 2001 From: Liuchy1 Date: Tue, 4 Aug 2015 17:46:34 +0800 Subject: [PATCH 1/2] add schedule test ane example --- README.md | 121 ++++++++++-------- .../jpush/api/examples/ScheduleExample.java | 118 +++++++++++++++++ .../common/connection/NativeHttpClient.java | 4 + .../cn/jpush/api/schedule/ScheduleClient.java | 21 ++- .../api/schedule/ScheduleListResult.java | 16 +++ .../cn/jpush/api/schedule/ScheduleResult.java | 20 +++ .../api/schedule/ScheduleClientTest.java | 87 +++++++++---- .../schedule/model/SchedulePayloadTest.java | 42 ++++++ .../schedule/model/TriggerPayloadTest.java | 57 +++++++++ 9 files changed, 410 insertions(+), 76 deletions(-) create mode 100644 example/main/java/cn/jpush/api/examples/ScheduleExample.java create mode 100644 src/test/java/cn/jpush/api/schedule/model/SchedulePayloadTest.java diff --git a/README.md b/README.md index 005ab260..4f1f4078 100644 --- a/README.md +++ b/README.md @@ -87,27 +87,26 @@ > 以下片断来自项目代码里的文件:example / cn.jpush.api.examples.PushExample ```Java - JPushClient jpushClient = new JPushClient(masterSecret, appKey, 3); - - // For push, all you need do is to build PushPayload object. - PushPayload payload = buildPushObject_all_all_alert(); - - try { - PushResult result = jpushClient.sendPush(payload); - LOG.info("Got result - " + result); - - } catch (APIConnectionException e) { - // Connection error, should retry later - LOG.error("Connection error, should retry later", e); - - } catch (APIRequestException e) { - // Should review the error, and fix the request - LOG.error("Should review the error, and fix the request", e); - LOG.info("HTTP Status: " + e.getStatus()); - LOG.info("Error Code: " + e.getErrorCode()); - LOG.info("Error Message: " + e.getErrorMessage()); - } + JPushClient jpushClient = new JPushClient(masterSecret, appKey, 3); + // For push, all you need do is to build PushPayload object. + PushPayload payload = buildPushObject_all_all_alert(); + + try { + PushResult result = jpushClient.sendPush(payload); + LOG.info("Got result - " + result); + + } catch (APIConnectionException e) { + // Connection error, should retry later + LOG.error("Connection error, should retry later", e); + + } catch (APIRequestException e) { + // Should review the error, and fix the request + LOG.error("Should review the error, and fix the request", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } ``` 进行推送的关键在于构建一个 PushPayload 对象。以下示例一般的构建对象的用法。 @@ -190,22 +189,22 @@ > 以下片断来自项目代码里的文件:example / cn.jpush.api.examples.ReportsExample ```Java - JPushClient jpushClient = new JPushClient(masterSecret, appKey); - try { - ReceivedsResult result = jpushClient.getReportReceiveds("1942377665"); - LOG.debug("Got result - " + result); - - } catch (APIConnectionException e) { - // Connection error, should retry later - LOG.error("Connection error, should retry later", e); - - } catch (APIRequestException e) { - // Should review the error, and fix the request - LOG.error("Should review the error, and fix the request", e); - LOG.info("HTTP Status: " + e.getStatus()); - LOG.info("Error Code: " + e.getErrorCode()); - LOG.info("Error Message: " + e.getErrorMessage()); - } + JPushClient jpushClient = new JPushClient(masterSecret, appKey); + try { + ReceivedsResult result = jpushClient.getReportReceiveds("1942377665"); + LOG.debug("Got result - " + result); + + } catch (APIConnectionException e) { + // Connection error, should retry later + LOG.error("Connection error, should retry later", e); + + } catch (APIRequestException e) { + // Should review the error, and fix the request + LOG.error("Should review the error, and fix the request", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } ``` ### Tag/Alias 样例 @@ -213,19 +212,39 @@ > 以下片断来自项目代码里的文件:example / cn.jpush.api.examples.DeviceExample ```Java - try { - TagAliasResult result = jpushClient.getDeviceTagAlias(REGISTRATION_ID1); - - LOG.info(result.alias); - LOG.info(result.tags.toString()); - - } catch (APIConnectionException e) { - LOG.error("Connection error. Should retry later. ", e); - - } catch (APIRequestException e) { - LOG.error("Error response from JPush server. Should review and fix it. ", e); - LOG.info("HTTP Status: " + e.getStatus()); - LOG.info("Error Code: " + e.getErrorCode()); - LOG.info("Error Message: " + e.getErrorMessage()); - } + try { + TagAliasResult result = jpushClient.getDeviceTagAlias(REGISTRATION_ID1); + + LOG.info(result.alias); + LOG.info(result.tags.toString()); + } catch (APIConnectionException e) { + LOG.error("Connection error. Should retry later. ", e); + } catch (APIRequestException e) { + LOG.error("Error response from JPush server. Should review and fix it. ", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } +``` + +### Schedule 样例 + +> 以下片断来自项目代码里的文件:example / cn.jpush.api.examples.ScheduleExample + +```Java + JPushClient jpushClient = new JPushClient(masterSecret, appKey); + String name = "test_schedule_example"; + String time = "2016-07-30 12:30:25"; + PushPayload push = PushPayload.alertAll("test schedule example."); + try { + ScheduleResult result = jpushClient.createSingleSchedule(name, time, push); + LOG.info("schedule result is " + result); + } catch (APIConnectionException e) { + LOG.error("Connection error. Should retry later. ", e); + } catch (APIRequestException e) { + LOG.error("Error response from JPush server. Should review and fix it. ", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } ``` diff --git a/example/main/java/cn/jpush/api/examples/ScheduleExample.java b/example/main/java/cn/jpush/api/examples/ScheduleExample.java new file mode 100644 index 00000000..3141bb5f --- /dev/null +++ b/example/main/java/cn/jpush/api/examples/ScheduleExample.java @@ -0,0 +1,118 @@ +package cn.jpush.api.examples; + +import cn.jpush.api.JPushClient; +import cn.jpush.api.common.resp.APIConnectionException; +import cn.jpush.api.common.resp.APIRequestException; +import cn.jpush.api.push.model.PushPayload; +import cn.jpush.api.schedule.ScheduleListResult; +import cn.jpush.api.schedule.ScheduleResult; +import cn.jpush.api.schedule.model.SchedulePayload; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ScheduleExample { + + protected static final Logger LOG = LoggerFactory.getLogger(ScheduleExample.class); + + private static final String appKey ="e5c0d34f58732cf09b2d4d74"; + private static final String masterSecret = "4cdda6d3c8b029941dbc5cb3"; + + public static void main(String[] args) { + +// testDeleteSchedule(); + testGetScheduleList(); +// testUpdateSchedule(); + testGetSchedule(); + } + + public static void testCreateSingleSchedule() { + JPushClient jpushClient = new JPushClient(masterSecret, appKey); + String name = "test_schedule_example"; + String time = "2016-07-30 12:30:25"; + PushPayload push = PushPayload.alertAll("test schedule example."); + try { + ScheduleResult result = jpushClient.createSingleSchedule(name, time, push); + LOG.info("schedule result is " + result); + } catch (APIConnectionException e) { + LOG.error("Connection error. Should retry later. ", e); + } catch (APIRequestException e) { + LOG.error("Error response from JPush server. Should review and fix it. ", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } + } + + public static void testDeleteSchedule() { + String scheduleId = "95bbd066-3a88-11e5-8e62-0021f652c102"; + JPushClient jpushClient = new JPushClient(masterSecret, appKey); + + try { + jpushClient.deleteSchedule(scheduleId); + } catch (APIConnectionException e) { + LOG.error("Connection error. Should retry later. ", e); + } catch (APIRequestException e) { + LOG.error("Error response from JPush server. Should review and fix it. ", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } + } + + public static void testGetScheduleList() { + int page = 1; + JPushClient jpushClient = new JPushClient(masterSecret, appKey); + + try { + ScheduleListResult list = jpushClient.getScheduleList(page); + LOG.info("total " + list.getTotal_count()); + for(ScheduleResult s : list.getSchedules()) { + LOG.info(s.toString()); + } + } catch (APIConnectionException e) { + LOG.error("Connection error. Should retry later. ", e); + } catch (APIRequestException e) { + LOG.error("Error response from JPush server. Should review and fix it. ", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } + } + + public static void testUpdateSchedule() { + String scheduleId = "95bbd066-3a88-11e5-8e62-0021f652c102"; + JPushClient jpushClient = new JPushClient(masterSecret, appKey); + SchedulePayload payload = SchedulePayload.newBuilder() + .setEnabled(false) + .build(); + try { + jpushClient.updateSchedule(scheduleId, payload); + } catch (APIConnectionException e) { + LOG.error("Connection error. Should retry later. ", e); + } catch (APIRequestException e) { + LOG.error("Error response from JPush server. Should review and fix it. ", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } + } + + public static void testGetSchedule() { + String scheduleId = "95bbd066-3a88-11e5-8e62-0021f652c102"; + JPushClient jpushClient = new JPushClient(masterSecret, appKey); + + try { + ScheduleResult result = jpushClient.getSchedule(scheduleId); + LOG.info("schedule " + result); + } catch (APIConnectionException e) { + LOG.error("Connection error. Should retry later. ", e); + } catch (APIRequestException e) { + LOG.error("Error response from JPush server. Should review and fix it. ", e); + LOG.info("HTTP Status: " + e.getStatus()); + LOG.info("Error Code: " + e.getErrorCode()); + LOG.info("Error Message: " + e.getErrorMessage()); + } + } + + +} diff --git a/src/main/java/cn/jpush/api/common/connection/NativeHttpClient.java b/src/main/java/cn/jpush/api/common/connection/NativeHttpClient.java index a3c0ced1..eb52944d 100644 --- a/src/main/java/cn/jpush/api/common/connection/NativeHttpClient.java +++ b/src/main/java/cn/jpush/api/common/connection/NativeHttpClient.java @@ -208,6 +208,10 @@ private ResponseWrapper _doRequest(String url, String content, LOG.error("Request is forbidden! Maybe your appkey is listed in blacklist or your params is invalid."); wrapper.setErrorObject(); break; + case 404: + LOG.error("Request page is not found! Maybe your params is invalid."); + wrapper.setErrorObject(); + break; case 410: LOG.error("Request resource is no longer in service. Please according to notice on official website."); wrapper.setErrorObject(); diff --git a/src/main/java/cn/jpush/api/schedule/ScheduleClient.java b/src/main/java/cn/jpush/api/schedule/ScheduleClient.java index d475b54d..3219e748 100644 --- a/src/main/java/cn/jpush/api/schedule/ScheduleClient.java +++ b/src/main/java/cn/jpush/api/schedule/ScheduleClient.java @@ -9,11 +9,11 @@ import cn.jpush.api.common.resp.APIRequestException; import cn.jpush.api.common.resp.ResponseWrapper; import cn.jpush.api.schedule.model.SchedulePayload; +import cn.jpush.api.utils.Preconditions; +import cn.jpush.api.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.Proxy; - public class ScheduleClient { private static final Logger LOG = LoggerFactory.getLogger(ScheduleClient.class); @@ -52,28 +52,43 @@ public ScheduleClient(String masterSecret, String appKey, int maxRetryTimes, Htt } public ScheduleResult createSchedule(SchedulePayload payload) throws APIConnectionException, APIRequestException { + + Preconditions.checkArgument(null != payload, "payload should not be null"); + ResponseWrapper response = _httpClient.sendPost(hostName + schedulePath, payload.toString()); return ScheduleResult.fromResponse(response, ScheduleResult.class); } public ScheduleListResult getScheduleList(int page) throws APIConnectionException, APIRequestException{ + + Preconditions.checkArgument(page > 0, "page should more than 0."); + ResponseWrapper response = _httpClient.sendGet(hostName + schedulePath + "?page=" + page); return ScheduleListResult.fromResponse(response, ScheduleListResult.class); } public ScheduleResult getSchedule(String scheduleId) throws APIConnectionException, APIRequestException{ - ResponseWrapper response = _httpClient.sendGet(hostName + schedulePath + "/" + scheduleId); + Preconditions.checkArgument(StringUtils.isNotEmpty(scheduleId), "scheduleId should not be empty"); + + ResponseWrapper response = _httpClient.sendGet(hostName + schedulePath + "/" + scheduleId); return ScheduleResult.fromResponse(response, ScheduleResult.class); } public ScheduleResult updateSchedule(String scheduleId, SchedulePayload payload) throws APIConnectionException, APIRequestException{ + + Preconditions.checkArgument(StringUtils.isNotEmpty(scheduleId), "scheduleId should not be empty"); + Preconditions.checkArgument(null != payload, "payload should not be null"); + ResponseWrapper response = _httpClient.sendPut(hostName + schedulePath + "/" + scheduleId, payload.toString()); return ScheduleResult.fromResponse(response, ScheduleResult.class); } public void deleteSchedule(String scheduleId) throws APIConnectionException, APIRequestException{ + + Preconditions.checkArgument(StringUtils.isNotEmpty(scheduleId), "scheduleId should not be empty"); + _httpClient.sendDelete(hostName + schedulePath + "/" + scheduleId); } diff --git a/src/main/java/cn/jpush/api/schedule/ScheduleListResult.java b/src/main/java/cn/jpush/api/schedule/ScheduleListResult.java index 0deeff14..eeda28db 100644 --- a/src/main/java/cn/jpush/api/schedule/ScheduleListResult.java +++ b/src/main/java/cn/jpush/api/schedule/ScheduleListResult.java @@ -12,4 +12,20 @@ public class ScheduleListResult extends BaseResult{ @Expose int total_pages; @Expose int page; @Expose List schedules; + + public int getTotal_count() { + return total_count; + } + + public int getTotal_pages() { + return total_pages; + } + + public int getPage() { + return page; + } + + public List getSchedules() { + return schedules; + } } diff --git a/src/main/java/cn/jpush/api/schedule/ScheduleResult.java b/src/main/java/cn/jpush/api/schedule/ScheduleResult.java index ceb0fbf9..50619aa4 100644 --- a/src/main/java/cn/jpush/api/schedule/ScheduleResult.java +++ b/src/main/java/cn/jpush/api/schedule/ScheduleResult.java @@ -11,4 +11,24 @@ public class ScheduleResult extends BaseResult{ @Expose Boolean enabled; @Expose JsonObject trigger; @Expose JsonObject push; + + public String getSchedule_id() { + return schedule_id; + } + + public String getName() { + return name; + } + + public Boolean getEnabled() { + return enabled; + } + + public JsonObject getTrigger() { + return trigger; + } + + public JsonObject getPush() { + return push; + } } diff --git a/src/test/java/cn/jpush/api/schedule/ScheduleClientTest.java b/src/test/java/cn/jpush/api/schedule/ScheduleClientTest.java index 34e827be..34e91579 100644 --- a/src/test/java/cn/jpush/api/schedule/ScheduleClientTest.java +++ b/src/test/java/cn/jpush/api/schedule/ScheduleClientTest.java @@ -4,6 +4,9 @@ import cn.jpush.api.SlowTests; import cn.jpush.api.common.resp.APIConnectionException; import cn.jpush.api.common.resp.APIRequestException; +import cn.jpush.api.push.model.PushPayload; +import cn.jpush.api.schedule.model.SchedulePayload; +import cn.jpush.api.schedule.model.TriggerPayload; import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -18,6 +21,9 @@ @Category(SlowTests.class) public class ScheduleClientTest extends BaseTest { + public static final int NOT_EXIST = 8104; + public static final int AUTH_FAILED = 8101; + public static final int INVALID_PARAM = 8100; private ScheduleClient client; @@ -26,14 +32,6 @@ public void before() { client = new ScheduleClient(MASTER_SECRET, APP_KEY); } - /** - * Method: createSchedule(SchedulePayload payload) - */ - @Test - public void testCreateSchedule() { -//TODO: Test goes here... - } - /** * Method: getScheduleList(int page) */ @@ -49,28 +47,73 @@ public void testGetScheduleList() { } } - /** - * Method: getSchedule(String scheduleId) - */ - @Test - public void testGetSchedule() { -//TODO: Test goes here... - } /** + * Method: createSchedule(SchedulePayload payload) + * Method: getSchedule(String scheduleId) * Method: updateSchedule(String scheduleId, SchedulePayload payload) + * Method: deleteSchedule(String scheduleId) */ @Test - public void testUpdateSchedule() { -//TODO: Test goes here... + public void testScheduleMethods() { + String name = "test_schedule"; + TriggerPayload trigger = TriggerPayload.newBuilder() + .setSingleTime("2105-07-30 12:00:00") + .buildSingle(); + + PushPayload push = PushPayload.alertAll("test schedule"); + + SchedulePayload payload = SchedulePayload.newBuilder() + .setName(name) + .setEnabled(true) + .setTrigger(trigger) + .setPush(push) + .build(); + + SchedulePayload update = SchedulePayload.newBuilder() + .setEnabled(false).build(); + + ScheduleResult result = null; + boolean success = false; + try { + result = client.createSchedule(payload); + Assert.assertNotNull("test createSchedule failed.", result); + + ScheduleResult getResult = client.getSchedule(result.schedule_id); + Assert.assertEquals("test getSchedule failed.", result.name, getResult.name); + + ScheduleResult updateResult = client.updateSchedule(result.schedule_id, update); + Assert.assertEquals("test updateSchedule failed.", false, updateResult.enabled); + + client.deleteSchedule(result.schedule_id); + Assert.assertTrue(true); + success = true; + + } catch (APIConnectionException e) { + e.printStackTrace(); + } catch (APIRequestException e) { + Assert.assertTrue(e.getErrorMessage(), false); + } finally { + if(!success && null != result) { + try { + client.deleteSchedule(result.schedule_id); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } - /** - * Method: deleteSchedule(String scheduleId) - */ @Test - public void testDeleteSchedule() { -//TODO: Test goes here... + public void testGetNotExist() { + try{ + client.getSchedule("test-not-exist"); + } catch (APIConnectionException e) { + e.printStackTrace(); + } catch (APIRequestException e) { + Assert.assertEquals(NOT_EXIST, e.getErrorCode()); + } } } diff --git a/src/test/java/cn/jpush/api/schedule/model/SchedulePayloadTest.java b/src/test/java/cn/jpush/api/schedule/model/SchedulePayloadTest.java new file mode 100644 index 00000000..0c77d97f --- /dev/null +++ b/src/test/java/cn/jpush/api/schedule/model/SchedulePayloadTest.java @@ -0,0 +1,42 @@ +package cn.jpush.api.schedule.model; + +import cn.jpush.api.FastTests; +import cn.jpush.api.push.model.PushPayload; +import com.google.gson.JsonObject; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +/** + * SchedulePayload Tester. + * + * @version 1.0 + */ +@Category(FastTests.class) +public class SchedulePayloadTest { + + @Test + public void testToJson() { + String name = "test_schedule"; + TriggerPayload trigger = TriggerPayload.newBuilder() + .setSingleTime("2015-07-25 12:20:30") + .buildSingle(); + + PushPayload push = PushPayload.alertAll("test schedule"); + SchedulePayload payload = SchedulePayload.newBuilder() + .setName(name) + .setEnabled(true) + .setTrigger(trigger) + .setPush(push) + .build(); + + JsonObject json = new JsonObject(); + json.addProperty("name", name); + json.addProperty("enabled", true); + json.add("trigger", trigger.toJSON()); + json.add("push", push.toJSON()); + + Assert.assertEquals("", json, payload.toJSON()); + } + +} diff --git a/src/test/java/cn/jpush/api/schedule/model/TriggerPayloadTest.java b/src/test/java/cn/jpush/api/schedule/model/TriggerPayloadTest.java index 96d0e044..7ecf7b6e 100644 --- a/src/test/java/cn/jpush/api/schedule/model/TriggerPayloadTest.java +++ b/src/test/java/cn/jpush/api/schedule/model/TriggerPayloadTest.java @@ -33,6 +33,38 @@ public void testBuildSingle() { Assert.assertEquals("", json, trigger.toJSON()); } + @Test(expected = IllegalArgumentException.class) + public void test_null_time() { + String time = null; + TriggerPayload trigger = TriggerPayload.newBuilder() + .setSingleTime(time) + .buildSingle(); + } + + @Test(expected = IllegalArgumentException.class) + public void test_empty_time() { + String time = ""; + TriggerPayload trigger = TriggerPayload.newBuilder() + .setSingleTime(time) + .buildSingle(); + } + + @Test(expected = IllegalArgumentException.class) + public void test_invalid_time() { + String time = "2015-07-32 10:12:23"; + TriggerPayload trigger = TriggerPayload.newBuilder() + .setSingleTime(time) + .buildSingle(); + } + + @Test(expected = IllegalArgumentException.class) + public void test_incorrect_time_format() { + String time = "2015-07-30T10:12:23"; + TriggerPayload trigger = TriggerPayload.newBuilder() + .setSingleTime(time) + .buildSingle(); + } + /** * Method: buildPeriodical() */ @@ -65,5 +97,30 @@ public void testBuildPeriodical() { } + @Test(expected = IllegalArgumentException.class) + public void test_null_start() { + String start = null; + String end = "2015-08-30 10:12:23"; + String time = "10:12:00"; + String[] point = {"MON", "TUE"}; + + TriggerPayload trigger = TriggerPayload.newBuilder() + .setPeriodTime(start, end, time) + .setTimeFrequency(TriggerPayload.TimeUnit.week, 2, point) + .buildPeriodical(); + } + + @Test(expected = IllegalArgumentException.class) + public void test_empty_end() { + String start = "2015-08-30 10:12:23"; + String end = ""; + String time = "10:12:00"; + String[] point = {"MON", "TUE"}; + + TriggerPayload trigger = TriggerPayload.newBuilder() + .setPeriodTime(start, end, time) + .setTimeFrequency(TriggerPayload.TimeUnit.week, 2, point) + .buildPeriodical(); + } } From 5102e0c16478104d09dfeb63bda1c66b563ba9b3 Mon Sep 17 00:00:00 2001 From: Liuchy1 Date: Tue, 4 Aug 2015 18:38:00 +0800 Subject: [PATCH 2/2] modify pom and doc --- pom.xml | 2 +- .../java/cn/jpush/api/schedule/model/TriggerPayload.java | 6 +++--- src/main/resources/javadoc-overview.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 50eb2825..5dd458ea 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ UTF-8 1.6 1.6 - -Xdoclint:none + diff --git a/src/main/java/cn/jpush/api/schedule/model/TriggerPayload.java b/src/main/java/cn/jpush/api/schedule/model/TriggerPayload.java index 376a3600..7cb6bdb0 100644 --- a/src/main/java/cn/jpush/api/schedule/model/TriggerPayload.java +++ b/src/main/java/cn/jpush/api/schedule/model/TriggerPayload.java @@ -93,7 +93,7 @@ public static class Builder{ /** * Setup time for single trigger. * @param time The execute time, format yyyy-MM-dd HH:mm:ss - * @return + * @return this Builder */ public Builder setSingleTime(String time) { this.time = time; @@ -106,7 +106,7 @@ public Builder setSingleTime(String time) { * @param start The start time, format yyyy-MM-dd HH:mm:ss * @param end The end time, format yyyy-MM-dd HH:mm:ss * @param time The execute time, format HH:mm:ss - * @return + * @return this Builder */ public Builder setPeriodTime(String start, String end, String time) { this.start = start; @@ -123,7 +123,7 @@ public Builder setPeriodTime(String start, String end, String time) { * If time unit is day, the point should be null. * If time unit is week, should be the abbreviation of the days. eg. {"MON", "TUE"} * If time unit is month, should be the date of the days. eg. {"01", "03"} - * @return + * @return this Builder */ public Builder setTimeFrequency(TimeUnit time_unit, int frequency, String[] point) { this.time_unit = time_unit; diff --git a/src/main/resources/javadoc-overview.html b/src/main/resources/javadoc-overview.html index 8abe99a1..7b36a45e 100644 --- a/src/main/resources/javadoc-overview.html +++ b/src/main/resources/javadoc-overview.html @@ -5,6 +5,6 @@ JPush API Java 客户端。 - 主要分为 2 个功能部分:推送、报表。 + 主要分为 4 个功能部分:推送、报表、Tag/Alias管理、定时任务管理