Search in sources :

Example 1 with TopicContentDO

use of org.neusoft.neubbs.entity.TopicContentDO 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 2 with TopicContentDO

use of org.neusoft.neubbs.entity.TopicContentDO 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 3 with TopicContentDO

use of org.neusoft.neubbs.entity.TopicContentDO 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 4 with TopicContentDO

use of org.neusoft.neubbs.entity.TopicContentDO 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 5 with TopicContentDO

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

the class MapFilterUtilTest method testFilterTopicContentInfo.

/**
 * 测试 filterTopicContentInfo()
 */
@Test
public void testFilterTopicContentInfo() {
    TopicContentDO topicContent = new TopicContentDO();
    topicContent.setId(1);
    topicContent.setTopicid(1);
    Map<String, Object> topicContentInfoMap = JsonUtil.toMapByObject(topicContent);
    System.out.println("filter before: " + topicContentInfoMap);
    MapFilterUtil.filterTopicContentInfo(topicContentInfoMap);
    System.out.println("filter after: " + topicContentInfoMap);
    Assert.assertNotNull(topicContentInfoMap);
    Assert.assertNull(topicContentInfoMap.get(ParamConst.ID));
    Assert.assertNull(topicContentInfoMap.get(ParamConst.ID));
}
Also used : TopicContentDO(org.neusoft.neubbs.entity.TopicContentDO) Test(org.junit.Test)

Aggregations

TopicContentDO (org.neusoft.neubbs.entity.TopicContentDO)14 Test (org.junit.Test)10 Transactional (javax.transaction.Transactional)9 TopicDO (org.neusoft.neubbs.entity.TopicDO)4 TopicCategoryDO (org.neusoft.neubbs.entity.TopicCategoryDO)3 UserDO (org.neusoft.neubbs.entity.UserDO)2 ServiceException (org.neusoft.neubbs.exception.ServiceException)2 JSONArray (com.alibaba.fastjson.JSONArray)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Cookie (javax.servlet.http.Cookie)1 TopicActionDO (org.neusoft.neubbs.entity.TopicActionDO)1 TopicReplyDO (org.neusoft.neubbs.entity.TopicReplyDO)1