Search in sources :

Example 6 with JudgeReply

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

the class SubmissionPersistenceImplTest method testGetJudgeReply1.

/**
	 * Tests getJudgeReply method
	 * @throws Exception to JUnit
	 */
public void testGetJudgeReply1() throws Exception {
    JudgeReply judgeReply = persistence.getJudgeReply(judgeReply1.getId());
    checkJudgeReply(judgeReply1, judgeReply);
}
Also used : JudgeReply(cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply)

Example 7 with JudgeReply

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

the class SubmissionPersistenceImplTest method testGetAllJudgeReplies.

/**
	 * Tests getAllJudgeReplies method
	 * @throws Exception to JUnit
	 */
public void testGetAllJudgeReplies() throws Exception {
    List judgeReplies = persistence.getAllJudgeReplies();
    for (int i = 0; i < 3; ++i) {
        JudgeReply judgeReply = (JudgeReply) judgeReplies.get(i);
        long id = judgeReply.getId();
        assertEquals("wrong name", "judgeReply" + id, judgeReply.getName());
        assertEquals("wrong desc", "JudgeReply " + id, judgeReply.getDescription());
        assertEquals("wrong options", "style" + id, judgeReply.getStyle());
        assertEquals("wrong compiler", i % 2 == 0, judgeReply.isCommitted());
    }
}
Also used : JudgeReply(cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply) ArrayList(java.util.ArrayList) List(java.util.List)

Example 8 with JudgeReply

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

the class SubmissionPersistenceImplTest method testSearchSubmissions7.

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

Example 9 with JudgeReply

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

the class SubmissionPersistenceImplTest method testGetJudgeReply4.

/**
	 * Tests getJudgeReply method
	 * @throws Exception to JUnit
	 */
public void testGetJudgeReply4() throws Exception {
    JudgeReply judgeReply = persistence.getJudgeReply(1234567890l);
    assertNull("no such contest", judgeReply);
}
Also used : JudgeReply(cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply)

Example 10 with JudgeReply

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

the class SubmissionPersistenceImplTest method testCreateJudgeReply.

/**
	 * Tests createJudgeReply method
	 * @throws Exception to JUnit
	 */
public void testCreateJudgeReply() throws Exception {
    persistence.createJudgeReply(new JudgeReply(4, "judgeReply4", "JudgeReply 4", "style4", false), 10);
    List judgeReplies = persistence.getAllJudgeReplies();
    for (int i = 0; i < 4; ++i) {
        JudgeReply judgeReply = (JudgeReply) judgeReplies.get(i);
        long id = judgeReply.getId();
        assertEquals("wrong name", "judgeReply" + id, judgeReply.getName());
        assertEquals("wrong desc", "JudgeReply " + id, judgeReply.getDescription());
        assertEquals("wrong options", "style" + id, judgeReply.getStyle());
        assertEquals("wrong compiler", i % 2 == 0, judgeReply.isCommitted());
    }
}
Also used : JudgeReply(cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

JudgeReply (cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply)14 ArrayList (java.util.ArrayList)7 List (java.util.List)5 Language (cn.edu.zju.acm.onlinejudge.bean.enumeration.Language)3 SubmissionCriteria (cn.edu.zju.acm.onlinejudge.bean.request.SubmissionCriteria)2 Submission (cn.edu.zju.acm.onlinejudge.bean.Submission)1 LanguagePersistence (cn.edu.zju.acm.onlinejudge.persistence.LanguagePersistence)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 HashSet (java.util.HashSet)1 ActionForward (org.apache.struts.action.ActionForward)1