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

Examples of cn.edu.zju.acm.onlinejudge.bean.enumeration.Language


            PreparedStatement ps = null;
            try {
                ps = conn.prepareStatement(LanguagePersistenceImpl.GET_ALL_LANGUAGES);
                ResultSet rs = ps.executeQuery();
                while (rs.next()) {
                    Language language =
                            new Language(rs.getLong(DatabaseConstants.LANGUAGE_LANGUAGE_ID),
                                         rs.getString(DatabaseConstants.LANGUAGE_NAME),
                                         rs.getString(DatabaseConstants.LANGUAGE_DESCRIPTION),
                                         rs.getString(DatabaseConstants.LANGUAGE_COMPILER),
                                         rs.getString(DatabaseConstants.LANGUAGE_OPTIONS));
                    this.allLanguages.put(language.getId(), language);
                }
            } finally {
                Database.dispose(ps);
            }
        } catch (Exception e) {
View Full Code Here


            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);
View Full Code Here

   */
  public void testGetAllLanguages() throws Exception {   
   
    List languages = persistence.getAllLanguages();
    for (int i = 0; i < 3; ++i) {
      Language language = (Language) languages.get(i);
      long id = language.getId();     
      assertEquals("wrong name", "language" + id, language.getName());
      assertEquals("wrong desc", "Language " + id, language.getDescription());
      assertEquals("wrong options", "options" + id, language.getOptions());
      assertEquals("wrong compiler", "compiler" + id, language.getCompiler());           
    }
  }
View Full Code Here

   * Tests createLanguage method
   * @throws Exception to JUnit
   */
  public void testCreateLanguage() throws Exception {   
   
    persistence.createLanguage(new Language(4, "language4", "Language 4", "compiler4", "options4"), 10);
   
    List languages = persistence.getAllLanguages();
    for (int i = 0; i < 4; ++i) {
      Language language = (Language) languages.get(i);
      long id = language.getId();     
      assertEquals("wrong name", "language" + id, language.getName());
      assertEquals("wrong desc", "Language " + id, language.getDescription());
      assertEquals("wrong options", "options" + id, language.getOptions());
      assertEquals("wrong compiler", "compiler" + id, language.getCompiler());           
    }
  }
View Full Code Here

   */
  public void testUpdateLanguage() throws Exception {   
   
    List languages = persistence.getAllLanguages();
    for (int i = 0; i < 3; ++i) {
      Language language = (Language) languages.get(i);     
      long id = language.getId();   
      persistence.updateLanguage(
          new Language(id, "new language" + id, "new Language " + id, "new compiler" + id, "new options" + id), 10);
    }
   
    languages = persistence.getAllLanguages();
    for (int i = 0; i < 3; ++i) {
      Language language = (Language) languages.get(i);
      long id = language.getId();     
      assertEquals("wrong name", "new language" + id, language.getName());
      assertEquals("wrong desc", "new Language " + id, language.getDescription());
      assertEquals("wrong options", "new options" + id, language.getOptions());
      assertEquals("wrong compiler", "new compiler" + id, language.getCompiler());           
    }   
  }
View Full Code Here

   */
  public void testDeleteLanguage1() throws Exception {   
   
    List languages = persistence.getAllLanguages();
    for (int i = 0; i < 3; ++i) {
      Language language = (Language) languages.get(i);     
      long id = language.getId();   
      persistence.deleteLanguage(id, 10);
    }
     
    languages = persistence.getAllLanguages();
    assertEquals("wrong size", 0, languages.size());
View Full Code Here

public class MockLanguageDAO extends MockDAO implements LanguageDAO {
    private List<Language> languages = Collections.synchronizedList(new ArrayList<Language>());

    public MockLanguageDAO() {
        Language language = new Language(0, "cc", "cc", "cc", "cc");
        save(language);
    }
View Full Code Here

        AbstractContest contest = context.getContest();
        Problem problem = context.getProblem();

        long languageId = Utility.parseLong(context.getRequest().getParameter("languageId"));
        Language language = PersistenceManager.getInstance().getLanguagePersistence().getLanguage(languageId);
        if (language == null) {
            return this.handleSuccess(mapping, context, "submit");
        }
        String source = context.getRequest().getParameter("source");
        if (source == null || source.length() == 0) {
View Full Code Here

        List<Language> languages = new ArrayList<Language>();
        LanguagePersistence languagePersistence = PersistenceManager.getInstance().getLanguagePersistence();
        if (this.languageIds != null) {
            for (int i = 0; i < this.languageIds.length; ++i) {
                Language language = languagePersistence.getLanguage(Long.parseLong(this.languageIds[i]));
                if (language != null) {
                    languages.add(language);
                }
            }
        }
View Full Code Here

        AbstractContest contest = context.getContest();
        Problem problem = context.getProblem();

        long languageId = Utility.parseLong(context.getRequest().getParameter("languageId"));
        Language language = PersistenceManager.getInstance().getLanguagePersistence().getLanguage(languageId);
        if (language == null) {
            return this.handleSuccess(mapping, context, "submit");
        }
        String source = context.getRequest().getParameter("source");
        if (source == null || source.length() == 0) {
View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.bean.enumeration.Language

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.