Example #1
0
 private static void testURL() {
   try {
     URL url = SiteTest.getAURL();
     Testing.so("Setting URL: " + url.toString(), Format.STEP);
     SiteTest.site.setURL(url);
     SiteTest.properties.put("url", url.toString());
   } catch (Exception e) {
     Testing.err(e);
   }
 }
Example #2
0
  /**
   * Create a new site entry with no faulty values. Site object will be created in one step with the
   * appropriate constructor.
   *
   * @throws ConfigManagerException
   * @throws SQLException
   */
  private static void runTest_Single() {
    Number newSiteId = -1;

    // test one
    Testing.so("All legal site creation in one step", Format.HEADER);
    // gather data
    try {
      SiteTest.properties.put("url", SiteTest.getAURL());
      SiteTest.properties.put("languagecode", SiteTest.getALanguageName());
      SiteTest.properties.put("countrycode", SiteTest.getACountryName());
    } catch (Exception e) {
      Testing.err(e);
    }
    SiteTest.properties.put("rootfile", SiteTest.getARootFileName());
    SiteTest.properties.put("title", SiteTest.getATitle());
    SiteTest.properties.put("category", SiteTest.getACategoryName());
    SiteTest.properties.put("subcategory", SiteTest.getACategoryName());
    SiteTest.properties.put("subsubcategory", SiteTest.getACategoryName());
    SiteTest.properties.put("storage", SiteTest.getAStoragePath());
    // create site object
    try {
      Site site =
          new Site( //
              SiteTest.properties.get("url").toString(), //
              SiteTest.properties.get("languagecode").toString(), //
              SiteTest.properties.get("countrycode").toString(), //
              SiteTest.properties.get("rootfile").toString(), //
              // SiteTest.properties.get("title").toString(),//
              SiteTest.properties.get("category").toString(), //
              SiteTest.properties.get("subcategory").toString(), //
              SiteTest.properties.get("subsubcategory").toString(), //
              SiteTest.properties.get("storage").toString() //
              );
      newSiteId = site.getNewSiteId();
    } catch (Exception e) {
      Testing.err(e);
    }
    SiteTest.checkTest(newSiteId);

    // test two
    Testing.so("Bogous site creation in one step", Format.HEADER);
    Testing.so(
        "Country and Language shouldn't be resolvable and result in unknown or in an error, depending on the Site behaviour setting.",
        Format.STEPINFO);
    // just pass random junk
    SiteTest.properties.put("countrycode", "scrambled");
    SiteTest.properties.put("languagecode", "zizzlebizz");
    // create site object
    try {
      Site site =
          new Site( //
              SiteTest.properties.get("url").toString(), //
              SiteTest.properties.get("languagecode").toString(), //
              SiteTest.properties.get("countrycode").toString(), //
              SiteTest.properties.get("rootfile").toString(), //
              // SiteTest.properties.get("title").toString(),//
              SiteTest.properties.get("category").toString(), //
              SiteTest.properties.get("subcategory").toString(), //
              SiteTest.properties.get("subsubcategory").toString(), //
              SiteTest.properties.get("storage").toString() //
              );
      newSiteId = site.getNewSiteId();
    } catch (Exception e) {
      Testing.err(e);
    }
    SiteTest.checkTest(newSiteId);
  }