Package cn.edu.zju.acm.onlinejudge.bean

Examples of cn.edu.zju.acm.onlinejudge.bean.Thread


            try {
                ps = conn.prepareStatement(ForumPersistenceImpl.GET_THREAD);
                ps.setLong(1, id);
                ResultSet rs = ps.executeQuery();
                if (rs.next()) {
                    Thread thread = new Thread();
                    thread.setId(rs.getLong(DatabaseConstants.THREAD_THREAD_ID));
                    thread.setForumId(rs.getLong(DatabaseConstants.THREAD_FORUM_ID));
                    thread.setUserProfileId(rs.getLong(DatabaseConstants.THREAD_USER_PROFILE_ID));
                    thread.setTitle(rs.getString(DatabaseConstants.THREAD_TITLE));
                    return thread;
                } else {
                    return null;
                }
            } finally {
View Full Code Here


   * Tests getThread method
   * @throws Exception to JUnit
   */
  public void testGetThread() throws Exception {   
   
    Thread thread = persistence.getThread(thread1.getId());
    checkThread(thread1, thread);   
  }
View Full Code Here

   * @throws Exception to JUnit
   */
  public void testCreateThread1() throws Exception {   
   
   
    Thread thread = newThread(-1, forum1.getId(), profile.getId());
    persistence.createThread(thread, 1);
   
    Thread newThread = persistence.getThread(thread.getId());
    checkThread(thread, newThread);   

  }
View Full Code Here

   */
  public void testUpdateThread1() throws Exception {
    thread1.setId(thread2.getId());
    persistence.updateThread(thread1, 1);
       
    Thread thread = persistence.getThread(thread1.getId());
    checkThread(thread1, thread)
   
  }
View Full Code Here

   * @param forumId the forum id
   * @param userId the user id
   * @return a new thread instance
   */
  private Thread newThread(long id, long forumId, long userId) {
    Thread thread = new Thread();
    thread.setId(id);
    thread.setForumId(forumId);
    thread.setUserProfileId(userId);
    thread.setTitle("thread title" + id);
    return thread;
  }
View Full Code Here

   * Tests getThread method
   * @throws Exception to JUnit
   */
  public void testGetThread() throws Exception {   
   
    Thread thread = persistence.getThread(thread1.getId());
    checkThread(thread1, thread);   
  }
View Full Code Here

   * @throws Exception to JUnit
   */
  public void testCreateThread1() throws Exception {   
   
   
    Thread thread = newThread(-1, forum1.getId(), profile.getId());
    persistence.createThread(thread, 1);
   
    Thread newThread = persistence.getThread(thread.getId());
    checkThread(thread, newThread);   

  }
View Full Code Here

   */
  public void testUpdateThread1() throws Exception {
    thread1.setId(thread2.getId());
    persistence.updateThread(thread1, 1);
       
    Thread thread = persistence.getThread(thread1.getId());
    checkThread(thread1, thread)
   
  }
View Full Code Here

   * @param forumId the forum id
   * @param userId the user id
   * @return a new thread instance
   */
  private Thread newThread(long id, long forumId, long userId) {
    Thread thread = new Thread();
    thread.setId(id);
    thread.setForumId(forumId);
    thread.setUserProfileId(userId);
    thread.setTitle("thread title" + id);
    return thread;
  }
View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.bean.Thread

Copyright © 2018 www.massapicom. 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.