use of org.neusoft.neubbs.entity.TopicActionDO in project neubbs by nuitcoder.
the class TopicActionDAOTest method testGetTopicActionAllJsonArray.
/**
* 测试获取话题行为用户 id 数组
* - 回复用户 id 数组
* - 喜欢用户 id 数组
* - 收藏用户 id 数组
* - 关注用户 id 数组
*/
@Test
@Transactional
public void testGetTopicActionAllJsonArray() {
TopicActionDO topicAction = this.saveTestTopicActionDOToDatabase();
int topicId = topicAction.getTopicId();
Assert.assertNotNull(topicActionDAO.getTopicActionReplyUserIdJsonArray(topicId));
Assert.assertNotNull(topicActionDAO.getTopicActionLikeUserIdJsonArray(topicId));
Assert.assertNotNull(topicActionDAO.getTopicActionCollectUserIdJsonArray(topicId));
Assert.assertNotNull(topicActionDAO.getTopicActionAttentionUserIdJsonArray(topicId));
System.out.println("test alone get reply, like, collect, attention topic action success!");
}
use of org.neusoft.neubbs.entity.TopicActionDO in project neubbs by nuitcoder.
the class TopicActionDAOTest method testRemoveTopicAction.
/**
* 测试删除话题行为
*/
@Test
@Transactional
public void testRemoveTopicAction() {
TopicActionDO topicAction = this.saveTestTopicActionDOToDatabase();
System.out.println(topicAction.toString());
Assert.assertEquals(1, topicActionDAO.removeTopicAction(topicAction.getTopicId()));
System.out.println("success remove topic action topicId = " + topicAction.getTopicId());
}
use of org.neusoft.neubbs.entity.TopicActionDO in project neubbs by nuitcoder.
the class TopicActionDAOTest method testSaveTopicAction.
/**
* 测试保存话题行为
*/
@Test
@Transactional
public void testSaveTopicAction() {
TopicActionDO topicAction = this.saveTestTopicActionDOToDatabase();
System.out.println("success insert topic action information: " + topicAction);
}
use of org.neusoft.neubbs.entity.TopicActionDO in project neubbs by nuitcoder.
the class TopicActionDAOTest method testUpdateTopicActionByOneUserIdToAppendEnd.
/**
* 测试更新话题行为用户 id 数组(JSON 末尾插入单个用户 id)
* - 插入回复用户 id 数组
* - 插入喜欢用户 id 数组
* - 插入收藏用户 id 数组
* - 插入关注用户 id 数组
*/
@Test
@Transactional
public void testUpdateTopicActionByOneUserIdToAppendEnd() {
TopicActionDO topicAction = this.saveTestTopicActionDOToDatabase();
int topicId = topicAction.getTopicId();
int insertUserId = 2;
Assert.assertEquals(1, topicActionDAO.updateReplyUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
Assert.assertEquals(1, topicActionDAO.updateLikeUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
Assert.assertEquals(1, topicActionDAO.updateCollectUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
Assert.assertEquals(1, topicActionDAO.updateAttentionUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
System.out.println("test pass update to add reply, like, collect, attention user id success!");
}
use of org.neusoft.neubbs.entity.TopicActionDO in project neubbs by nuitcoder.
the class TopicActionDAOTest method testUpdateTopicActionByIndexRemoveOneUserId.
/**
* 测试更新话题行为用户 id 数组(JSON 数组,根据索引, 删除指定元素)
*/
@Test
@Transactional
public void testUpdateTopicActionByIndexRemoveOneUserId() {
TopicActionDO topicAction = this.saveTestTopicActionDOToDatabase();
int topicId = topicAction.getTopicId();
int insertUserId = 2;
Assert.assertEquals(1, topicActionDAO.updateReplyUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
Assert.assertEquals(1, topicActionDAO.updateLikeUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
Assert.assertEquals(1, topicActionDAO.updateCollectUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
Assert.assertEquals(1, topicActionDAO.updateAttentionUserIdJsonArrayByOneUserIdToAppendEnd(topicId, insertUserId));
System.out.println("before remove: " + topicActionDAO.getTopicAction(topicId));
int indexOfRemoveUserId = 0;
Assert.assertEquals(1, topicActionDAO.updateReplyUserIdJsonArrayByIndexToRemoveOneUserId(topicId, indexOfRemoveUserId));
Assert.assertEquals(1, topicActionDAO.updateLikeUserIdJsonArrayByIndexToRemoveOneUserId(topicId, indexOfRemoveUserId));
Assert.assertEquals(1, topicActionDAO.updateCollectUserIdJsonArrayByIndexToRemoveOneUserId(topicId, indexOfRemoveUserId));
Assert.assertEquals(1, topicActionDAO.updateAttentionUserIdJsonArrayByIndexToRemoveOneUserId(topicId, indexOfRemoveUserId));
System.out.println("after remove: " + topicActionDAO.getTopicAction(topicId));
System.out.println("success pass update topic action to remove reply, like, collect, attention userId!");
}
Aggregations