当前位置: 首页>>代码示例>>Java>>正文


Java DBUtil类代码示例

本文整理汇总了Java中org.jbake.app.DBUtil的典型用法代码示例。如果您正苦于以下问题:Java DBUtil类的具体用法?Java DBUtil怎么用?Java DBUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DBUtil类属于org.jbake.app包,在下文中一共展示了DBUtil类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderSitemap

import org.jbake.app.DBUtil; //导入依赖的package包/类
@Test
public void renderSitemap() throws Exception {
    DocumentTypes.addDocumentType("paper");
    DBUtil.updateSchema(db);

    renderer.renderSitemap("sitemap.xml");
    File outputFile = new File(destinationFolder, "sitemap.xml");
    Assert.assertTrue(outputFile.exists());

    // verify
    String output = FileUtils.readFileToString(outputFile, Charset.defaultCharset());
    for (String string : getOutputStrings("sitemap")) {
        assertThat(output).contains(string);
    }
    assertThat(output).doesNotContain("draft-paper.html");
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:17,代码来源:AbstractTemplateEngineRenderingTest.java

示例2: renderCustomTypePaper

import org.jbake.app.DBUtil; //导入依赖的package包/类
@Test
public void renderCustomTypePaper() throws Exception {
    // setup
    config.setProperty("template.paper.file", "paper." + templateExtension);
    DocumentTypes.addDocumentType("paper");
    DBUtil.updateSchema(db);

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

    File sampleFile = new File(sourceFolder.getPath() + File.separator + "content" + File.separator + "papers" + File.separator + filename);
    Map<String, Object> content = parser.processFile(sampleFile);
    content.put(Crawler.Attributes.URI, "/" + filename);
    renderer.render(content);
    File outputFile = new File(destinationFolder, filename);
    Assert.assertTrue(outputFile.exists());

    // verify
    String output = FileUtils.readFileToString(outputFile);
    for (String string : getOutputStrings("paper")) {
        assertThat(output).contains(string);
    }

}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:28,代码来源:GroovyMarkupTemplateEngineRenderingTest.java

示例3: renderCustomTypePaper

import org.jbake.app.DBUtil; //导入依赖的package包/类
@Test
public void renderCustomTypePaper() throws Exception {
    // setup
    config.setProperty("template.paper.file", "paper." + templateExtension);
    DocumentTypes.addDocumentType("paper");
    DBUtil.updateSchema(db);

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

    File sampleFile = new File(sourceFolder.getPath() + File.separator + "content" + File.separator + "papers" + File.separator + filename);
    Map<String, Object> content = parser.processFile(sampleFile);
    content.put(Crawler.Attributes.URI, "/" + filename);
    renderer.render(content);
    File outputFile = new File(destinationFolder, filename);
    Assert.assertTrue(outputFile.exists());

    // verify
    String output = FileUtils.readFileToString(outputFile, Charset.defaultCharset());
    for (String string : getOutputStrings("paper")) {
        assertThat(output).contains(string);
    }

}
 
开发者ID:jbake-org,项目名称:jbake,代码行数:28,代码来源:GroovyMarkupTemplateEngineRenderingTest.java

示例4: setup

import org.jbake.app.DBUtil; //导入依赖的package包/类
@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();
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:42,代码来源:AbstractTemplateEngineRenderingTest.java


注:本文中的org.jbake.app.DBUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。