OCT
REM: 1. 增加测试用例注释 2. 修改SQL语句,解决MyBatisSystemException问题
This commit is contained in:
parent
46e160949e
commit
7a0c58f294
|
@ -92,7 +92,7 @@
|
||||||
<update id="delUserAccount">
|
<update id="delUserAccount">
|
||||||
UPDATE
|
UPDATE
|
||||||
user_account
|
user_account
|
||||||
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getCode()},
|
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getValue()},
|
||||||
operators = #{operators},
|
operators = #{operators},
|
||||||
lockTime = CURRENT_TIMESTAMP
|
lockTime = CURRENT_TIMESTAMP
|
||||||
WHERE username = #{username, jdbcType=VARCHAR}
|
WHERE username = #{username, jdbcType=VARCHAR}
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
<update id="disableUserAccount">
|
<update id="disableUserAccount">
|
||||||
UPDATE
|
UPDATE
|
||||||
user_account
|
user_account
|
||||||
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getCode()},
|
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getValue()},
|
||||||
operators = #{operators},
|
operators = #{operators},
|
||||||
lockTime = CURRENT_TIMESTAMP
|
lockTime = CURRENT_TIMESTAMP
|
||||||
WHERE username = #{username, jdbcType=VARCHAR}
|
WHERE username = #{username, jdbcType=VARCHAR}
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
<update id="lockUserAccount">
|
<update id="lockUserAccount">
|
||||||
UPDATE
|
UPDATE
|
||||||
user_account
|
user_account
|
||||||
SET status = ${@com.dispose.common.ObjectStatus@LOCKED.getCode()},
|
SET status = ${@com.dispose.common.ObjectStatus@LOCKED.getValue()},
|
||||||
lockTime = CURRENT_TIMESTAMP
|
lockTime = CURRENT_TIMESTAMP
|
||||||
WHERE username = #{username, jdbcType=VARCHAR}
|
WHERE username = #{username, jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
<update id="unlockUserAccount">
|
<update id="unlockUserAccount">
|
||||||
UPDATE
|
UPDATE
|
||||||
user_account
|
user_account
|
||||||
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getCode()},
|
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()},
|
||||||
lockTime = 0
|
lockTime = 0
|
||||||
WHERE username = #{username, jdbcType=VARCHAR}
|
WHERE username = #{username, jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
|
|
@ -48,8 +48,11 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
public void userLogin() {
|
public void userLogin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 1 get UserAccount by token.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a1_getUserByName() {
|
public void a1_getUserByToken() {
|
||||||
userAccountMapper.selectAll().forEach(v -> {
|
userAccountMapper.selectAll().forEach(v -> {
|
||||||
try {
|
try {
|
||||||
String token = userAccountManager.getUserToken(v.getUsername());
|
String token = userAccountManager.getUserToken(v.getUsername());
|
||||||
|
@ -68,8 +71,11 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 2 get UserAccount by name.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a2_getUserByToken() {
|
public void a2_getUserByName() {
|
||||||
userAccountMapper.selectAll().forEach(v -> {
|
userAccountMapper.selectAll().forEach(v -> {
|
||||||
UserAccount user = userAccountManager.getUserByName(v.getUsername());
|
UserAccount user = userAccountManager.getUserByName(v.getUsername());
|
||||||
|
|
||||||
|
@ -86,6 +92,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 3 get UserAccount by name.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a3_getUserToken() {
|
public void a3_getUserToken() {
|
||||||
userAccountMapper.selectAll().forEach(v -> {
|
userAccountMapper.selectAll().forEach(v -> {
|
||||||
|
@ -101,6 +110,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 4 set UserAccount password error times.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a4_setUserPwdErrTimes() {
|
public void a4_setUserPwdErrTimes() {
|
||||||
userAccountMapper.selectAll().forEach(v -> {
|
userAccountMapper.selectAll().forEach(v -> {
|
||||||
|
@ -125,6 +137,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A5 clean user token.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a5_cleanUserToken() {
|
public void a5_cleanUserToken() {
|
||||||
userAccountMapper.selectAll().forEach(v -> {
|
userAccountMapper.selectAll().forEach(v -> {
|
||||||
|
@ -147,6 +162,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A6 Verify token error code.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a6_verifyTokenTest() throws NoSuchAlgorithmException {
|
public void a6_verifyTokenTest() throws NoSuchAlgorithmException {
|
||||||
String userToken = userAccountManager.getUserToken(getUSER_NAME());
|
String userToken = userAccountManager.getUserToken(getUSER_NAME());
|
||||||
|
@ -157,6 +175,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
Assert.assertEquals(userAccountManager.verifyToken(userToken + "123"), ErrorCode.ERR_LOGOUT);
|
Assert.assertEquals(userAccountManager.verifyToken(userToken + "123"), ErrorCode.ERR_LOGOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A7 Lock and Unlock user account. Disable and Delete user account.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a7_userAccountStatus() {
|
public void a7_userAccountStatus() {
|
||||||
userAccountMapper.selectAll().forEach(v -> {
|
userAccountMapper.selectAll().forEach(v -> {
|
||||||
|
@ -186,6 +207,9 @@ public class UserAccountManagerTest extends InitTestEnvironment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A8 Verify token permission.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a8_verifyTokePermission() {
|
public void a8_verifyTokePermission() {
|
||||||
userAccountMapper.selectAll().forEach(v -> {
|
userAccountMapper.selectAll().forEach(v -> {
|
||||||
|
|
Loading…
Reference in New Issue