Search in sources :

Example 1 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 2 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 3 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 4 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 5 with Submission

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

the class JudgingQueueUnitTest method setUp.

@Before
public void setUp() {
    this.queue = new JudgingQueue();
    this.submissions = new Submission[10];
    for (int i = 0; i < this.submissions.length; ++i) {
        this.submissions[i] = new Submission();
        this.submissions[i].setId(i);
    }
}
Also used : Submission(cn.edu.zju.acm.onlinejudge.bean.Submission) Before(org.junit.Before)

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