Search in sources :

Example 11 with SubmissionCriteria

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

the class SubmissionPersistenceImplTest method testSearchSubmissions10.

/**
	 * Tests searchSubmissions method
	 * @throws Exception to JUnit
	 */
public void testSearchSubmissions10() throws Exception {
    List submissions = null;
    SubmissionCriteria criteria = new SubmissionCriteria();
    submissions = persistence.searchSubmissions(criteria, 0, 0);
    checkSubmissions(new ArrayList(), submissions);
    submissions = persistence.searchSubmissions(criteria, 0, 1);
    checkSubmissions(Arrays.asList(new Object[] { submission1 }), submissions);
    submissions = persistence.searchSubmissions(criteria, 0, 4);
    checkSubmissions(Arrays.asList(new Object[] { submission1, submission2, submission3, submission4 }), submissions);
    submissions = persistence.searchSubmissions(criteria, 1, 2);
    checkSubmissions(Arrays.asList(new Object[] { submission2, submission3 }), 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 12 with SubmissionCriteria

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

the class SubmissionPersistenceImplTest method testSearchSubmissions4.

/**
	 * Tests searchSubmissions method
	 * @throws Exception to JUnit
	 */
public void testSearchSubmissions4() throws Exception {
    List submissions = null;
    SubmissionCriteria criteria = new SubmissionCriteria();
    criteria.setIdEnd(new Long(submission2.getId()));
    criteria.setIdStart(null);
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission1, submission2 }), submissions);
    criteria.setIdEnd(null);
    criteria.setIdStart(new Long(submission3.getId()));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission3, submission4 }), submissions);
    criteria.setIdEnd(new Long(submission3.getId()));
    criteria.setIdStart(new Long(submission2.getId()));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(Arrays.asList(new Object[] { submission2, submission3 }), submissions);
    criteria.setIdEnd(new Long(submission1.getId() - 1));
    criteria.setIdStart(null);
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(new ArrayList(), submissions);
    criteria.setIdEnd(null);
    criteria.setIdStart(new Long(submission4.getId() + 1));
    submissions = persistence.searchSubmissions(criteria, 0, 100);
    checkSubmissions(new ArrayList(), submissions);
    criteria.setIdEnd(new Long(submission2.getId()));
    criteria.setIdStart(new Long(submission3.getId()));
    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)

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