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());
}
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;
}
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!");
}
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);
}
}
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);
}
}
Aggregations