use of javax.transaction.Transactional in project neubbs by nuitcoder.
the class TopicContentDAOTest method testUpdateContentById.
/**
* 测试更新话题内容
*/
@Test
@Transactional
public void testUpdateContentById() {
TopicContentDO topicContent = this.savaTestTopicContentDOToDatabase();
int topicId = topicContent.getTopicid();
String newContent = "new topic content";
Assert.assertEquals(1, topicContentDAO.updateContentByTopicId(topicId, newContent));
Assert.assertEquals(newContent, topicContentDAO.getTopicContentByTopicId(topicId).getContent());
System.out.println("update topicId=" + topicId + " topic content=<" + newContent + "> success!");
}
use of javax.transaction.Transactional in project neubbs by nuitcoder.
the class TopicContentDAOTest method test56_updateAgreeCutOneByTopicId.
/**
* 测试更新喜欢人数(自动 -1)
*/
@Test
@Transactional
public void test56_updateAgreeCutOneByTopicId() {
TopicContentDO topicContent = this.savaTestTopicContentDOToDatabase();
int topicId = topicContent.getTopicid();
int beforeLike = topicContent.getLike();
Assert.assertEquals(1, topicContentDAO.updateLikeCutOneByTopicId(topicId));
int afterLike = topicContentDAO.getTopicContentByTopicId(topicId).getLike();
Assert.assertEquals(beforeLike - 1, afterLike);
System.out.println("update topicId=" + topicId + " topic content like-1 success!");
}
use of javax.transaction.Transactional in project neubbs by nuitcoder.
the class TopicContentDAOTest method testRemoveTopicContentByTopicId.
/**
* 测试删除话题内容
*/
@Test
@Transactional
public void testRemoveTopicContentByTopicId() {
TopicContentDO topicContent = this.savaTestTopicContentDOToDatabase();
int topicId = topicContent.getTopicid();
Assert.assertEquals(1, topicContentDAO.removeTopicContentByTopicId(topicId));
Assert.assertNull(topicContentDAO.getTopicContentByTopicId(topicId));
System.out.println("delete topicid=" + topicContent.getTopicid() + " topic content");
}
use of javax.transaction.Transactional in project neubbs by nuitcoder.
the class TopicContentDAOTest method testUpdateAgreeAddOneByTopicId.
/**
* 测试更新喜欢人数(自动 +1)
*/
@Test
@Transactional
public void testUpdateAgreeAddOneByTopicId() {
TopicContentDO topicContent = this.savaTestTopicContentDOToDatabase();
int topicId = topicContent.getTopicid();
int beforeLike = topicContent.getLike();
Assert.assertEquals(1, topicContentDAO.updateLikeAddOneByTopicId(topicId));
int affterLike = topicContentDAO.getTopicContentByTopicId(topicId).getLike();
Assert.assertEquals(beforeLike + 1, affterLike);
System.out.println("update topicId=" + topicId + " topic content like+1 success!");
}
use of javax.transaction.Transactional 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!");
}
Aggregations