Search in sources :

Example 11 with Submission

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

the class SubmissionPersistenceImplTest method testGetSubmission2.

/**
	 * Tests getSubmission method
	 * @throws Exception to JUnit
	 */
public void testGetSubmission2() throws Exception {
    Submission submission = persistence.getSubmission(submission2.getId());
    checkSubmission(submission2, submission);
}
Also used : ExtendedSubmission(cn.edu.zju.acm.onlinejudge.bean.ExtendedSubmission) Submission(cn.edu.zju.acm.onlinejudge.bean.Submission)

Example 12 with Submission

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

the class SubmissionPersistenceImplTest method testUpdateSubmission3.

/**
	 * Tests updateSubmission method
	 * @throws Exception to JUnit
	 */
public void testUpdateSubmission3() throws Exception {
    long id = submission3.getId();
    submission3.setUserProfileId(userProfile2.getId());
    submission3.setProblemId(problem2.getId());
    submission3.setLanguage(language2);
    submission3.setJudgeReply(judgeReply3);
    submission3.setContent("new contest" + id);
    submission3.setTimeConsumption((int) id * 100);
    submission3.setMemoryConsumption((int) id * 1000);
    submission3.setSubmitDate(new Date(id * 100000));
    submission3.setJudgeDate(new Date(id * 200000));
    submission3.setJudgeComment("new comment" + id);
    persistence.updateSubmission(submission3, 11);
    Submission submission = persistence.getSubmission(submission3.getId());
    checkSubmission(submission3, submission);
}
Also used : ExtendedSubmission(cn.edu.zju.acm.onlinejudge.bean.ExtendedSubmission) Submission(cn.edu.zju.acm.onlinejudge.bean.Submission) Date(java.util.Date)

Example 13 with Submission

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

the class SubmissionPersistenceImplTest method testGetSubmission4.

/**
	 * Tests getSubmission method
	 * @throws Exception to JUnit
	 */
public void testGetSubmission4() throws Exception {
    Submission submission = (Submission) persistence.getSubmission(1234567890l);
    assertNull("no such submission", submission);
}
Also used : ExtendedSubmission(cn.edu.zju.acm.onlinejudge.bean.ExtendedSubmission) Submission(cn.edu.zju.acm.onlinejudge.bean.Submission)

Example 14 with Submission

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

the class SubmissionPersistenceImplTest method testUpdateSubmission1.

/**
	 * Tests updateSubmission method
	 * @throws Exception to JUnit
	 */
public void testUpdateSubmission1() throws Exception {
    long id = submission1.getId();
    submission1.setUserProfileId(userProfile2.getId());
    submission1.setProblemId(problem2.getId());
    submission1.setLanguage(language2);
    submission1.setJudgeReply(judgeReply3);
    submission1.setContent("new contest" + id);
    submission1.setTimeConsumption((int) id * 100);
    submission1.setMemoryConsumption((int) id * 1000);
    submission1.setSubmitDate(new Date(id * 100000));
    submission1.setJudgeDate(new Date(id * 200000));
    submission1.setJudgeComment("new comment" + id);
    persistence.updateSubmission(submission1, 11);
    Submission submission = persistence.getSubmission(submission1.getId());
    checkSubmission(submission1, submission);
}
Also used : ExtendedSubmission(cn.edu.zju.acm.onlinejudge.bean.ExtendedSubmission) Submission(cn.edu.zju.acm.onlinejudge.bean.Submission) Date(java.util.Date)

Example 15 with Submission

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

the class SubmissionPersistenceImplTest method testUpdateSubmission2.

/**
	 * Tests updateSubmission method
	 * @throws Exception to JUnit
	 */
public void testUpdateSubmission2() throws Exception {
    long id = submission2.getId();
    submission2.setUserProfileId(userProfile2.getId());
    submission2.setProblemId(problem2.getId());
    submission2.setLanguage(language2);
    submission2.setJudgeReply(judgeReply3);
    submission2.setContent("new contest" + id);
    submission2.setTimeConsumption((int) id * 100);
    submission2.setMemoryConsumption((int) id * 1000);
    submission2.setSubmitDate(null);
    submission2.setJudgeDate(null);
    submission2.setJudgeComment("new comment" + id);
    persistence.updateSubmission(submission2, 11);
    Submission submission = persistence.getSubmission(submission2.getId());
    checkSubmission(submission2, submission);
}
Also used : ExtendedSubmission(cn.edu.zju.acm.onlinejudge.bean.ExtendedSubmission) Submission(cn.edu.zju.acm.onlinejudge.bean.Submission)

Aggregations

Submission (cn.edu.zju.acm.onlinejudge.bean.Submission)33 Test (org.junit.Test)8 ExtendedSubmission (cn.edu.zju.acm.onlinejudge.bean.ExtendedSubmission)7 Language (cn.edu.zju.acm.onlinejudge.bean.enumeration.Language)7 ArrayList (java.util.ArrayList)5 UserProfile (cn.edu.zju.acm.onlinejudge.bean.UserProfile)4 PersistenceException (cn.edu.zju.acm.onlinejudge.persistence.PersistenceException)4 Connection (java.sql.Connection)4 PreparedStatement (java.sql.PreparedStatement)4 ResultSet (java.sql.ResultSet)4 SQLException (java.sql.SQLException)4 Date (java.util.Date)4 ActionForward (org.apache.struts.action.ActionForward)4 Before (org.junit.Before)4 Problem (cn.edu.zju.acm.onlinejudge.bean.Problem)3 SubmissionPersistence (cn.edu.zju.acm.onlinejudge.persistence.SubmissionPersistence)3 ActionMessages (org.apache.struts.action.ActionMessages)3 AbstractContest (cn.edu.zju.acm.onlinejudge.bean.AbstractContest)2 Reference (cn.edu.zju.acm.onlinejudge.bean.Reference)2 List (java.util.List)2