Examples of Talk


Examples of models.Talk

        assertEquals(c, ca.comment);
    }

    @Test
    public void addCommentNonValid() {
        Talk t = createTalk("test");
        // Ensure the talk is unvalid
        t.valid = false;
        t.save();
       
        // Non activity for the session
        assertEquals(0, Activity.count("session = ?", t));
       
        SessionComment c = new SessionComment(member, t, "Un commentaire");
        t.addComment(c);
        t.save();
       
        // Still no activity for the session
        assertEquals(0, Activity.count("session = ?", t));
       
        t.validate();
        // 1 comment activity amongst others
        assertEquals(1, CommentSessionActivity.count("session = ?", t));
        Activity a = CommentSessionActivity.find("session = ?", t).first();
        assertActivity(a);
        assertTrue(a instanceof CommentSessionActivity);
View Full Code Here

Examples of models.Talk

    protected Article createArticle(String title) {
        return new Article(member, title).save();
    }

    protected Talk createTalk(String title) {
        Talk t = new Talk();
        t.title = title;
        return t.save();
    }
View Full Code Here

Examples of models.Talk

public class NewTalkActivityTest extends AbstractActivityTest {
   
    @Test
    public void validateSession() {
       
        Talk t = createTalk("test");
       
        // No activity for the talk
        assertEquals(0, Activity.count("session = ?", t));
        assertNull(Activity.find("session = ?", t).first());
       
        t.validate();
       
        // One activity for the session
        assertEquals(1, Activity.count("session = ?", t));
        Activity a = Activity.find("session = ?", t).first();
        assertActivity(a);
View Full Code Here

Examples of net.yanhl.talk.pojo.Talk

  public ActionForward addMessage(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    try {
      JSONObject jsonObject = readJson(request);
      Talk talk = (Talk) JSONObject.toBean(jsonObject, Talk.class);
      talk.setUser(UserUtil.getUserFromSession(request));
      talk.setMsgDate(new Timestamp(System.currentTimeMillis()));
      getBaseManager().save(talk);
      print(response, RESBONSE_SUCCESS);
    } catch (Exception e) {
      e.printStackTrace();
      print(response, RESBONSE_ERROR);
View Full Code Here

Examples of net.yanhl.talk.pojo.Talk

//      log.info("用户<" + UserUtil.getCurrentUserName(request) + ">最后更新日期:" + StringUtil.getValue(lastDate,"datetime"));
//      java.text.SimpleDateFormat sftime = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//      Date lastDate = sftime.parse(StringUtil.getValue(request,"lastDate"));
      List<Talk> lastMsgs = talkManager.getMsg(userId, lastDate);
      if(lastMsgs.size() > 0) {
        Talk talk = lastMsgs.get(lastMsgs.size()-1);
        lastDate = talk.getMsgDate();
//        log.info("得到最后一个消息日期=" + talk);
      } else {
        lastDate = Calendar.getInstance().getTime();
//        log.info("设置lastDate为当前时间");
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.