Search in sources :

Example 1 with MessageDO

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

the class MessageDAOTest method testGetMessage.

/**
 * 测试获取消息信息
 */
@Test
@Transactional
public void testGetMessage() {
    MessageDO message = this.saveTestMessageDOToDatabase();
    System.out.println("get message information: " + message);
}
Also used : MessageDO(org.neusoft.neubbs.entity.MessageDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 2 with MessageDO

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

the class MessageDAOTest method saveTestMessageDOToDatabase.

/**
 * 保存测试消息至数据库
 *
 * @return MessageDO 重查询的消息对象
 */
private MessageDO saveTestMessageDOToDatabase() {
    MessageDO message = new MessageDO();
    message.setSource("System Notice");
    message.setSenderId(1);
    message.setContent("welcome all user!");
    message.setReceiverId(6);
    Assert.assertEquals(1, messageDAO.saveMessage(message));
    return messageDAO.getMessage(message.getId());
}
Also used : MessageDO(org.neusoft.neubbs.entity.MessageDO)

Example 3 with MessageDO

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

the class MessageDAOTest method testUpdateMessageReceiveTime.

/**
 * 测试更新接收时间
 */
@Test
@Transactional
public void testUpdateMessageReceiveTime() {
    MessageDO message = this.saveTestMessageDOToDatabase();
    int messageId = message.getId();
    Assert.assertEquals(1, messageDAO.updateMessageReceiveTime(messageId));
    MessageDO afterMessage = messageDAO.getMessage(messageId);
    Date afterReceiveTime = afterMessage.getReceiveTime();
    Assert.assertNotNull(afterMessage);
    System.out.println("update id=" + messageId + " message receive time=<" + afterReceiveTime + ">");
}
Also used : Date(java.util.Date) MessageDO(org.neusoft.neubbs.entity.MessageDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 4 with MessageDO

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

the class MessageDAOTest method testSaveMessage.

/**
 * 测试保存消息
 */
@Test
@Transactional
public void testSaveMessage() {
    MessageDO message = this.saveTestMessageDOToDatabase();
    System.out.println("success save message: " + message);
}
Also used : MessageDO(org.neusoft.neubbs.entity.MessageDO) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Aggregations

MessageDO (org.neusoft.neubbs.entity.MessageDO)4 Transactional (javax.transaction.Transactional)3 Test (org.junit.Test)3 Date (java.util.Date)1