Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
c9e28aef
Commit
c9e28aef
authored
Jul 15, 2018
by
Junling Bu
Browse files
chore[litemall-core]:提醒消息重新命名以及添加测试
parent
80cf0a24
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-core/src/test/java/org/linlinjava/litemall/core/MailTest.java
0 → 100644
View file @
c9e28aef
package
org.linlinjava.litemall.core
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.notify.LitemallNotifyService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
/**
* 测试邮件发送服务
*
* 注意LitemallNotifyService采用异步线程操作
* 因此测试的时候需要睡眠一会儿,保证任务执行
*
* 开发者需要确保:
* 1. 在相应的邮件服务器设置正确notify.properties已经设置正确
* 2. 在相应的邮件服务器设置正确
*/
@WebAppConfiguration
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
public
class
MailTest
{
@Autowired
private
LitemallNotifyService
litemallNotifyService
;
@Test
public
void
testMail
()
{
litemallNotifyService
.
notifyMailMessage
(
"订单信息"
,
"订单1111111已付款,请发货"
);
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java
0 → 100644
View file @
c9e28aef
package
org.linlinjava.litemall.core
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.notify.LitemallNotifyService
;
import
org.linlinjava.litemall.core.notify.NotifyUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
/**
* 测试短信发送服务
*
* 注意LitemallNotifyService采用异步线程操作
* 因此测试的时候需要睡眠一会儿,保证任务执行
*
* 开发者需要确保:
* 1. 在腾讯云短信平台设置短信签名和短信模板notify.properties已经设置正确
* 2. 在腾讯云短信平台设置短信签名和短信模板
* 3. 在当前测试类设置好正确的手机号码
*/
@WebAppConfiguration
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
public
class
SmsTest
{
@Autowired
private
LitemallNotifyService
litemallNotifyService
;
// @Test
public
void
testSingle
()
{
String
phone
=
"xxxxxxxxxxx"
;
// 这里的短信签名必须在短信管理平台内设置正确并且相符合
String
msg
=
"【xxx】你的验证码为:123456,请与2分钟内填写,如非本人操作,请忽略本短信。"
;
litemallNotifyService
.
notifySMSMessage
(
phone
,
msg
);
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
testCaptcha
()
{
String
phone
=
"xxxxxxxxxxx"
;
String
[]
params
=
new
String
[]
{
"123456"
};
litemallNotifyService
.
notifySMSTemplate
(
phone
,
NotifyUtils
.
NotifyType
.
CAPTCHA
,
params
);
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
testPaySucceed
()
{
String
phone
=
"xxxxxxxxxxx"
;
String
[]
params
=
new
String
[]
{
"123456"
};
litemallNotifyService
.
notifySMSTemplate
(
phone
,
NotifyUtils
.
NotifyType
.
PAY_SUCCEED
,
params
);
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment