Example #1
0
 @Before
 public void setup() throws Exception, IOException, URISyntaxException {
   config = ConfigUtil.load(new File(this.getClass().getResource("/").getFile()));
   Iterator<String> keys = config.getKeys();
   while (keys.hasNext()) {
     String key = keys.next();
     if (key.startsWith("template") && key.endsWith(".file")) {
       String old = (String) config.getProperty(key);
       config.setProperty(key, old.substring(0, old.length() - 4) + ".ftl");
     }
   }
   config.setProperty(ConfigurationKeys.PAGINATE_INDEX, true);
   config.setProperty(ConfigurationKeys.POSTS_PER_PAGE, 1);
   db = DataBaseUtil.createDataStore("memory", "documents" + System.currentTimeMillis());
 }
  @Before
  public void setup() throws Exception, IOException, URISyntaxException {
    URL sourceUrl = this.getClass().getResource("/");

    sourceFolder = new File(sourceUrl.getFile());
    if (!sourceFolder.exists()) {
      throw new Exception("Cannot find sample data structure!");
    }

    destinationFolder = folder.getRoot();

    templateFolder = new File(sourceFolder, templateDir);
    if (!templateFolder.exists()) {
      throw new Exception("Cannot find template folder!");
    }

    config = ConfigUtil.load(new File(this.getClass().getResource("/").getFile()));
    Iterator<String> keys = config.getKeys();
    while (keys.hasNext()) {
      String key = keys.next();
      if (key.startsWith("template") && key.endsWith(".file")) {
        String old = (String) config.getProperty(key);
        config.setProperty(key, old.substring(0, old.length() - 4) + "." + templateExtension);
      }
    }
    Assert.assertEquals(".html", config.getString(ConfigUtil.Keys.OUTPUT_EXTENSION));
    db = DBUtil.createDataStore("memory", "documents" + System.currentTimeMillis());
  }
Example #3
0
 @Before
 public void setup() throws Exception {
   URL sourceUrl = this.getClass().getResource("/");
   rootPath = new File(sourceUrl.getFile());
   if (!rootPath.exists()) {
     throw new Exception("Cannot find base path for test!");
   }
   config = ConfigUtil.load(rootPath);
   // override base template config option
   config.setProperty("example.project.freemarker", "test.zip");
 }
  @Before
  public void setup() throws Exception {
    currentLocale = Locale.getDefault();
    Locale.setDefault(Locale.ENGLISH);

    ModelExtractorsDocumentTypeListener listener = new ModelExtractorsDocumentTypeListener();
    DocumentTypes.addListener(listener);

    URL sourceUrl = this.getClass().getResource("/");

    sourceFolder = new File(sourceUrl.getFile());
    if (!sourceFolder.exists()) {
      throw new Exception("Cannot find sample data structure!");
    }

    destinationFolder = folder.getRoot();

    templateFolder = new File(sourceFolder, templateDir);
    if (!templateFolder.exists()) {
      throw new Exception("Cannot find template folder!");
    }

    config = ConfigUtil.load(new File(this.getClass().getResource("/").getFile()));
    Iterator<String> keys = config.getKeys();
    while (keys.hasNext()) {
      String key = keys.next();
      if (key.startsWith("template") && key.endsWith(".file")) {
        String old = (String) config.getProperty(key);
        config.setProperty(key, old.substring(0, old.length() - 4) + "." + templateExtension);
      }
    }
    Assert.assertEquals(".html", config.getString(ConfigUtil.Keys.OUTPUT_EXTENSION));
    db = DBUtil.createDataStore("memory", "documents" + System.currentTimeMillis());

    crawler = new Crawler(db, sourceFolder, config);
    crawler.crawl(new File(sourceFolder.getPath() + File.separator + "content"));
    parser = new Parser(config, sourceFolder.getPath());
    renderer = new Renderer(db, destinationFolder, templateFolder, config);

    setupExpectedOutputStrings();
  }
Example #5
0
 @Test
 public void testCompositeConfiguration() throws URISyntaxException {
   CompositeConfiguration configuration = new CompositeConfiguration();
   try {
     PropertiesConfiguration propertiesConfiguration =
         new PropertiesConfiguration("conf/pss-settings.properties");
     //
     //	propertiesConfiguration.setFileName("E:/study/jelyworkspace/jelypss/pss-core/target/test-classes/conf/pss-settings.properties");
     propertiesConfiguration.load(
         "E:/study/jelyworkspace/jelypss/pss-core/target/test-classes/conf/pss-settings.properties");
     configuration.addConfiguration(propertiesConfiguration);
     //			propertiesConfiguration.setProperty("haha", 1235);
     configuration.setProperty("asdf", "aaaaaaaaa");
     System.out.println(configuration.getInt("haha"));
     System.out.println(this.getClass().getClassLoader().getResource("").toURI().toString());
     System.out.println(this.getClass().getClassLoader().getResource("").toString());
     propertiesConfiguration.save();
   } catch (ConfigurationException e) {
     e.printStackTrace();
   }
 }
 @Override
 public void setString(String value, String name) {
   config.setProperty(name, value);
 }