當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。