Search in sources :

Example 6 with UserActionDO

use of org.neusoft.neubbs.entity.UserActionDO in project neubbs by nuitcoder.

the class UserActionDAOTest method testUpdateUserActionByIndexRemoveElement.

/**
 * 测试更新用户行为,JSON 数组根据索引,删除元素
 *      - 喜欢话题 id
 *      - 收藏话题 id
 *      - 关注话题 id
 *      - 主动关注用户 id
 *      - 被关注用户 id
 */
@Test
@Transactional
public void testUpdateUserActionByIndexRemoveElement() {
    UserActionDO userAction = this.saveTestUserActionDOToDatabase();
    // add element
    int userId = userAction.getUserId();
    int topicId = 1;
    int followingUserId = 2;
    int followedUserId = 3;
    Assert.assertEquals(1, userActionDAO.updateLikeTopicIdJsonArrayByOneTopicIdToAppendEnd(userId, topicId));
    Assert.assertEquals(1, userActionDAO.updateCollectTopicIdJsonArrayByOneTopicIdToAppendEnd(userId, topicId));
    Assert.assertEquals(1, userActionDAO.updateAttentionTopicIdJsonArrayByOneTopicIdToAppendEnd(userId, topicId));
    Assert.assertEquals(1, userActionDAO.updateFollowingUserIdJsonArrayByOneUserIdToAppendEnd(userId, followingUserId));
    Assert.assertEquals(1, userActionDAO.updateFollowedUserIdJsonArrayByOneUserIdToAppendEnd(userId, followedUserId));
    System.out.println("before remove: " + userActionDAO.getUserAction(userId));
    // remove element
    int indexOfTopicId = 0;
    int indexOfFollowingUserId = 0;
    int indexOfFollowedUserId = 0;
    Assert.assertEquals(1, userActionDAO.updateLikeTopicIdJsonArrayByIndexToRemoveOneTopicId(userId, indexOfTopicId));
    Assert.assertEquals(1, userActionDAO.updateCollectTopicIdJsonArrayByIndexToRemoveOneTopicId(userId, indexOfTopicId));
    Assert.assertEquals(1, userActionDAO.updateAttentionTopicIdJsonArrayByIndexToRemoveOneTopicId(userId, indexOfTopicId));
    System.out.println("success pass update to remove like, collect, attention topic test!");
    Assert.assertEquals(1, userActionDAO.updateFollowingUserIdJsonArrayByIndexToRemoveOneUserId(userId, indexOfFollowingUserId));
    Assert.assertEquals(1, userActionDAO.updateFollowedUserIdJsonArrayByIndexToRemoveOneUserId(userId, indexOfFollowedUserId));
    System.out.println("success pass update to remove following, followed user test!");
    System.out.println("after remove: " + userActionDAO.getUserAction(userId));
}
Also used : UserActionDO(org.neusoft.neubbs.entity.UserActionDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 7 with UserActionDO

use of org.neusoft.neubbs.entity.UserActionDO in project neubbs by nuitcoder.

the class UserActionDAOTest method testGetUserActionCollectTopicIdJsonArray.

/**
 * 测试获取用户收藏话题 id 数组
 */
@Test
@Transactional
public void testGetUserActionCollectTopicIdJsonArray() {
    UserActionDO userActionDO = this.saveTestUserActionDOToDatabase();
    int userId = userActionDO.getUserId();
    Assert.assertEquals("[]", userActionDAO.getUserActionCollectTopicIdJsonArray(userId));
    System.out.println("get userId=" + userId + "collect topic json array success!");
}
Also used : UserActionDO(org.neusoft.neubbs.entity.UserActionDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 8 with UserActionDO

use of org.neusoft.neubbs.entity.UserActionDO in project neubbs by nuitcoder.

the class UserActionDAOTest method testGetUserActionFollowingUserIdJsonArray.

/**
 * 测试获取用户主动关注用户 id 数组
 */
@Test
@Transactional
public void testGetUserActionFollowingUserIdJsonArray() {
    UserActionDO userActionDO = this.saveTestUserActionDOToDatabase();
    int userId = userActionDO.getUserId();
    Assert.assertEquals("[]", userActionDAO.getUserActionFollowingUserIdJsonArray(userId));
    System.out.println("get userId=" + userId + " following user json array success!");
}
Also used : UserActionDO(org.neusoft.neubbs.entity.UserActionDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 9 with UserActionDO

use of org.neusoft.neubbs.entity.UserActionDO in project neubbs by nuitcoder.

the class UserActionDAOTest method testSaveAction.

/**
 * 测试保存用户行为
 */
@Test
@Transactional
public void testSaveAction() {
    UserActionDO userAction = this.saveTestUserActionDOToDatabase();
    System.out.println("insert user action information: " + userAction);
}
Also used : UserActionDO(org.neusoft.neubbs.entity.UserActionDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 10 with UserActionDO

use of org.neusoft.neubbs.entity.UserActionDO in project neubbs by nuitcoder.

the class UserActionDAOTest method testGetUserActionFollowedUserIdJsonArray.

/**
 * 测试获取用户被关注用户 id 数组
 */
@Test
@Transactional
public void testGetUserActionFollowedUserIdJsonArray() {
    UserActionDO userActionDO = this.saveTestUserActionDOToDatabase();
    int userId = userActionDO.getUserId();
    Assert.assertEquals("[]", userActionDAO.getUserActionFollowedUserIdJsonArray(userId));
    System.out.println("get userId=" + userId + " followed user json array success!");
}
Also used : UserActionDO(org.neusoft.neubbs.entity.UserActionDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Aggregations

UserActionDO (org.neusoft.neubbs.entity.UserActionDO)12 Transactional (javax.transaction.Transactional)9 Test (org.junit.Test)9 UserDO (org.neusoft.neubbs.entity.UserDO)3 UserDynamicDO (org.neusoft.neubbs.entity.UserDynamicDO)1 ServiceException (org.neusoft.neubbs.exception.ServiceException)1