You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/01/30 10:19:09 UTC

[logging-log4j-tools] 01/01: Try to fix Windows-specific issues

This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch windows-fixes
in repository https://gitbox.apache.org/repos/asf/logging-log4j-tools.git

commit ba050fa4b12731dd66db46f1ba46a1a861541822
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Mon Jan 30 11:20:06 2023 +0100

    Try to fix Windows-specific issues
---
 .../apache/logging/log4j/changelog/ChangelogReleaserTest.java    | 9 ++++++++-
 .../java/org/apache/logging/log4j/changelog/FileTestUtils.java   | 3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/ChangelogReleaserTest.java b/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/ChangelogReleaserTest.java
index 1aebe7b..7374cc2 100644
--- a/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/ChangelogReleaserTest.java
+++ b/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/ChangelogReleaserTest.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.time.LocalDate;
 
 import org.apache.logging.log4j.changelog.releaser.ChangelogReleaser;
@@ -40,7 +41,13 @@ class ChangelogReleaserTest {
             throws Exception {
 
         // Clone the directory to avoid `move` operations cluttering the reference folder
-        copyDirectory(new File("src/test/resources/3-enriched"), changelogDirectory.toFile());
+        copyDirectory(
+                new File("src/test/resources/3-enriched"),
+                changelogDirectory.toFile(),
+                null,
+                true,
+                // Copying attributes to avoid Windows-specific failures
+                StandardCopyOption.COPY_ATTRIBUTES);
 
         // Invoke the releaser
         ChangelogReleaserArgs args = new ChangelogReleaserArgs(
diff --git a/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/FileTestUtils.java b/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/FileTestUtils.java
index f7f491f..d67ff40 100644
--- a/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/FileTestUtils.java
+++ b/log4j-changelog/src/test/java/org/apache/logging/log4j/changelog/FileTestUtils.java
@@ -18,6 +18,7 @@ package org.apache.logging.log4j.changelog;
 
 import java.io.IOException;
 import java.io.UncheckedIOException;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.*;
@@ -44,7 +45,7 @@ final class FileTestUtils {
             final Path actualFilePath = actualContents.get(relativeFilePath);
             final Path expectedFilePath = expectedContents.get(relativeFilePath);
             if (!Files.isDirectory(actualFilePath) || !Files.isDirectory(expectedFilePath)) {
-                assertThat(actualFilePath).hasSameBinaryContentAs(expectedFilePath);
+                assertThat(actualFilePath).hasSameTextualContentAs(expectedFilePath, StandardCharsets.UTF_8);
             }
         });