REM:
1. 增加测试用例注释
2. 修改SQL语句,解决MyBatisSystemException问题
This commit is contained in:
chenlinghy 2020-08-05 11:29:53 +08:00
parent 46e160949e
commit 7a0c58f294
2 changed files with 30 additions and 6 deletions

View File

@ -92,7 +92,7 @@
<update id="delUserAccount">
UPDATE
user_account
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getCode()},
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getValue()},
operators = #{operators},
lockTime = CURRENT_TIMESTAMP
WHERE username = #{username, jdbcType=VARCHAR}
@ -101,7 +101,7 @@
<update id="disableUserAccount">
UPDATE
user_account
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getCode()},
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getValue()},
operators = #{operators},
lockTime = CURRENT_TIMESTAMP
WHERE username = #{username, jdbcType=VARCHAR}
@ -110,7 +110,7 @@
<update id="lockUserAccount">
UPDATE
user_account
SET status = ${@com.dispose.common.ObjectStatus@LOCKED.getCode()},
SET status = ${@com.dispose.common.ObjectStatus@LOCKED.getValue()},
lockTime = CURRENT_TIMESTAMP
WHERE username = #{username, jdbcType=VARCHAR}
</update>
@ -118,7 +118,7 @@
<update id="unlockUserAccount">
UPDATE
user_account
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getCode()},
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()},
lockTime = 0
WHERE username = #{username, jdbcType=VARCHAR}
</update>

View File

@ -48,8 +48,11 @@ public class UserAccountManagerTest extends InitTestEnvironment {
public void userLogin() {
}
/**
* A 1 get UserAccount by token.
*/
@Test
public void a1_getUserByName() {
public void a1_getUserByToken() {
userAccountMapper.selectAll().forEach(v -> {
try {
String token = userAccountManager.getUserToken(v.getUsername());
@ -68,8 +71,11 @@ public class UserAccountManagerTest extends InitTestEnvironment {
});
}
/**
* A 2 get UserAccount by name.
*/
@Test
public void a2_getUserByToken() {
public void a2_getUserByName() {
userAccountMapper.selectAll().forEach(v -> {
UserAccount user = userAccountManager.getUserByName(v.getUsername());
@ -86,6 +92,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
});
}
/**
* A 3 get UserAccount by name.
*/
@Test
public void a3_getUserToken() {
userAccountMapper.selectAll().forEach(v -> {
@ -101,6 +110,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
});
}
/**
* A 4 set UserAccount password error times.
*/
@Test
public void a4_setUserPwdErrTimes() {
userAccountMapper.selectAll().forEach(v -> {
@ -125,6 +137,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
});
}
/**
* A5 clean user token.
*/
@Test
public void a5_cleanUserToken() {
userAccountMapper.selectAll().forEach(v -> {
@ -147,6 +162,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
});
}
/**
* A6 Verify token error code.
*/
@Test
public void a6_verifyTokenTest() throws NoSuchAlgorithmException {
String userToken = userAccountManager.getUserToken(getUSER_NAME());
@ -157,6 +175,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
Assert.assertEquals(userAccountManager.verifyToken(userToken + "123"), ErrorCode.ERR_LOGOUT);
}
/**
* A7 Lock and Unlock user account. Disable and Delete user account.
*/
@Test
public void a7_userAccountStatus() {
userAccountMapper.selectAll().forEach(v -> {
@ -186,6 +207,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
});
}
/**
* A8 Verify token permission.
*/
@Test
public void a8_verifyTokePermission() {
userAccountMapper.selectAll().forEach(v -> {