From 7505683559b9d29600aea86e94877af6c2961409 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Sun, 18 Sep 2022 01:09:48 +0100 Subject: [PATCH 1/5] Fixes #709 Upgraded OrientDB to 3.1.20. Updated tests as OrientDB v3.1.x doesn't allow DB name to be a path. Groovy template test was flaky, so removed override which made it more reliable. --- gradle.properties | 2 +- .../java/org/jbake/app/ContentStoreIntegrationTest.java | 3 ++- jbake-core/src/test/java/org/jbake/app/CrawlerTest.java | 4 ++-- .../template/GroovyMarkupTemplateEngineRenderingTest.java | 8 -------- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index e108df7a1..a39392548 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ jade4jVersion = 1.3.2 jsoupVersion = 1.14.3 jgitVersion = 6.0.0.202111291000-r logbackVersion = 1.2.10 -orientDbVersion = 3.0.41 +orientDbVersion = 3.1.20 pebbleVersion = 3.1.5 slf4jVersion = 1.7.32 snakeYamlVersion = 1.30 diff --git a/jbake-core/src/test/java/org/jbake/app/ContentStoreIntegrationTest.java b/jbake-core/src/test/java/org/jbake/app/ContentStoreIntegrationTest.java index a2f2603a0..06e27877d 100644 --- a/jbake-core/src/test/java/org/jbake/app/ContentStoreIntegrationTest.java +++ b/jbake-core/src/test/java/org/jbake/app/ContentStoreIntegrationTest.java @@ -34,7 +34,8 @@ public static void setUpClass() throws Exception { Assert.assertEquals(".html", config.getOutputExtension()); config.setDatabaseStore(storageType.toString()); - String dbPath = folder.newFolder("documents" + System.currentTimeMillis()).getAbsolutePath(); + // OrientDB v3.1.x doesn't allow DB name to be a path even though docs say it's allowed + String dbPath = folder.newFolder("documents" + System.currentTimeMillis()).getName(); // setting the database path with a colon creates an invalid url for OrientDB. // only one colon is expected. there is no documentation about proper url path for windows available :( diff --git a/jbake-core/src/test/java/org/jbake/app/CrawlerTest.java b/jbake-core/src/test/java/org/jbake/app/CrawlerTest.java index de0aa14b9..326f001a0 100644 --- a/jbake-core/src/test/java/org/jbake/app/CrawlerTest.java +++ b/jbake-core/src/test/java/org/jbake/app/CrawlerTest.java @@ -74,8 +74,8 @@ public void crawlDataFiles() { Assert.assertFalse(authorsFileContents.isEmpty()); Object authorsList = authorsFileContents.get("authors"); assertThat(authorsList).isNotInstanceOf(OTrackedMap.class); - assertThat(authorsList).isInstanceOf(LinkedHashMap.class); - LinkedHashMap> authors = (LinkedHashMap>) authorsList; + assertThat(authorsList).isInstanceOf(HashMap.class); + HashMap> authors = (HashMap>) authorsList; assertThat(authors.get("Joe Bloggs").get("last_name")).isEqualTo("Bloggs"); } diff --git a/jbake-core/src/test/java/org/jbake/app/template/GroovyMarkupTemplateEngineRenderingTest.java b/jbake-core/src/test/java/org/jbake/app/template/GroovyMarkupTemplateEngineRenderingTest.java index cbc52455b..c40819a19 100644 --- a/jbake-core/src/test/java/org/jbake/app/template/GroovyMarkupTemplateEngineRenderingTest.java +++ b/jbake-core/src/test/java/org/jbake/app/template/GroovyMarkupTemplateEngineRenderingTest.java @@ -19,14 +19,6 @@ public class GroovyMarkupTemplateEngineRenderingTest extends AbstractTemplateEngineRenderingTest { - @BeforeClass - public static void setUpTest() { - //switch to PLOCAL mode for this test class as Travis sometimes runs out of memory - db.close(); - config.setDatabaseStore(StorageType.PLOCAL.toString()); - db = DBUtil.createDataStore(config); - } - public GroovyMarkupTemplateEngineRenderingTest() { super("groovyMarkupTemplates", "tpl"); From 563be7520ad4b1ffbcc29fdbc1e11003a40c0738 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 19 Sep 2022 19:21:03 +0100 Subject: [PATCH 2/5] Resolved issue when getting tags back for content, following OrientDB upgrade. --- jbake-core/src/main/java/org/jbake/app/DBUtil.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jbake-core/src/main/java/org/jbake/app/DBUtil.java b/jbake-core/src/main/java/org/jbake/app/DBUtil.java index 73fce3fdb..33568b450 100644 --- a/jbake-core/src/main/java/org/jbake/app/DBUtil.java +++ b/jbake-core/src/main/java/org/jbake/app/DBUtil.java @@ -6,6 +6,8 @@ import org.jbake.app.configuration.JBakeConfiguration; import org.jbake.model.DocumentModel; +import java.util.ArrayList; + public class DBUtil { private static ContentStore contentStore; @@ -56,6 +58,9 @@ public static String[] toStringArray(Object entry) { } else if (entry instanceof OTrackedList) { OTrackedList list = (OTrackedList) entry; return list.toArray(new String[list.size()]); + } else if (entry instanceof ArrayList) { + ArrayList list = (ArrayList) entry; + return list.toArray(new String[list.size()]); } return new String[0]; } From e1fae710bd21dbff1e96262ec8114448693c3f23 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 19 Sep 2022 19:57:38 +0100 Subject: [PATCH 3/5] Included file encoding parameter to cover execution on Windows. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cce9a1cee..b2d7b786f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: restore-keys: | ${{ runner.os }}-gradlew- - name: Build - run: ./gradlew build -S + run: ./gradlew -Dfile.encoding=UTF-8 build -S - name: Upload Reports uses: actions/upload-artifact@v1 From 857cf2e8b5db776454acb16621d13bcf14a28a01 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 19 Sep 2022 22:41:04 +0100 Subject: [PATCH 4/5] Used runner context to detect OS build is running on. --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2d7b786f..7a57a1267 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,12 @@ jobs: key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }} restore-keys: | ${{ runner.os }}-gradlew- - - name: Build - run: ./gradlew -Dfile.encoding=UTF-8 build -S + - name: Build-win + if: runner.os == 'Windows' + run: gradlew.bat -Dfile.encoding=UTF-8 build -S + - name: Build-nix + if: runner.os != 'Windows' + run: ./gradlew build -S - name: Upload Reports uses: actions/upload-artifact@v1 From 7aeb4c6de3f51fe72e66c44d6545c6c66f8d66ff Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 19 Sep 2022 22:47:33 +0100 Subject: [PATCH 5/5] Altered shell for Windows. --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a57a1267..8a12a50eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: ${{ runner.os }}-gradlew- - name: Build-win if: runner.os == 'Windows' + shell: cmd run: gradlew.bat -Dfile.encoding=UTF-8 build -S - name: Build-nix if: runner.os != 'Windows'