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
324c8da3
Unverified
Commit
324c8da3
authored
Dec 29, 2019
by
linlinjava
Committed by
GitHub
Dec 29, 2019
Browse files
Merge branch 'master' into dev
parents
693cf5cd
4c46da9b
Changes
399
Show whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 399+
files are displayed.
Plain diff
Email patch
litemall-core/src/main/java/org/linlinjava/litemall/core/validator/OrderValidator.java
View file @
324c8da3
package
org.linlinjava.litemall.core.validator
;
import
com.google.common.collect.Lists
;
import
javax.validation.ConstraintValidator
;
import
javax.validation.ConstraintValidatorContext
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
OrderValidator
implements
ConstraintValidator
<
Order
,
String
>
{
...
...
@@ -10,7 +11,7 @@ public class OrderValidator implements ConstraintValidator<Order, String> {
@Override
public
void
initialize
(
Order
order
)
{
valueList
=
new
ArrayList
<
String
>
();
valueList
=
Lists
.
newArrayList
();
for
(
String
val
:
order
.
accepts
())
{
valueList
.
add
(
val
.
toUpperCase
());
}
...
...
litemall-core/src/main/java/org/linlinjava/litemall/core/validator/SortValidator.java
View file @
324c8da3
package
org.linlinjava.litemall.core.validator
;
import
com.google.common.collect.Lists
;
import
javax.validation.ConstraintValidator
;
import
javax.validation.ConstraintValidatorContext
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
SortValidator
implements
ConstraintValidator
<
Sort
,
String
>
{
...
...
@@ -10,7 +11,7 @@ public class SortValidator implements ConstraintValidator<Sort, String> {
@Override
public
void
initialize
(
Sort
sort
)
{
valueList
=
new
ArrayList
<
String
>
();
valueList
=
Lists
.
newArrayList
();
for
(
String
val
:
sort
.
accepts
())
{
valueList
.
add
(
val
.
toUpperCase
());
}
...
...
litemall-core/src/main/resources/application-core.yml
View file @
324c8da3
...
...
@@ -20,13 +20,15 @@ litemall:
password
:
XXXXXXXXXXXXX
sendfrom
:
ex@ex.com.cn
sendto
:
ex@qq.com
port
:
465
# 短消息模版通知配置
# 短信息用于通知客户,例如发货短信通知,注意配置格式;template-name,template-templateId 请参考 NotifyType 枚举值
sms
:
enable
:
false
appid
:
111111111
appkey
:
xxxxxxxxxxxxxx
# 如果是腾讯云短信,则设置active的值tencent
# 如果是阿里云短信,则设置active的值aliyun
active
:
tencent
sign
:
litemall
template
:
-
name
:
paySucceed
templateId
:
156349
...
...
@@ -36,6 +38,14 @@ litemall:
templateId
:
158002
-
name
:
refund
templateId
:
159447
tencent
:
appid
:
111111111
appkey
:
xxxxxxxxxxxxxx
aliyun
:
regionId
:
xxx
accessKeyId
:
xxx
accessKeySecret
:
xxx
# 微信模版通知配置
# 微信模版用于通知客户或者运营者,注意配置格式;template-name,template-templateId 请参考 NotifyType 枚举值
...
...
@@ -102,10 +112,10 @@ litemall:
# 腾讯对象存储配置信息
# 请参考 https://cloud.tencent.com/document/product/436/6249
tencent
:
secretId
:
111111
secretKey
:
xxxxxx
region
:
xxxxxx
bucketName
:
litemall
secretId
:
AKIDOccMr856uoU1Tsa2MQL5aqseBUWRrb5i
secretKey
:
XqtgEhIdrupTs4ygaWlkUUXv3w3FiwuD
region
:
ap-shanghai
bucketName
:
vytech-1300096589
# 七牛云对象存储配置信息
qiniu
:
endpoint
:
http://pd5cb6ulu.bkt.clouddn.com
...
...
litemall-core/src/test/java/org/linlinjava/litemall/core/AliyunStorageTest.java
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.storage.AliyunStorage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.core.io.Resource
;
import
org.springframework.test.context.junit4.Spring
JUnit4Class
Runner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.io.File
;
...
...
@@ -14,9 +16,11 @@ import java.io.FileInputStream;
import
java.io.IOException
;
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
AliyunStorageTest
{
private
final
Log
logger
=
LogFactory
.
getLog
(
AliyunStorageTest
.
class
);
@Autowired
private
AliyunStorage
aliyunStorage
;
...
...
@@ -27,11 +31,9 @@ public class AliyunStorageTest {
aliyunStorage
.
store
(
new
FileInputStream
(
test
),
testFile
.
length
(),
"image/png"
,
"litemall.png"
);
Resource
resource
=
aliyunStorage
.
loadAsResource
(
"litemall.png"
);
String
url
=
aliyunStorage
.
generateUrl
(
"litemall.png"
);
System
.
out
.
println
(
"test file "
+
test
);
System
.
out
.
println
(
"store file "
+
resource
.
getURI
());
System
.
out
.
println
(
"generate url "
+
url
);
// tencentOsService.delete("litemall.png");
logger
.
info
(
"test file "
+
test
);
logger
.
info
(
"store file "
+
resource
.
getURI
());
logger
.
info
(
"generate url "
+
url
);
}
}
\ No newline at end of file
litemall-core/src/
main
/java/org/linlinjava/litemall/core/Application.java
→
litemall-core/src/
test
/java/org/linlinjava/litemall/core/Application.java
View file @
324c8da3
File moved
litemall-core/src/test/java/org/linlinjava/litemall/core/AsyncTask.java
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
@Service
public
class
AsyncTask
{
private
final
Log
logger
=
LogFactory
.
getLog
(
AsyncTask
.
class
);
@Async
public
void
asyncMethod
()
{
System
.
out
.
println
(
"Execute method asynchronously. "
logger
.
info
(
"Execute method asynchronously. "
+
Thread
.
currentThread
().
getName
());
}
public
void
nonasyncMethod
()
{
System
.
out
.
println
(
"Execute method nonasynchronously. "
logger
.
info
(
"Execute method nonasynchronously. "
+
Thread
.
currentThread
().
getName
());
}
}
litemall-core/src/test/java/org/linlinjava/litemall/core/AsyncTest.java
View file @
324c8da3
...
...
@@ -5,13 +5,14 @@ import org.junit.runner.RunWith;
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.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
/**
* 异步测试
*/
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
AsyncTest
{
...
...
litemall-core/src/test/java/org/linlinjava/litemall/core/CoreConfigTest.java
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.core.env.Environment
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
CoreConfigTest
{
private
final
Log
logger
=
LogFactory
.
getLog
(
CoreConfigTest
.
class
);
@Autowired
Environment
environment
;
@Test
public
void
test
()
{
// 测试获取application-core.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"litemall.express.appId"
));
logger
.
info
(
environment
.
getProperty
(
"litemall.express.appId"
));
}
}
litemall-core/src/test/java/org/linlinjava/litemall/core/ExpressTest.java
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.express.ExpressService
;
...
...
@@ -7,12 +9,15 @@ import org.linlinjava.litemall.core.express.dao.ExpressInfo;
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.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
Application
.
class
)
public
class
ExpressTest
{
private
final
Log
logger
=
LogFactory
.
getLog
(
ExpressTest
.
class
);
@Autowired
private
ExpressService
expressService
;
...
...
@@ -22,8 +27,8 @@ public class ExpressTest {
try
{
ei
=
expressService
.
getExpressInfo
(
"YTO"
,
"800669400640887922"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
System
.
out
.
print
(
ei
);
logger
.
info
(
ei
);
}
}
litemall-core/src/test/java/org/linlinjava/litemall/core/IntegerTest.java
0 → 100644
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.junit.Test
;
public
class
IntegerTest
{
@Test
public
void
test
()
{
Integer
a
=
new
Integer
(
512
);
int
b
=
512
;
Integer
c
=
new
Integer
(
512
);
System
.
out
.
println
(
a
==
b
);
System
.
out
.
println
(
a
.
equals
(
b
));
System
.
out
.
println
(
a
==
c
);
System
.
out
.
println
(
a
.
equals
(
c
));
}
}
litemall-core/src/test/java/org/linlinjava/litemall/core/LocalStorageTest.java
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.storage.LocalStorage
;
...
...
@@ -7,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.core.io.Resource
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.io.File
;
...
...
@@ -14,9 +17,11 @@ import java.io.FileInputStream;
import
java.io.IOException
;
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
LocalStorageTest
{
private
final
Log
logger
=
LogFactory
.
getLog
(
LocalStorageTest
.
class
);
@Autowired
private
LocalStorage
localStorage
;
...
...
@@ -27,12 +32,9 @@ public class LocalStorageTest {
localStorage
.
store
(
new
FileInputStream
(
test
),
testFile
.
length
(),
"image/png"
,
"litemall.png"
);
Resource
resource
=
localStorage
.
loadAsResource
(
"litemall.png"
);
String
url
=
localStorage
.
generateUrl
(
"litemall.png"
);
System
.
out
.
println
(
"test file "
+
test
);
System
.
out
.
println
(
"store file "
+
resource
.
getURI
());
System
.
out
.
println
(
"generate url "
+
url
);
// localStorage.delete("litemall.png");
logger
.
info
(
"test file "
+
test
);
logger
.
info
(
"store file "
+
resource
.
getURI
());
logger
.
info
(
"generate url "
+
url
);
}
}
\ No newline at end of file
litemall-core/src/test/java/org/linlinjava/litemall/core/MailTest.java
View file @
324c8da3
...
...
@@ -11,6 +11,7 @@ import org.springframework.context.annotation.Import;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.task.SyncTaskExecutor
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.util.concurrent.Executor
;
...
...
@@ -26,7 +27,7 @@ import java.util.concurrent.Executor;
* 2. 在相应的邮件服务器设置正确
*/
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
MailTest
{
...
...
litemall-core/src/test/java/org/linlinjava/litemall/core/QiniuStorageTest.java
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.storage.QiniuStorage
;
...
...
@@ -7,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.core.io.Resource
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.io.File
;
...
...
@@ -14,9 +17,11 @@ import java.io.FileInputStream;
import
java.io.IOException
;
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
QiniuStorageTest
{
private
final
Log
logger
=
LogFactory
.
getLog
(
QiniuStorageTest
.
class
);
@Autowired
private
QiniuStorage
qiniuStorage
;
...
...
@@ -27,10 +32,9 @@ public class QiniuStorageTest {
qiniuStorage
.
store
(
new
FileInputStream
(
test
),
testFile
.
length
(),
"image/png"
,
"litemall.png"
);
Resource
resource
=
qiniuStorage
.
loadAsResource
(
"litemall.png"
);
String
url
=
qiniuStorage
.
generateUrl
(
"litemall.png"
);
System
.
out
.
println
(
"test file "
+
test
);
System
.
out
.
println
(
"store file "
+
resource
.
getURI
());
System
.
out
.
println
(
"generate url "
+
url
);
// qiniuStorage.delete("litemall.png");
logger
.
info
(
"test file "
+
test
);
logger
.
info
(
"store file "
+
resource
.
getURI
());
logger
.
info
(
"generate url "
+
url
);
}
}
\ No newline at end of file
litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java
View file @
324c8da3
...
...
@@ -12,6 +12,7 @@ import org.springframework.context.annotation.Import;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.task.SyncTaskExecutor
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.util.concurrent.Executor
;
...
...
@@ -28,7 +29,7 @@ import java.util.concurrent.Executor;
* 3. 在当前测试类设置好正确的手机号码
*/
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
SmsTest
{
...
...
litemall-core/src/test/java/org/linlinjava/litemall/core/TaskTest.java
0 → 100644
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
com.google.common.primitives.Ints
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.task.Task
;
import
org.linlinjava.litemall.core.task.TaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.task.SyncTaskExecutor
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Objects
;
import
java.util.concurrent.Delayed
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.TimeUnit
;
@WebAppConfiguration
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
TaskTest
{
private
final
Log
logger
=
LogFactory
.
getLog
(
TaskTest
.
class
);
@Autowired
private
TaskService
taskService
;
private
class
DemoTask
extends
Task
{
DemoTask
(
String
id
,
long
delayInMilliseconds
){
super
(
id
,
delayInMilliseconds
);
}
@Override
public
void
run
()
{
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
String
now
=
df
.
format
(
LocalDateTime
.
now
());
System
.
out
.
println
(
"task id="
+
this
.
getId
()
+
" at time="
+
now
);
}
}
@Test
public
void
test
()
{
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
String
now
=
df
.
format
(
LocalDateTime
.
now
());
System
.
out
.
println
(
"start at time="
+
now
);
taskService
.
addTask
(
new
DemoTask
(
"3"
,
1000
));
taskService
.
addTask
(
new
DemoTask
(
"2"
,
2000
));
taskService
.
addTask
(
new
DemoTask
(
"1"
,
3000
));
taskService
.
addTask
(
new
DemoTask
(
"4"
,
1500
));
taskService
.
addTask
(
new
DemoTask
(
"5"
,
2500
));
taskService
.
addTask
(
new
DemoTask
(
"6"
,
3500
));
try
{
Thread
.
sleep
(
10
*
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
test1
()
{
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
String
now
=
df
.
format
(
LocalDateTime
.
now
());
System
.
out
.
println
(
"start at time="
+
now
);
taskService
.
addTask
(
new
DemoTask
(
"3"
,
0
));
taskService
.
addTask
(
new
DemoTask
(
"2"
,
0
));
taskService
.
addTask
(
new
DemoTask
(
"1"
,
0
));
taskService
.
addTask
(
new
DemoTask
(
"4"
,
0
));
taskService
.
addTask
(
new
DemoTask
(
"5"
,
0
));
taskService
.
addTask
(
new
DemoTask
(
"6"
,
0
));
try
{
Thread
.
sleep
(
10
*
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
litemall-core/src/test/java/org/linlinjava/litemall/core/TencentStorageTest.java
View file @
324c8da3
package
org.linlinjava.litemall.core
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.storage.TencentStorage
;
...
...
@@ -7,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.core.io.Resource
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.io.File
;
...
...
@@ -14,9 +17,11 @@ import java.io.FileInputStream;
import
java.io.IOException
;
@WebAppConfiguration
@RunWith
(
Spring
JUnit4Class
Runner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
TencentStorageTest
{
private
Log
logger
=
LogFactory
.
getLog
(
TencentStorageTest
.
class
);
@Autowired
private
TencentStorage
tencentStorage
;
...
...
@@ -27,11 +32,9 @@ public class TencentStorageTest {
tencentStorage
.
store
(
new
FileInputStream
(
test
),
testFile
.
length
(),
"image/png"
,
"litemall.png"
);
Resource
resource
=
tencentStorage
.
loadAsResource
(
"litemall.png"
);
String
url
=
tencentStorage
.
generateUrl
(
"litemall.png"
);
System
.
out
.
println
(
"test file "
+
test
);
System
.
out
.
println
(
"store file "
+
resource
.
getURI
());
System
.
out
.
println
(
"generate url "
+
url
);
// tencentStorage.delete("litemall.png");
logger
.
info
(
"test file "
+
test
);
logger
.
info
(
"store file "
+
resource
.
getURI
());
logger
.
info
(
"generate url "
+
url
);
}
}
\ No newline at end of file
litemall-core/src/test/java/org/linlinjava/litemall/core/util/bcrypt/BCryptTest.java
0 → 100644
View file @
324c8da3
package
org.linlinjava.litemall.core.util.bcrypt
;
import
org.junit.Assert
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
org.junit.runner.RunWith
;
import
org.powermock.api.mockito.PowerMockito
;
import
org.powermock.core.classloader.annotations.PrepareForTest
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
java.security.SecureRandom
;
@RunWith
(
PowerMockRunner
.
class
)
public
class
BCryptTest
{
@Rule
public
final
ExpectedException
thrown
=
ExpectedException
.
none
();
@Test
public
void
testHashpwSaltIsNull
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
null
);
}
@Test
public
void
testHashpwSaltTooShort
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"foo"
);
}
@Test
public
void
testHashpwInvalidSaltVersion
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"+2a$10$....................."
);
}
@Test
public
void
testHashpwInvalidSaltVersion2
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"$1a$10$....................."
);
}
@Test
public
void
testHashpwInvalidSaltRevision
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"$2+$10$....................."
);
}
@Test
public
void
testHashpwInvalidSaltRevision2
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"$2a+10$....................."
);
}
@Test
public
void
testHashpwSaltTooShort2
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"$2a$10+....................."
);
}
@Test
public
void
testHashpwMissingSaltRounds
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"$2$a10$....................."
);
}
@Test
public
void
testHashpwTooLittleRounds
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"$2a$03$......................"
);
}
@Test
public
void
testHashpwTooManyRounds
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
hashpw
(
"foo"
,
"$2a$32$......................"
);
}
@Test
public
void
testHashpw
()
{
Assert
.
assertEquals
(
"$2a$10$......................0li5vIK0lccG/IXHAOP2wBncDW/oa2u"
,
BCrypt
.
hashpw
(
"foo"
,
"$2a$10$......................"
));
Assert
.
assertEquals
(
"$2$09$......................GlnmyWmDnFB.MnSSUnFsiPvHsC2KPBm"
,
BCrypt
.
hashpw
(
"foo"
,
"$2$09$......................"
));
}
@PrepareForTest
({
BCrypt
.
class
,
SecureRandom
.
class
})
@Test
public
void
testGensalt
()
throws
Exception
{
PowerMockito
.
whenNew
(
SecureRandom
.
class
).
withNoArguments
()
.
thenReturn
(
PowerMockito
.
mock
(
SecureRandom
.
class
));
Assert
.
assertEquals
(
"$2a$10$......................"
,
BCrypt
.
gensalt
());
Assert
.
assertEquals
(
"$2a$09$......................"
,
BCrypt
.
gensalt
(
9
));
}
@Test
public
void
testGensaltTooLittleRounds
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
gensalt
(
3
);
}
@Test
public
void
testGensaltTooManyRounds
()
throws
IllegalArgumentException
{
thrown
.
expect
(
IllegalArgumentException
.
class
);
BCrypt
.
gensalt
(
32
);
}
@Test
public
void
testCheckpw
()
{
Assert
.
assertFalse
(
BCrypt
.
checkpw
(
"foo"
,
"$2a$10$......................"
));
final
String
hashed
=
BCrypt
.
hashpw
(
"foo"
,
BCrypt
.
gensalt
());
Assert
.
assertTrue
(
BCrypt
.
checkpw
(
"foo"
,
hashed
));
Assert
.
assertFalse
(
BCrypt
.
checkpw
(
"bar"
,
hashed
));
}
}
litemall-db/pom.xml
View file @
324c8da3
...
...
@@ -62,7 +62,7 @@
<dependency>
<groupId>
com.itfsw
</groupId>
<artifactId>
mybatis-generator-plugin
</artifactId>
<version>
1.
2.1
2
</version>
<version>
1.
3.
2
</version>
</dependency>
</dependencies>
</plugin>
...
...
litemall-db/sql/litemall_data.sql
View file @
324c8da3
...
...
@@ -126,6 +126,7 @@ UNLOCK TABLES;
LOCK TABLES `litemall_footprint` WRITE;
/*!40000 ALTER TABLE `litemall_footprint` DISABLE KEYS */;
INSERT INTO `litemall_footprint` VALUES (1,4,1109008,'2019-12-08 19:12:05','2019-12-08 19:12:05',0),(2,4,1110016,'2019-12-08 19:13:42','2019-12-08 19:13:42',0);
/*!40000 ALTER TABLE `litemall_footprint` ENABLE KEYS */;
UNLOCK TABLES;
...
...
@@ -185,7 +186,7 @@ UNLOCK TABLES;
LOCK TABLES `litemall_groupon_rules` WRITE;
/*!40000 ALTER TABLE `litemall_groupon_rules` DISABLE KEYS */;
INSERT INTO `litemall_groupon_rules` VALUES (1,1039051,'多功能午睡枕','http://yanxuan.nosdn.127.net/c8ca0600fa7ba11ca8be6a3173dd38c9.png',20,20,'2018-11-08 13:41:44','2018-11-08 13:41:44',
'2019-12-31 00:00:00',
0),(2,1109008,'云端沙发组合','http://yanxuan.nosdn.127.net/c5be2604c0e4186a4e7079feeb742cee.png',50,5,'2018-11-08 13:42:44','2018-11-08 13:42:44',
'2019-12-31 00:00:00
',0);
INSERT INTO `litemall_groupon_rules` VALUES (1,1039051,'多功能午睡枕','http://yanxuan.nosdn.127.net/c8ca0600fa7ba11ca8be6a3173dd38c9.png',20,20,'
2019-12-31 00:00:00',0,'
2018-11-08 13:41:44','2018-11-08 13:41:44',0),(2,1109008,'云端沙发组合','http://yanxuan.nosdn.127.net/c5be2604c0e4186a4e7079feeb742cee.png',50,5,'
2019-12-31 00:00:00',0,'
2018-11-08 13:42:44','2018-11-08 13:42:44',
0),(3,1110016,'天然硅胶宠物除毛按摩刷','http://yanxuan.nosdn.127.net/3bd73b7279a83d1cbb50c0e45778e6d6.png',39,2,'2020-12-31 00:00:00',0,'2019-12-08 19:13:25','2019-12-08 19:13:25
',0);
/*!40000 ALTER TABLE `litemall_groupon_rules` ENABLE KEYS */;
UNLOCK TABLES;
...
...
@@ -215,6 +216,7 @@ UNLOCK TABLES;
LOCK TABLES `litemall_log` WRITE;
/*!40000 ALTER TABLE `litemall_log` DISABLE KEYS */;
INSERT INTO `litemall_log` VALUES (1,'admin123','0:0:0:0:0:0:0:1',1,'登录',1,'','','2019-12-08 19:12:40','2019-12-08 19:12:40',0);
/*!40000 ALTER TABLE `litemall_log` ENABLE KEYS */;
UNLOCK TABLES;
...
...
@@ -290,6 +292,7 @@ UNLOCK TABLES;
LOCK TABLES `litemall_system` WRITE;
/*!40000 ALTER TABLE `litemall_system` DISABLE KEYS */;
INSERT INTO `litemall_system` VALUES (1,'litemall_order_unpaid','30','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(2,'litemall_wx_index_new','6','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(3,'litemall_mall_latitude','31.201900','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(4,'litemall_order_unconfirm','7','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(5,'litemall_wx_share','false','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(6,'litemall_express_freight_min','88','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(7,'litemall_mall_name','litemall','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(8,'litemall_express_freight_value','8','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(9,'litemall_mall_qq','705144434','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(10,'litemall_wx_index_hot','6','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(11,'litemall_order_comment','7','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(12,'litemall_wx_catlog_goods','4','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(13,'litemall_mall_longitude','121.587839','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(14,'litemall_mall_phone','021-xxxx-xxxx','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(15,'litemall_wx_catlog_list','4','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(16,'litemall_mall_address','上海','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(17,'litemall_wx_index_brand','4','2019-12-08 19:11:18','2019-12-08 19:11:18',0),(18,'litemall_wx_index_topic','4','2019-12-08 19:11:18','2019-12-08 19:11:18',0);
/*!40000 ALTER TABLE `litemall_system` ENABLE KEYS */;
UNLOCK TABLES;
litemall-db/sql/litemall_table.sql
View file @
324c8da3
...
...
@@ -413,17 +413,18 @@ DROP TABLE IF EXISTS `litemall_groupon`;
CREATE
TABLE
`litemall_groupon`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`order_id`
int
(
11
)
NOT
NULL
COMMENT
'关联的订单ID'
,
`groupon_id`
int
(
11
)
DEFAULT
'0'
COMMENT
'
参与的团购ID,仅当user_type不是1
'
,
`groupon_id`
int
(
11
)
DEFAULT
'0'
COMMENT
'
如果是开团用户,则groupon_id是0;如果是参团用户,则groupon_id是团购活动ID
'
,
`rules_id`
int
(
11
)
NOT
NULL
COMMENT
'团购规则ID,关联litemall_groupon_rules表ID字段'
,
`user_id`
int
(
11
)
NOT
NULL
COMMENT
'用户ID'
,
`creator_user_id`
int
(
11
)
NOT
NULL
COMMENT
'创建者ID'
,
`share_url`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'团购分享图片地址'
,
`creator_user_id`
int
(
11
)
NOT
NULL
COMMENT
'开团用户ID'
,
`creator_user_time`
datetime
DEFAULT
NULL
COMMENT
'开团时间'
,
`status`
smallint
(
6
)
DEFAULT
'0'
COMMENT
'团购活动状态,开团未支付则0,开团中则1,开团失败则2'
,
`add_time`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
`share_url`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'团购分享图片地址'
,
`payed`
tinyint
(
1
)
NOT
NULL
COMMENT
'是否已经支付'
,
`deleted`
tinyint
(
1
)
DEFAULT
'0'
COMMENT
'逻辑删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'团购活动表'
;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
...
...
@@ -440,12 +441,13 @@ CREATE TABLE `litemall_groupon_rules` (
`pic_url`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'商品图片或者商品货品图片'
,
`discount`
decimal
(
63
,
0
)
NOT
NULL
COMMENT
'优惠金额'
,
`discount_member`
int
(
11
)
NOT
NULL
COMMENT
'达到优惠条件的人数'
,
`expire_time`
datetime
DEFAULT
NULL
COMMENT
'团购过期时间'
,
`status`
smallint
(
6
)
DEFAULT
'0'
COMMENT
'团购规则状态,正常上线则0,到期自动下线则1,管理手动下线则2'
,
`add_time`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
`expire_time`
datetime
DEFAULT
NULL
COMMENT
'团购过期时间'
,
`deleted`
tinyint
(
1
)
DEFAULT
'0'
COMMENT
'逻辑删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
4
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'团购规则表'
;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
...
...
@@ -538,6 +540,10 @@ CREATE TABLE `litemall_order` (
`ship_sn`
varchar
(
63
)
DEFAULT
NULL
COMMENT
'发货编号'
,
`ship_channel`
varchar
(
63
)
DEFAULT
NULL
COMMENT
'发货快递公司'
,
`ship_time`
datetime
DEFAULT
NULL
COMMENT
'发货开始时间'
,
`refund_amount`
decimal
(
10
,
2
)
DEFAULT
NULL
COMMENT
'实际退款金额,(有可能退款金额小于实际支付金额)'
,
`refund_type`
varchar
(
63
)
DEFAULT
NULL
COMMENT
'退款方式'
,
`refund_content`
varchar
(
127
)
DEFAULT
NULL
COMMENT
'退款备注'
,
`refund_time`
datetime
DEFAULT
NULL
COMMENT
'退款时间'
,
`confirm_time`
datetime
DEFAULT
NULL
COMMENT
'用户确认收货时间'
,
`comments`
smallint
(
6
)
DEFAULT
'0'
COMMENT
'待评价订单商品数量'
,
`end_time`
datetime
DEFAULT
NULL
COMMENT
'订单关闭时间'
,
...
...
@@ -689,7 +695,7 @@ CREATE TABLE `litemall_system` (
`update_time`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
`deleted`
tinyint
(
1
)
DEFAULT
'0'
COMMENT
'逻辑删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'系统配置表'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
19
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'系统配置表'
;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
...
...
@@ -777,4 +783,4 @@ CREATE TABLE `litemall_user_formid` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */
;
-- Dump completed on 201
8
-12-1
0 16:59:09
-- Dump completed on 201
9
-12-1
6 23:12:57
Prev
1
…
9
10
11
12
13
14
15
16
17
…
20
Next
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