Search in sources :

Example 6 with SubmissionCriteria

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

the class SubmissionPersistenceImplTest method testSearchSubmissions2.

/**
	 * Tests searchSubmissions method
	 * @throws Exception to JUnit
	 */
public void testSearchSubmissions2() throws Exception {
    List submissions = null;
    SubmissionCriteria criteria = new SubmissionCriteria();
    criteria.setContestId(new Long(contest.getId()));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission1, submission2, submission3, submission4 }), submissions);
    criteria.setContestId(new Long(1234567890l));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(new ArrayList(), submissions);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SubmissionCriteria(cn.edu.zju.acm.onlinejudge.bean.request.SubmissionCriteria)

Example 7 with SubmissionCriteria

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

the class SubmissionPersistenceImplTest method testSearchSubmissions1.

/**
	 * Tests searchSubmissions method
	 * @throws Exception to JUnit
	 */
public void testSearchSubmissions1() throws Exception {
    List submissions = null;
    SubmissionCriteria criteria = new SubmissionCriteria();
    criteria.setProblemId(new Long(problem2.getId()));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission2, submission3, submission4 }), submissions);
    criteria.setProblemId(new Long(problem1.getId()));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission1 }), submissions);
    criteria.setProblemId(new Long(1234567890l));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(new ArrayList(), submissions);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SubmissionCriteria(cn.edu.zju.acm.onlinejudge.bean.request.SubmissionCriteria)

Example 8 with SubmissionCriteria

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

the class SubmissionPersistenceImplTest method testSearchSubmissions6.

/**
	 * Tests searchSubmissions method
	 * @throws Exception to JUnit
	 */
public void testSearchSubmissions6() throws Exception {
    List submissions = null;
    SubmissionCriteria criteria = new SubmissionCriteria();
    criteria.setLanguages(Arrays.asList(new Object[] { language1, language3 }));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission1, submission3, submission4 }), submissions);
    criteria.setLanguages(Arrays.asList(new Object[] { language2 }));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission2 }), submissions);
    criteria.setLanguages(Arrays.asList(new Object[] { new Language(4, "x", "x", "x", "x") }));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(new ArrayList(), submissions);
    criteria.setLanguages(new ArrayList());
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(new ArrayList(), submissions);
}
Also used : Language(cn.edu.zju.acm.onlinejudge.bean.enumeration.Language) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SubmissionCriteria(cn.edu.zju.acm.onlinejudge.bean.request.SubmissionCriteria)

Example 9 with SubmissionCriteria

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

the class SubmissionPersistenceImplTest method testSearchSubmissions3.

/**
	 * Tests searchSubmissions method
	 * @throws Exception to JUnit
	 */
public void testSearchSubmissions3() throws Exception {
    List submissions = null;
    SubmissionCriteria criteria = new SubmissionCriteria();
    criteria.setHandle(userProfile1.getHandle());
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission1, submission2, submission4 }), submissions);
    criteria.setHandle(userProfile2.getHandle());
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission3 }), submissions);
    criteria.setHandle("foobar");
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(new ArrayList(), submissions);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SubmissionCriteria(cn.edu.zju.acm.onlinejudge.bean.request.SubmissionCriteria)

Example 10 with SubmissionCriteria

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

the class SubmissionPersistenceImplTest method testSearchSubmissions9.

/**
	 * Tests searchSubmissions method
	 * @throws Exception to JUnit
	 */
public void testSearchSubmissions9() throws Exception {
    List submissions = null;
    SubmissionCriteria criteria = new SubmissionCriteria();
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission1, submission2, submission3, submission4 }), submissions);
    persistence.deleteSubmission(submission2.getId(), 11);
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission1, submission3, submission4 }), submissions);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) SubmissionCriteria(cn.edu.zju.acm.onlinejudge.bean.request.SubmissionCriteria)

Aggregations

SubmissionCriteria (cn.edu.zju.acm.onlinejudge.bean.request.SubmissionCriteria)12 ArrayList (java.util.ArrayList)11 List (java.util.List)10 JudgeReply (cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply)2 Language (cn.edu.zju.acm.onlinejudge.bean.enumeration.Language)2 Submission (cn.edu.zju.acm.onlinejudge.bean.Submission)1 SubmissionSearchForm (cn.edu.zju.acm.onlinejudge.form.SubmissionSearchForm)1 LanguagePersistence (cn.edu.zju.acm.onlinejudge.persistence.LanguagePersistence)1 Date (java.util.Date)1 ActionForward (org.apache.struts.action.ActionForward)1 ActionMessages (org.apache.struts.action.ActionMessages)1