Search in sources :

Example 86 with Transactional

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!");
}
Also used : TopicContentDO(org.neusoft.neubbs.entity.TopicContentDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 87 with Transactional

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!");
}
Also used : TopicContentDO(org.neusoft.neubbs.entity.TopicContentDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 88 with Transactional

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");
}
Also used : TopicContentDO(org.neusoft.neubbs.entity.TopicContentDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 89 with Transactional

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!");
}
Also used : TopicContentDO(org.neusoft.neubbs.entity.TopicContentDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 90 with Transactional

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!");
}
Also used : TopicActionDO(org.neusoft.neubbs.entity.TopicActionDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Aggregations

Transactional (javax.transaction.Transactional)299 Test (org.junit.Test)99 PostResult (org.collectiveone.common.dto.PostResult)29 ArrayList (java.util.ArrayList)24 UserDO (org.neusoft.neubbs.entity.UserDO)21 Timestamp (java.sql.Timestamp)18 TopicDO (org.neusoft.neubbs.entity.TopicDO)18 Initiative (org.collectiveone.modules.initiatives.Initiative)16 GetResult (org.collectiveone.common.dto.GetResult)15 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)13 TopicReplyDO (org.neusoft.neubbs.entity.TopicReplyDO)13 HashMap (java.util.HashMap)12 Date (java.util.Date)11 AppUser (org.collectiveone.modules.users.AppUser)11 UUID (java.util.UUID)10 RolesAllowed (javax.annotation.security.RolesAllowed)10 PeerReviewedAssignation (org.collectiveone.modules.assignations.evaluationlogic.PeerReviewedAssignation)10 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)10 IOException (java.io.IOException)9 TopicContentDO (org.neusoft.neubbs.entity.TopicContentDO)9