use of cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply in project zoj by licheng.
the class SubmissionPersistenceImplTest method testUpdateJudgeReply.
/**
* Tests updateJudgeReply method
* @throws Exception to JUnit
*/
public void testUpdateJudgeReply() throws Exception {
List judgeReplies = persistence.getAllJudgeReplies();
for (int i = 0; i < 3; ++i) {
JudgeReply judgeReply = (JudgeReply) judgeReplies.get(i);
long id = judgeReply.getId();
persistence.updateJudgeReply(new JudgeReply(id, "new judgeReply" + id, "new JudgeReply " + id, "new style" + id, i % 2 == 1), 10);
}
judgeReplies = persistence.getAllJudgeReplies();
for (int i = 0; i < 3; ++i) {
JudgeReply judgeReply = (JudgeReply) judgeReplies.get(i);
long id = judgeReply.getId();
assertEquals("wrong name", "new judgeReply" + id, judgeReply.getName());
assertEquals("wrong desc", "new JudgeReply " + id, judgeReply.getDescription());
assertEquals("wrong options", "new style" + id, judgeReply.getStyle());
assertEquals("wrong compiler", i % 2 == 1, judgeReply.isCommitted());
}
}
use of cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply in project zoj by licheng.
the class SubmissionPersistenceImplTest method testGetJudgeReply3.
/**
* Tests getJudgeReply method
* @throws Exception to JUnit
*/
public void testGetJudgeReply3() throws Exception {
JudgeReply judgeReply = persistence.getJudgeReply(judgeReply1.getId());
checkJudgeReply(judgeReply1, judgeReply);
}
use of cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply in project zoj by licheng.
the class SubmissionPersistenceImplTest method testGetJudgeReply2.
/**
* Tests getJudgeReply method
* @throws Exception to JUnit
*/
public void testGetJudgeReply2() throws Exception {
JudgeReply judgeReply = persistence.getJudgeReply(judgeReply1.getId());
checkJudgeReply(judgeReply1, judgeReply);
}
use of cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply in project zoj by licheng.
the class SubmissionPersistenceImpl method populateSubmission.
/**
* Populates an ExtendedSubmission with given ResultSet.
*
* @param rs
* @return an ExtendedSubmission instance
* @throws SQLException
*/
private Submission populateSubmission(ResultSet rs, boolean withContent, Map<Long, Language> languageMap) throws SQLException {
Submission submission = new Submission();
submission.setId(rs.getLong(DatabaseConstants.SUBMISSION_SUBMISSION_ID));
submission.setProblemId(rs.getLong(DatabaseConstants.SUBMISSION_PROBLEM_ID));
submission.setUserProfileId(rs.getLong(DatabaseConstants.SUBMISSION_USER_PROFILE_ID));
submission.setJudgeComment(rs.getString(DatabaseConstants.SUBMISSION_JUDGE_COMMENT));
submission.setJudgeDate(Database.getDate(rs, DatabaseConstants.SUBMISSION_JUDGE_DATE));
submission.setSubmitDate(Database.getDate(rs, DatabaseConstants.SUBMISSION_SUBMISSION_DATE));
submission.setMemoryConsumption(rs.getInt(DatabaseConstants.SUBMISSION_MEMORY_CONSUMPTION));
submission.setTimeConsumption(rs.getInt(DatabaseConstants.SUBMISSION_TIME_CONSUMPTION));
submission.setUserName(rs.getString(DatabaseConstants.USER_PROFILE_NICKNAME));
if (submission.getUserName().equals("")) {
submission.setUserName(rs.getString(DatabaseConstants.USER_PROFILE_HANDLE));
}
submission.setProblemCode(rs.getString(DatabaseConstants.PROBLEM_CODE));
submission.setContestId(rs.getLong("contest_id"));
submission.setContestOrder(rs.getLong("contest_order"));
if (withContent) {
submission.setContent(rs.getString("content"));
}
// set language
long languageId = rs.getLong(DatabaseConstants.SUBMISSION_LANGUAGE_ID);
Language language = languageMap.get(languageId);
submission.setLanguage(language);
// set judge reply
long judgeReplyId = rs.getLong(DatabaseConstants.SUBMISSION_JUDGE_REPLY_ID);
JudgeReply judgeReply = JudgeReply.findById(judgeReplyId);
submission.setJudgeReply(judgeReply);
return submission;
}
Aggregations