DeviceControllerTest.java
2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.glsx.modules.notify.controller;
import com.glsx.modules.notify.factory.PushType;
import com.glsx.modules.notify.model.BaseRequest;
import com.glsx.modules.notify.model.param.NotifyReqParam;
import com.glsx.modules.notify.push.BroadCastService;
import com.glsx.modules.notify.service.PushService;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@Slf4j
public class DeviceControllerTest {
@Autowired
private BroadCastService demo;
@Autowired
PushService pushService;
@Test
public void testPush_android_notify() {
try {
//demo.sendAndroidUnicast();
//demo.sendIOSUnicast();
/* TODO these methods are all available, just fill in some fields and do the test
* demo.sendAndroidCustomizedcastFile();
* demo.sendAndroidBroadcast();
* demo.sendAndroidGroupcast();
* demo.sendAndroidCustomizedcast();
* demo.sendAndroidFilecast();
*
* demo.sendIOSBroadcast();
* demo.sendIOSUnicast();
* demo.sendIOSGroupcast();
* demo.sendIOSCustomizedcast();
* demo.sendIOSFilecast();
*/
NotifyReqParam pushRequest = new NotifyReqParam();
pushRequest.setType(PushType.ALIYUN.getCode());
pushRequest.setTitle("消息推送测试标题");
pushRequest.setBody("内容test");
pushRequest.setDeviceType("ANDROID");
pushRequest.setTargetValue("com.glsx.aicar.push");
BaseRequest baseRequest = new BaseRequest();
BeanUtils.copyProperties(pushRequest,baseRequest);
R r = pushService.pushNotify(baseRequest);
log.info("fzpush====="+r);
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Test
public void testPush_ios_notify() {
try {
BaseRequest pushRequest = new BaseRequest();
pushRequest.setType(PushType.ALIYUN.getCode());
pushRequest.setTitle("消息推送测试标题");
pushRequest.setBody("内容test");
pushRequest.setDeviceType("iOS");
pushRequest.setTargetValue("com.glsx.aicar.push");
R r = pushService.pushNotify(pushRequest);
log.info("fzpush====="+r);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}