Package cn.edu.zju.acm.onlinejudge.bean

Examples of cn.edu.zju.acm.onlinejudge.bean.Contest


  /**
   * Tests getContest method
   * @throws Exception to JUnit
   */
  public void testGetContest1() throws Exception {   
    Contest contest = (Contest) persistence.getContest(contest1.getId());   
    checkAbstractContest(contest1, contest);
    assertEquals("wrong start time", contest.getStartTime(), contest1.getStartTime());
    assertEquals("wrong end time", contest.getEndTime(), contest1.getEndTime());   
  }
View Full Code Here


  /**
   * Tests getContest method
   * @throws Exception to JUnit
   */
  public void testGetContest2() throws Exception {   
    Contest contest = (Contest) persistence.getContest(contest2.getId());   
    checkAbstractContest(contest2, contest);
    assertEquals("wrong start time", contest.getStartTime(), contest2.getStartTime());
    assertEquals("wrong end time", contest.getEndTime(), contest2.getEndTime());   
 
View Full Code Here

    contest1.setStartTime(new Date(20000));
    contest1.setEndTime(new Date(30000));
   
    persistence.updateContest(contest1, 11);
   
    Contest contest = (Contest) persistence.getContest(contest1.getId());   
    checkAbstractContest(contest1, contest);
    assertEquals("wrong start time", contest.getStartTime(), contest1.getStartTime());
    assertEquals("wrong end time", contest.getEndTime(), contest1.getEndTime());   
   
  }
View Full Code Here

    contest2.setStartTime(new Date(50000));
    contest2.setEndTime(new Date(60000));
   
    persistence.updateContest(contest2, 11);
   
    Contest contest = (Contest) persistence.getContest(contest2.getId());   
    checkAbstractContest(contest2, contest);
    assertEquals("wrong start time", contest.getStartTime(), contest2.getStartTime());
    assertEquals("wrong end time", contest.getEndTime(), contest2.getEndTime());   
   
  }
View Full Code Here

   * @throws Exception to JUnit
   */
  public void testGetAllContests() throws Exception {
    List contests = persistence.getAllContests();
    assertEquals("wrong size", 2, contests.size());
    Contest contest = (Contest) contests.get(0);
    checkAbstractContest(contest1, contest);   
    assertEquals("wrong start time", contest.getStartTime(), contest1.getStartTime());
    assertEquals("wrong end time", contest.getEndTime(), contest1.getEndTime());
   
    contest = (Contest) contests.get(1);
    checkAbstractContest(contest2, contest);
    assertEquals("wrong start time", contest.getStartTime(), contest2.getStartTime());
    assertEquals("wrong end time", contest.getEndTime(), contest2.getEndTime());
       
  }
View Full Code Here

   * @param limit the limit
   * @param languages  a list of languages
   * @return a new Contest instance
   */
  private Contest newContest(long id, long forumId, Limit limit, List languages) {
    Contest contest = new Contest();
    contest.setId(id);
    contest.setDescription("desc" + id);
    contest.setLimit(limit);
    contest.setLanguages(languages);
    contest.setTitle("title" + id);
    contest.setForumId(forumId);
    contest.setStartTime(new Date(id * 1000));
    contest.setEndTime(new Date(id * 2000));
    return contest;
 
View Full Code Here

      AbstractContest contest = null;
        int contestType=rs.getInt(DatabaseConstants.CONTEST_PROBLEMSET);
        if (contestType==1) {
            contest = new Problemset();
        } else if (contestType==0) {
            contest = new Contest();
        } else {
            contest = new Course();
        }
        if (rs.getTimestamp(DatabaseConstants.CONTEST_START_TIME) != null) {
            contest.setStartTime(new Date(rs.getTimestamp(DatabaseConstants.CONTEST_START_TIME).getTime()));
View Full Code Here

    public AbstractContest toContest() throws ParseException, NumberFormatException, PersistenceException {
        AbstractContest contest = null;
        if (this.contestType == 1) {
            contest = new Problemset();
        } else if (this.contestType == 0) {
            contest = new Contest();
        } else {
          contest = new Course();
        }
        if (this.startTime != null && this.startTime.trim().length() > 0) {
            contest.setStartTime(Utility.parseTimestamp(this.startTime));
View Full Code Here

   * @param limit the limit
   * @param languages  a list of languages
   * @return a new Contest instance
   */
  private Contest newContest(long id, long forumId, Limit limit, List languages) {
    Contest contest = new Contest();
    contest.setId(id);
    contest.setDescription("desc" + id);
    contest.setLimit(limit);
    contest.setLanguages(languages);
    contest.setTitle("title" + id);
    contest.setForumId(forumId);
    contest.setStartTime(new Date(id * 1000));
    contest.setEndTime(new Date(id * 2000));
    return contest;
 
View Full Code Here

   * @param limit the limit
   * @param languages  a list of languages
   * @return a new Contest instance
   */
  private Contest newContest(long id, long forumId, Limit limit, List languages) {
    Contest contest = new Contest();
    contest.setId(id);
    contest.setDescription("desc" + id);
    contest.setLimit(limit);
    contest.setLanguages(languages);
    contest.setTitle("title" + id);
    contest.setForumId(forumId);
    contest.setStartTime(new Date(id * 1000));
    contest.setEndTime(new Date(id * 2000));
    return contest;
 
View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.bean.Contest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.