Search in sources :

Example 6 with Forum

use of cn.edu.zju.acm.onlinejudge.bean.Forum in project zoj by licheng.

the class AuthorizationPersistenceImplTest method testUpdateForum1.

/**
	 * Tests updateForum method
	 * @throws Exception to JUnit
	 */
public void testUpdateForum1() throws Exception {
    forum1.setName("new name");
    forum1.setDescription("new desc");
    persistence.updateForum(forum1, 1);
    Forum forum11 = persistence.getForum(forum1.getId());
    checkForum(forum1, forum11);
}
Also used : Forum(cn.edu.zju.acm.onlinejudge.bean.Forum)

Example 7 with Forum

use of cn.edu.zju.acm.onlinejudge.bean.Forum in project zoj by licheng.

the class ProblemPersistenceImplTest method newForum.

/**
	 * Creates a new forum.
	 * @param id the id
	 * @return a new forum instance
	 */
private Forum newForum(long id) {
    Forum forum = new Forum();
    forum.setId(id);
    forum.setName("forum" + id);
    forum.setDescription("forum" + id + " description");
    return forum;
}
Also used : Forum(cn.edu.zju.acm.onlinejudge.bean.Forum)

Example 8 with Forum

use of cn.edu.zju.acm.onlinejudge.bean.Forum in project zoj by licheng.

the class ForumPersistenceImplTest method testCreateForum1.

/**
	 * Tests createForum method
	 * @throws Exception to JUnit
	 */
public void testCreateForum1() throws Exception {
    Forum forum = new Forum();
    forum.setName("name");
    forum.setDescription("desc");
    persistence.createForum(forum, 1);
    Forum forum1 = persistence.getForum(forum.getId());
    checkForum(forum, forum1);
}
Also used : Forum(cn.edu.zju.acm.onlinejudge.bean.Forum)

Example 9 with Forum

use of cn.edu.zju.acm.onlinejudge.bean.Forum in project zoj by licheng.

the class ForumPersistenceImplTest method testUpdateForum1.

/**
	 * Tests updateForum method
	 * @throws Exception to JUnit
	 */
public void testUpdateForum1() throws Exception {
    forum1.setName("new name");
    forum1.setDescription("new desc");
    persistence.updateForum(forum1, 1);
    Forum forum11 = persistence.getForum(forum1.getId());
    checkForum(forum1, forum11);
}
Also used : Forum(cn.edu.zju.acm.onlinejudge.bean.Forum)

Example 10 with Forum

use of cn.edu.zju.acm.onlinejudge.bean.Forum in project zoj by licheng.

the class ForumPersistenceImplTest method testCreateForum2.

/**
	 * Tests createForum method
	 * @throws Exception to JUnit
	 */
public void testCreateForum2() throws Exception {
    Forum forum1 = new Forum();
    forum1.setName("name1");
    forum1.setDescription("desc1");
    Forum forum2 = new Forum();
    forum2.setName("name2");
    forum2.setDescription("desc2");
    persistence.createForum(forum1, 1);
    persistence.createForum(forum2, 1);
    Forum forum11 = persistence.getForum(forum1.getId());
    checkForum(forum1, forum11);
    Forum forum22 = persistence.getForum(forum2.getId());
    checkForum(forum2, forum22);
}
Also used : Forum(cn.edu.zju.acm.onlinejudge.bean.Forum)

Aggregations

Forum (cn.edu.zju.acm.onlinejudge.bean.Forum)19 ArrayList (java.util.ArrayList)5 PersistenceException (cn.edu.zju.acm.onlinejudge.persistence.PersistenceException)4 Iterator (java.util.Iterator)4 List (java.util.List)4 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2