Search in sources :

Example 6 with TopicDO

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

the class TopicDAOTest method saveTestTopicToDB.

/**
 * 保存测试话题对象至数据库
 *
 * @return TopicDO 数据库保存后,重新 id 查询的测试对象
 */
private TopicDO saveTestTopicToDB() {
    TopicDO topic = this.getTestTopicDO();
    Assert.assertEquals(1, topicDAO.saveTopic(topic));
    return topicDAO.getTopicById(topic.getId());
}
Also used : TopicDO(org.neusoft.neubbs.entity.TopicDO)

Example 7 with TopicDO

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

the class TopicDAOTest method getTestTopicDO.

/**
 * 获取测试对象
 *      - need ft_id=1 from forum_user
 *      - need ftcg_id=1 from forum_topic_category
 *
 * @return TopicDO 测试对象
 */
private TopicDO getTestTopicDO() {
    TopicDO topic = new TopicDO();
    topic.setUserid(1);
    topic.setCategoryid(1);
    topic.setTitle("new topic content");
    return topic;
}
Also used : TopicDO(org.neusoft.neubbs.entity.TopicDO)

Example 8 with TopicDO

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

the class TopicDAOTest method testUpdateLastReplyUserIdById.

/**
 * 测试更新最后回复人 id
 */
@Test
@Transactional
public void testUpdateLastReplyUserIdById() {
    TopicDO topic = this.saveTestTopicToDB();
    Integer newLastReplyUserId = 2;
    Assert.assertEquals(1, topicDAO.updateLastReplyUserIdById(topic.getId(), newLastReplyUserId));
    Assert.assertNotEquals(topic.getLastreplyuserid(), topicDAO.getTopicById(topic.getId()).getLastreplyuserid());
    System.out.println("update topicId=" + topic.getId() + " topic lastreplyuserid=<" + newLastReplyUserId + "> success!");
}
Also used : TopicDO(org.neusoft.neubbs.entity.TopicDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 9 with TopicDO

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

the class TopicDAOTest method testListTopicOrderByCreateTimeDESCByRepliesDESCLimitTen.

/**
 * 测试(降序,仅输入 count)获取话题列表
 */
@Test
@Transactional
public void testListTopicOrderByCreateTimeDESCByRepliesDESCLimitTen() {
    this.saveTestTopicToDB();
    List<TopicDO> listTopic = topicDAO.listTopicOrderByCreatetimeDESCByRepliesDESCLimitTen();
    Assert.assertTrue(listTopic.size() >= 1);
    for (TopicDO topic : listTopic) {
        System.out.println("output topic information:" + topic);
    }
}
Also used : TopicDO(org.neusoft.neubbs.entity.TopicDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 10 with TopicDO

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

the class TopicDAOTest method testListTopicDESCByStartRowByCountByCategoryIdByUserId.

/**
 * 测试(降序,话题分类 id,用户 id)获取话题列表
 */
@Test
@Transactional
public void testListTopicDESCByStartRowByCountByCategoryIdByUserId() {
    this.saveTestTopicToDB();
    // first page
    int startRow = 0, count = 10;
    int ccategoryId = 1, userId = 1;
    List<TopicDO> listTopic = topicDAO.listTopicDESCByStartRowByCountByCategoryIdByUserId(startRow, count, ccategoryId, userId);
    Assert.assertTrue(listTopic.size() >= 1);
    // foreach list
    int recordCount = 1;
    for (TopicDO topic : listTopic) {
        System.out.println("output categoryid=" + ccategoryId + " and userid=" + userId + " topic information (No." + (recordCount++) + " recoders): " + topic);
    }
}
Also used : TopicDO(org.neusoft.neubbs.entity.TopicDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Aggregations

TopicDO (org.neusoft.neubbs.entity.TopicDO)28 Test (org.junit.Test)19 Transactional (javax.transaction.Transactional)18 Map (java.util.Map)5 TopicContentDO (org.neusoft.neubbs.entity.TopicContentDO)4 TopicReplyDO (org.neusoft.neubbs.entity.TopicReplyDO)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 TopicCategoryDO (org.neusoft.neubbs.entity.TopicCategoryDO)3 TopicActionDO (org.neusoft.neubbs.entity.TopicActionDO)2 ServiceException (org.neusoft.neubbs.exception.ServiceException)2 MvcResult (org.springframework.test.web.servlet.MvcResult)2 Date (java.util.Date)1 UserDO (org.neusoft.neubbs.entity.UserDO)1