diff --git a/pom.xml b/pom.xml
index 1a726a49..9ee04b4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
cn.jpush.api
jpush-client
- 3.7.6
+ 3.7.7
jar
https://github.com/jpush/jpush-api-java-client
JPush API Java Client
@@ -51,7 +51,7 @@
cn.jpush.api
jiguang-common
- 1.2.6
+ 1.2.7
org.apache.httpcomponents
diff --git a/src/main/java/cn/jpush/api/push/model/Notification3rd.java b/src/main/java/cn/jpush/api/push/model/Notification3rd.java
index 8a6f622b..ef78e8ad 100644
--- a/src/main/java/cn/jpush/api/push/model/Notification3rd.java
+++ b/src/main/java/cn/jpush/api/push/model/Notification3rd.java
@@ -14,7 +14,7 @@
* 使用说明
* notification_3rd 只针对开通了厂商通道的用户生效;
* notification 和 notification_3rd 不能同时有内容,如果这两块同时有内容,则会返回错误提示;
- * notification_3rd 的内容对 iOS 和 WinPhone 平台无效,只针对 Android 平台生效;
+ * notification_3rd 的内容对 iOS 和 HMOS 平台无效,只针对 Android 平台生效;
* notification_3rd 是用作补发厂商通知的内容,只有当 message 部分有内容,才允许传递此字段,且要两者都不为空时,才会对离线的厂商设备转发厂商通道的通知。
*/
public class Notification3rd implements PushModel{
diff --git a/src/main/java/cn/jpush/api/push/model/Platform.java b/src/main/java/cn/jpush/api/push/model/Platform.java
index 406bf35a..eddeff42 100644
--- a/src/main/java/cn/jpush/api/push/model/Platform.java
+++ b/src/main/java/cn/jpush/api/push/model/Platform.java
@@ -12,7 +12,7 @@
/**
* https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#platform
*
- * JPush 当前支持 Android, iOS, QuickApp,Windows Phone 四个平台的推送。其关键字分别为:"android", "ios", "quickapp","winphone"。
+ * JPush 当前支持 Android, iOS, QuickApp, HMOS 四个平台的推送。其关键字分别为:"android", "ios", "quickapp","hmos"。
* 使用方法,只需要在PushPayload中调用setPlatform方法。如:setPlatform(Platform.android_ios())
* 如需要全平台推送,只需要setPlatform(Platform.all())
*/
@@ -47,8 +47,8 @@ public static Platform quickapp() {
return newBuilder().addDeviceType(DeviceType.QuickApp).build();
}
- public static Platform winphone() {
- return newBuilder().addDeviceType(DeviceType.WinPhone).build();
+ public static Platform hmos() {
+ return newBuilder().addDeviceType(DeviceType.HMOS).build();
}
public static Platform android_ios() {
@@ -58,17 +58,17 @@ public static Platform android_ios() {
.build();
}
- public static Platform android_winphone() {
+ public static Platform android_hmos() {
return newBuilder()
.addDeviceType(DeviceType.Android)
- .addDeviceType(DeviceType.WinPhone)
+ .addDeviceType(DeviceType.HMOS)
.build();
}
- public static Platform ios_winphone() {
+ public static Platform ios_hmos() {
return newBuilder()
.addDeviceType(DeviceType.IOS)
- .addDeviceType(DeviceType.WinPhone)
+ .addDeviceType(DeviceType.HMOS)
.build();
}
@@ -86,10 +86,10 @@ public static Platform ios_quickapp() {
.build();
}
- public static Platform quickapp_winphone() {
+ public static Platform quickapp_hmos() {
return newBuilder()
.addDeviceType(DeviceType.QuickApp)
- .addDeviceType(DeviceType.WinPhone)
+ .addDeviceType(DeviceType.HMOS)
.build();
}
@@ -101,27 +101,27 @@ public static Platform android_ios_quickapp() {
.build();
}
- public static Platform android_ios_winphone() {
+ public static Platform android_ios_hmos() {
return newBuilder()
.addDeviceType(DeviceType.Android)
.addDeviceType(DeviceType.IOS)
- .addDeviceType(DeviceType.WinPhone)
+ .addDeviceType(DeviceType.HMOS)
.build();
}
- public static Platform android_quickapp_winphone() {
+ public static Platform android_quickapp_hmos() {
return newBuilder()
.addDeviceType(DeviceType.Android)
.addDeviceType(DeviceType.QuickApp)
- .addDeviceType(DeviceType.WinPhone)
+ .addDeviceType(DeviceType.HMOS)
.build();
}
- public static Platform ios_quickapp_winphone() {
+ public static Platform ios_quickapp_hmos() {
return newBuilder()
.addDeviceType(DeviceType.IOS)
.addDeviceType(DeviceType.QuickApp)
- .addDeviceType(DeviceType.WinPhone)
+ .addDeviceType(DeviceType.HMOS)
.build();
}
diff --git a/src/main/java/cn/jpush/api/push/model/notification/HmosNotification.java b/src/main/java/cn/jpush/api/push/model/notification/HmosNotification.java
new file mode 100644
index 00000000..71e9135e
--- /dev/null
+++ b/src/main/java/cn/jpush/api/push/model/notification/HmosNotification.java
@@ -0,0 +1,168 @@
+package cn.jpush.api.push.model.notification;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+
+import java.util.Map;
+
+/**
+ * HMOS Phone 通知类
+ *
+ * 具体使用方法请参考官方文档 https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#platform
+ * 支持 HMOS Notification 的参数:
+ *
+ * - alert: 继承自父类 PlatformNotification 的 alert 属性;本类设置则覆盖。
+ * - title: 支持 setTitle(string) 方法来设置;可替换通知标题。
+ * - _open_page: 支持 setOpenPage(String) 方法来设置;可设置点击打开的页面名称
+ * - extras: 继承自父类 PlatformNotification 的 extras 属性;支持通过 addExtra(key, value) 来添加自定义字段,具体看代码。
+ *
+ *
+ */
+public class HmosNotification extends PlatformNotification {
+ private static final String NOTIFICATION_HMOS = "hmos";
+
+ private static final String TITLE = "title";
+ private static final String CATEGORY = "category";
+ private static final String LARGE_ICON = "large_icon";
+ private static final String INTENT = "intent";
+ private static final String BADGE_ADD_NUM = "badge_add_num";
+ private static final String TEST_MESSAGE = "test_message";
+ private static final String RECEIPT_ID = "receipt_id";
+
+ private final String title;
+ private final String category;
+ private final String large_icon;
+ private final JsonObject intent;
+ private final Integer badge_add_num;
+ private final Boolean test_message;
+ private final String receipt_id;
+
+ private HmosNotification(Object alert,
+ String title,
+ String category,
+ String large_icon,
+ JsonObject intent,
+ Integer badge_add_num,
+ Boolean test_message,
+ String receipt_id,
+ Map extras,
+ Map numberExtras,
+ Map booleanExtras,
+ Map jsonExtras,
+ Map customData) {
+ super(alert, extras, numberExtras, booleanExtras, jsonExtras, customData);
+
+ this.title = title;
+ this.category = category;
+ this.large_icon = large_icon;
+ this.intent = intent;
+ this.badge_add_num = badge_add_num;
+ this.test_message = test_message;
+ this.receipt_id = receipt_id;
+ }
+
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ public static HmosNotification alert(String alert) {
+ return newBuilder().setAlert(alert).build();
+ }
+
+
+ @Override
+ public String getPlatform() {
+ return NOTIFICATION_HMOS;
+ }
+
+ @Override
+ public JsonElement toJSON() {
+ JsonObject json = super.toJSON().getAsJsonObject();
+
+ if (null != title) {
+ json.add(TITLE, new JsonPrimitive(title));
+ }
+ if (null != category) {
+ json.add(CATEGORY, new JsonPrimitive(category));
+ }
+ if (null != large_icon) {
+ json.add(LARGE_ICON, new JsonPrimitive(large_icon));
+ }
+ if (null != intent) {
+ json.add(INTENT, intent);
+ }
+ if (null != badge_add_num) {
+ json.add(BADGE_ADD_NUM, new JsonPrimitive(badge_add_num));
+ }
+ if (null != test_message) {
+ json.add(TEST_MESSAGE, new JsonPrimitive(test_message));
+ }
+ if (null != receipt_id) {
+ json.add(RECEIPT_ID, new JsonPrimitive(receipt_id));
+ }
+ return json;
+ }
+
+
+ public static class Builder extends PlatformNotification.Builder {
+ private String title;
+ private String category;
+ private String large_icon;
+ private JsonObject intent;
+ private Integer badge_add_num;
+ private Boolean test_message;
+ private String receipt_id;
+
+ @Override
+ protected Builder getThis() {
+ return this;
+ }
+
+ @Override
+ public Builder setAlert(Object alert) {
+ this.alert = alert;
+ return this;
+ }
+
+ public Builder setTitle(String title) {
+ this.title = title;
+ return this;
+ }
+
+ public Builder setCategory(String category) {
+ this.category = category;
+ return this;
+ }
+
+ public Builder setLarge_icon(String large_icon) {
+ this.large_icon = large_icon;
+ return this;
+ }
+
+ public Builder setIntent(JsonObject intent) {
+ this.intent = intent;
+ return this;
+ }
+
+ public Builder setBadge_add_num(Integer badge_add_num) {
+ this.badge_add_num = badge_add_num;
+ return this;
+ }
+
+ public Builder setTest_message(Boolean test_message) {
+ this.test_message = test_message;
+ return this;
+ }
+
+ public Builder setReceipt_id(String receipt_id) {
+ this.receipt_id = receipt_id;
+ return this;
+ }
+
+ public HmosNotification build() {
+ return new HmosNotification(alert, title, category,large_icon,intent,badge_add_num,test_message,receipt_id,
+ extrasBuilder, numberExtrasBuilder, booleanExtrasBuilder, jsonExtrasBuilder, super.customData);
+ }
+ }
+}
diff --git a/src/main/java/cn/jpush/api/push/model/notification/Notification.java b/src/main/java/cn/jpush/api/push/model/notification/Notification.java
index 2a9782cf..2da780ca 100644
--- a/src/main/java/cn/jpush/api/push/model/notification/Notification.java
+++ b/src/main/java/cn/jpush/api/push/model/notification/Notification.java
@@ -99,10 +99,11 @@ public static Notification ios_incr_badge(int badge) {
.build();
}
- public static Notification winphone(String alert, Map extras) {
+ public static Notification hmos(String alert, String title, Map extras) {
return newBuilder()
- .addPlatformNotification(WinphoneNotification.newBuilder()
+ .addPlatformNotification(HmosNotification.newBuilder()
.setAlert(alert)
+ .setTitle(title)
.addExtras(extras)
.build())
.build();
diff --git a/src/main/java/cn/jpush/api/push/model/notification/WinphoneNotification.java b/src/main/java/cn/jpush/api/push/model/notification/WinphoneNotification.java
deleted file mode 100644
index aaef3f3e..00000000
--- a/src/main/java/cn/jpush/api/push/model/notification/WinphoneNotification.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package cn.jpush.api.push.model.notification;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-
-import java.util.Map;
-
-/**
- * Windows Phone 通知类
- *
- * 具体使用方法请参考官方文档 https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#platform
- * 支持 Winphone Notification 的参数:
- *
- * - alert: 继承自父类 PlatformNotification 的 alert 属性;本类设置则覆盖。
- * - title: 支持 setTitle(string) 方法来设置;可替换通知标题。
- * - _open_page: 支持 setOpenPage(String) 方法来设置;可设置点击打开的页面名称
- * - extras: 继承自父类 PlatformNotification 的 extras 属性;支持通过 addExtra(key, value) 来添加自定义字段,具体看代码。
- *
- *
- */
-public class WinphoneNotification extends PlatformNotification {
- private static final String NOTIFICATION_WINPHONE = "winphone";
-
- private static final String TITLE = "title";
- private static final String _OPEN_PAGE = "_open_page";
-
- private final String title;
- private final String openPage;
-
- private WinphoneNotification(Object alert, String title, String openPage,
- Map extras,
- Map numberExtras,
- Map booleanExtras,
- Map jsonExtras,
- Map customData) {
- super(alert, extras, numberExtras, booleanExtras, jsonExtras, customData);
-
- this.title = title;
- this.openPage = openPage;
- }
-
- public static Builder newBuilder() {
- return new Builder();
- }
-
- public static WinphoneNotification alert(String alert) {
- return newBuilder().setAlert(alert).build();
- }
-
-
- @Override
- public String getPlatform() {
- return NOTIFICATION_WINPHONE;
- }
-
- @Override
- public JsonElement toJSON() {
- JsonObject json = super.toJSON().getAsJsonObject();
-
- if (null != title) {
- json.add(TITLE, new JsonPrimitive(title));
- }
- if (null != openPage) {
- json.add(_OPEN_PAGE, new JsonPrimitive(openPage));
- }
-
- return json;
- }
-
-
- public static class Builder extends PlatformNotification.Builder {
- private String title;
- private String openPage;
-
- @Override
- protected Builder getThis() {
- return this;
- }
-
- public Builder setTitle(String title) {
- this.title = title;
- return this;
- }
-
- public Builder setOpenPage(String openPage) {
- this.openPage = openPage;
- return this;
- }
-
- @Override
- public Builder setAlert(Object alert) {
- this.alert = alert;
- return this;
- }
-
-
- public WinphoneNotification build() {
- return new WinphoneNotification(alert, title, openPage,
- extrasBuilder, numberExtrasBuilder, booleanExtrasBuilder, jsonExtrasBuilder, super.customData);
- }
- }
-}
diff --git a/src/test/java/cn/jpush/api/push/PushClientTest.java b/src/test/java/cn/jpush/api/push/PushClientTest.java
index 9da4c23b..0453a462 100644
--- a/src/test/java/cn/jpush/api/push/PushClientTest.java
+++ b/src/test/java/cn/jpush/api/push/PushClientTest.java
@@ -13,7 +13,9 @@
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.*;
+import com.google.gson.JsonObject;
import io.netty.handler.codec.http.HttpMethod;
+import lombok.SneakyThrows;
import org.junit.Test;
import cn.jiguang.common.connection.HttpProxy;
@@ -231,4 +233,31 @@ public void testAlertType(){
System.out.println(notification.toJSON());
}
+ @Test
+ @SneakyThrows
+ public void testHmos(){
+ JsonObject intentJson = new JsonObject();
+ intentJson.addProperty("url","scheme://hmos?key1=val1&key2=val2");
+ Notification notification = Notification.newBuilder()
+ .addPlatformNotification(HmosNotification.newBuilder()
+ .setAlert("hmos内容")
+ .setTitle("hmos标题")
+ .setCategory("IM")
+ .setLarge_icon("https://www.jiguang.cn/largeIcon.jpg")
+ .setIntent(intentJson)
+ .setBadge_add_num(1)
+ .setTest_message(false)
+ .setReceipt_id("receipt_id_2024")
+ .addExtra("a","a")
+ .build()
+ ).build();
+ JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY);
+ PushPayload payload = PushPayload.newBuilder()
+ .setAudience(Audience.all())
+ .setPlatform(Platform.hmos())
+ .setNotification(notification)
+ .build();
+ jpushClient.sendPush(payload);
+ }
+
}
diff --git a/src/test/java/cn/jpush/api/push/mock/BaseMockTest.java b/src/test/java/cn/jpush/api/push/mock/BaseMockTest.java
index f04d831b..2ff188e8 100644
--- a/src/test/java/cn/jpush/api/push/mock/BaseMockTest.java
+++ b/src/test/java/cn/jpush/api/push/mock/BaseMockTest.java
@@ -30,7 +30,7 @@ public class BaseMockTest implements IMockTest {
static {
SUPPORT_PLATFORM.add("android");
SUPPORT_PLATFORM.add("ios");
- SUPPORT_PLATFORM.add("winphone");
+ SUPPORT_PLATFORM.add("hmos");
SUPPORT_AUDIENCE.add("tag");
SUPPORT_AUDIENCE.add("tag_and");
diff --git a/src/test/java/cn/jpush/api/push/mock/ResponseErrorTest.java b/src/test/java/cn/jpush/api/push/mock/ResponseErrorTest.java
index 537cef39..e4641414 100644
--- a/src/test/java/cn/jpush/api/push/mock/ResponseErrorTest.java
+++ b/src/test/java/cn/jpush/api/push/mock/ResponseErrorTest.java
@@ -112,13 +112,13 @@ public void invalidParams_notification_ios() {
}
@Test
- public void invalidParams_notification_winphone() {
+ public void invalidParams_notification_hmos() {
JsonObject payload = new JsonObject();
payload.add("platform", Platform.all().toJSON());
payload.add("audience", Audience.all().toJSON());
JsonObject notification = new JsonObject();
- notification.add("winphone", new JsonPrimitive(ALERT));
+ notification.add("hmos", new JsonPrimitive(ALERT));
payload.add("notification", notification);
System.out.println("json string: " + payload.toString());
@@ -219,15 +219,15 @@ public void lackOfParams_notification_ios_empty() {
}
@Test
- public void lackOfParams_notification_winphone_empty() {
+ public void lackOfParams_notification_hmos_empty() {
JsonObject payload = new JsonObject();
payload.add("platform", Platform.all().toJSON());
payload.add("audience", Audience.all().toJSON());
JsonObject notification = new JsonObject();
- JsonObject winphone = new JsonObject();
+ JsonObject hmos = new JsonObject();
- notification.add("winphone", winphone);
+ notification.add("hmos", hmos);
payload.add("notification", notification);
System.out.println("json string: " + payload.toString());
@@ -275,16 +275,16 @@ public void lackOfParams_notification_ios_noalert() {
}
@Test
- public void lackOfParams_notification_winphone_noalert() {
+ public void lackOfParams_notification_hmos_noalert() {
JsonObject payload = new JsonObject();
payload.add("platform", Platform.all().toJSON());
payload.add("audience", Audience.all().toJSON());
JsonObject notification = new JsonObject();
- JsonObject winphone = new JsonObject();
- winphone.add("title", new JsonPrimitive("title"));
+ JsonObject hmos = new JsonObject();
+ hmos.add("title", new JsonPrimitive("title"));
- notification.add("winphone", winphone);
+ notification.add("hmos", hmos);
payload.add("notification", notification);
System.out.println("json string: " + payload.toString());
diff --git a/src/test/java/cn/jpush/api/push/model/notification/WinphoneNotificationTest.java b/src/test/java/cn/jpush/api/push/model/notification/HmosNotificationTest.java
similarity index 61%
rename from src/test/java/cn/jpush/api/push/model/notification/WinphoneNotificationTest.java
rename to src/test/java/cn/jpush/api/push/model/notification/HmosNotificationTest.java
index 9cadb938..bbee925a 100644
--- a/src/test/java/cn/jpush/api/push/model/notification/WinphoneNotificationTest.java
+++ b/src/test/java/cn/jpush/api/push/model/notification/HmosNotificationTest.java
@@ -10,33 +10,33 @@
import com.google.gson.JsonPrimitive;
@Category(FastTests.class)
-public class WinphoneNotificationTest {
+public class HmosNotificationTest {
@Test
public void testEmpty() {
- WinphoneNotification winphone = WinphoneNotification.newBuilder().build();
- Assert.assertEquals("", new JsonObject(), winphone.toJSON());
+ HmosNotification hmos = HmosNotification.newBuilder().build();
+ Assert.assertEquals("", new JsonObject(), hmos.toJSON());
}
@Test
public void testQuickAlert() {
- WinphoneNotification winphone = WinphoneNotification.alert("aaa");
+ HmosNotification hmos = HmosNotification.alert("aaa");
JsonObject json = new JsonObject();
json.add("alert", new JsonPrimitive("aaa"));
- Assert.assertEquals("", json, winphone.toJSON());
+ Assert.assertEquals("", json, hmos.toJSON());
}
@Test
public void testTitle() {
- WinphoneNotification winphone = WinphoneNotification.newBuilder().setTitle("title").build();
+ HmosNotification hmos = HmosNotification.newBuilder().setTitle("title").build();
JsonObject json = new JsonObject();
json.add("title", new JsonPrimitive("title"));
- Assert.assertEquals("", json, winphone.toJSON());
+ Assert.assertEquals("", json, hmos.toJSON());
}
@Test
public void testExtra() {
- WinphoneNotification winphone = WinphoneNotification.newBuilder()
+ HmosNotification hmos = HmosNotification.newBuilder()
.addExtra("key2", 222)
.addExtra("key", "value").build();
JsonObject json = new JsonObject();
@@ -44,7 +44,7 @@ public void testExtra() {
extra.add("key", new JsonPrimitive("value"));
extra.add("key2", new JsonPrimitive(222));
json.add("extras", extra);
- Assert.assertEquals("", json, winphone.toJSON());
+ Assert.assertEquals("", json, hmos.toJSON());
}
diff --git a/src/test/java/cn/jpush/api/push/model/notification/NotificationTest.java b/src/test/java/cn/jpush/api/push/model/notification/NotificationTest.java
index 666e054b..c2bdbfe1 100644
--- a/src/test/java/cn/jpush/api/push/model/notification/NotificationTest.java
+++ b/src/test/java/cn/jpush/api/push/model/notification/NotificationTest.java
@@ -64,15 +64,15 @@ public void testAlert_ios() {
}
@Test
- public void testAlert_winphone() {
+ public void testAlert_hmos() {
Notification notification = Notification.newBuilder()
- .addPlatformNotification(WinphoneNotification.alert("alert"))
+ .addPlatformNotification(HmosNotification.alert("alert"))
.build();
JsonObject json = new JsonObject();
- JsonObject winphone = new JsonObject();
- winphone.add("alert", new JsonPrimitive("alert"));
+ JsonObject hmos = new JsonObject();
+ hmos.add("alert", new JsonPrimitive("alert"));
json.addProperty("ai_opportunity", false);
- json.add("winphone", winphone);
+ json.add("hmos", hmos);
Assert.assertEquals("", json, notification.toJSON());
}
diff --git a/src/test/java/cn/jpush/api/push/remote/AlertOverrideTest.java b/src/test/java/cn/jpush/api/push/remote/AlertOverrideTest.java
index 298eab51..dcc24ace 100644
--- a/src/test/java/cn/jpush/api/push/remote/AlertOverrideTest.java
+++ b/src/test/java/cn/jpush/api/push/remote/AlertOverrideTest.java
@@ -14,7 +14,7 @@
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.IosNotification;
import cn.jpush.api.push.model.notification.Notification;
-import cn.jpush.api.push.model.notification.WinphoneNotification;
+import cn.jpush.api.push.model.notification.HmosNotification;
@Category(SlowTests.class)
public class AlertOverrideTest extends BaseRemotePushTest {
@@ -28,7 +28,7 @@ public void sendAlert_all() throws Exception {
.setAlert("alert")
.addPlatformNotification(AndroidNotification.alert("android alert"))
.addPlatformNotification(IosNotification.alert("ios alert"))
- .addPlatformNotification(WinphoneNotification.alert("winphone alert"))
+ .addPlatformNotification(HmosNotification.alert("hmos alert"))
.build())
.build();
PushResult result = _client.sendPush(payload);
@@ -67,13 +67,13 @@ public void sendAlert_ios() throws Exception {
}
@Test
- public void sendAlert_wp() throws Exception {
+ public void sendAlert_hmos() throws Exception {
PushPayload payload = PushPayload.newBuilder()
- .setPlatform(Platform.winphone())
+ .setPlatform(Platform.hmos())
.setAudience(Audience.all())
.setNotification(Notification.newBuilder()
.setAlert("alert")
- .addPlatformNotification(WinphoneNotification.alert("winphone alert"))
+ .addPlatformNotification(HmosNotification.alert("hmos alert"))
.build())
.build();
try {
diff --git a/src/test/java/cn/jpush/api/push/remote/BasicFunctionsTest.java b/src/test/java/cn/jpush/api/push/remote/BasicFunctionsTest.java
index 835a73e9..bc541daa 100644
--- a/src/test/java/cn/jpush/api/push/remote/BasicFunctionsTest.java
+++ b/src/test/java/cn/jpush/api/push/remote/BasicFunctionsTest.java
@@ -2,7 +2,6 @@
import static org.junit.Assert.assertTrue;
-import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -17,7 +16,7 @@
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.IosNotification;
import cn.jpush.api.push.model.notification.Notification;
-import cn.jpush.api.push.model.notification.WinphoneNotification;
+import cn.jpush.api.push.model.notification.HmosNotification;
@Category(SlowTests.class)
public class BasicFunctionsTest extends BaseRemotePushTest {
@@ -88,12 +87,12 @@ public void sendSimpleNotification_Pall_Nios() throws Exception {
}
@Test
- public void sendSimpleNotification_Pwp_Nwp() throws Exception {
+ public void sendSimpleNotification_Phmos_Nhmos() throws Exception {
PushPayload payload = PushPayload.newBuilder()
- .setPlatform(Platform.winphone())
+ .setPlatform(Platform.hmos())
.setAudience(Audience.all())
.setNotification(Notification.newBuilder()
- .addPlatformNotification(WinphoneNotification.alert("Pwp Nwp alert"))
+ .addPlatformNotification(HmosNotification.alert("Phmos Nhmos alert"))
.build())
.build();
try {
@@ -104,12 +103,12 @@ public void sendSimpleNotification_Pwp_Nwp() throws Exception {
}
@Test
- public void sendSimpleNotification_Pall_Nwp() throws Exception {
+ public void sendSimpleNotification_Pall_Nhmos() throws Exception {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.all())
.setAudience(Audience.all())
.setNotification(Notification.newBuilder()
- .addPlatformNotification(WinphoneNotification.alert("Pall Nwp alert"))
+ .addPlatformNotification(HmosNotification.alert("Pall Nhmos alert"))
.build())
.build();
try {
@@ -125,11 +124,11 @@ public void sendSimpleNotification_Pall_Nall() throws Exception {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.newBuilder()
.addDeviceType(DeviceType.IOS)
- .addDeviceType(DeviceType.WinPhone)
+ .addDeviceType(DeviceType.HMOS)
.addDeviceType(DeviceType.Android).build())
.setAudience(Audience.all())
.setNotification(Notification.newBuilder()
- .addPlatformNotification(WinphoneNotification.alert("Pall Nall wp alert"))
+ .addPlatformNotification(HmosNotification.alert("Pall Nall hmos alert"))
.addPlatformNotification(IosNotification.alert("Pall Nall ios alert"))
.addPlatformNotification(AndroidNotification.alert("Pall Nall android alert"))
.build())
@@ -169,18 +168,6 @@ public void sendSimpleMessage_Pios() throws Exception {
e.printStackTrace();
}
}
-
- //@Test
- public void sendSimpleMessage_Pwinphone() throws Exception {
- PushPayload payload = PushPayload.newBuilder()
- .setPlatform(Platform.winphone())
- .setAudience(Audience.all())
- .setMessage(Message.content("Pwp msg"))
- .build();
- PushResult result = _client.sendPush(payload);
- assertTrue(result.isResultOK());
- }
-
@Test
public void sendSimpleMessageAndNotification_Pall() throws Exception {
diff --git a/src/test/java/cn/jpush/api/push/remote/ExceptionTest.java b/src/test/java/cn/jpush/api/push/remote/ExceptionTest.java
index 1d307fa0..e92ac55a 100644
--- a/src/test/java/cn/jpush/api/push/remote/ExceptionTest.java
+++ b/src/test/java/cn/jpush/api/push/remote/ExceptionTest.java
@@ -160,28 +160,7 @@ public void invalidParams_notification_ios() {
assertEquals(INVALID_PARAMS, e.getErrorCode());
}
}
- /*
- @Test
- public void invalidParams_notification_winphone() {
- JsonObject payload = new JsonObject();
- payload.add("platform", Platform.all().toJSON());
- payload.add("audience", Audience.all().toJSON());
-
- JsonObject notification = new JsonObject();
- notification.add("winphone", new JsonPrimitive(ALERT));
- payload.add("notification", notification);
-
- System.out.println("json string: " + payload.toString());
-
- try {
- _client.sendPush(payload.toString());
- } catch (APIConnectionException e) {
- e.printStackTrace();
- } catch (APIRequestException e) {
- assertEquals(INVALID_PARAMS, e.getErrorCode());
- }
- }
- */
+
@Test
public void invalidParams_notification_android_builderidNotNumber() {
JsonObject payload = new JsonObject();
@@ -254,15 +233,15 @@ public void invalidParams_notification_ios_empty() {
}
@Test
- public void invalidParams_notification_winphone_empty() {
+ public void invalidParams_notification_hmos_empty() {
JsonObject payload = new JsonObject();
payload.add("platform", Platform.all().toJSON());
payload.add("audience", Audience.all().toJSON());
JsonObject notification = new JsonObject();
- JsonObject winphone = new JsonObject();
+ JsonObject hmos = new JsonObject();
- notification.add("winphone", winphone);
+ notification.add("hmos", hmos);
payload.add("notification", notification);
System.out.println("json string: " + payload.toString());
@@ -326,16 +305,16 @@ public void invalidParams_notification_ios_noalert() {
}
@Test
- public void invalidParams_notification_winphone_noalert() {
+ public void invalidParams_notification_hmos_noalert() {
JsonObject payload = new JsonObject();
payload.add("platform", Platform.all().toJSON());
payload.add("audience", Audience.all().toJSON());
JsonObject notification = new JsonObject();
- JsonObject winphone = new JsonObject();
- winphone.add("title", new JsonPrimitive("title"));
+ JsonObject hmos = new JsonObject();
+ hmos.add("title", new JsonPrimitive("title"));
- notification.add("winphone", winphone);
+ notification.add("hmos", hmos);
payload.add("notification", notification);
System.out.println("json string: " + payload.toString());