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

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git

commit 01c41e301dfc0090250a7894fcc9632d322ce64a
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Thu Nov 5 00:35:06 2026 +0000

    Address review of file-set output tests
    
    Add a disabled content assertion for the file aggregator (MASSEMBLY-815, 
#1024), guard the symlink test on Windows, drop the System.err capture and 
remove the RAT exclude of the deleted massembly-731 IT.
---
 pom.xml                                            |  1 -
 .../assembly/archive/phase/FileSetsOutputTest.java | 58 ++++++++++++++--------
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/pom.xml b/pom.xml
index c97c1aa3..9178796d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -303,7 +303,6 @@ under the License.
               <!-- The following is used to exclude files with the extension 
*.file -->
               <exclude>src/it/**/*.file</exclude>
               
<exclude>src/it/projects/filtering-feature/filters-defined-in-build/src/main/config/**</exclude>
-              <exclude>src/it/projects/bugs/massembly-731/**</exclude>
               <exclude>.java-version</exclude>
               <exclude>.asf.yaml</exclude>
             </inputExcludes>
diff --git 
a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetsOutputTest.java
 
b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetsOutputTest.java
index 71e9cde6..8b65a720 100644
--- 
a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetsOutputTest.java
+++ 
b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetsOutputTest.java
@@ -34,6 +34,7 @@ import java.util.jar.JarFile;
 
 import org.apache.maven.plugins.assembly.testutils.AssemblyRunner;
 import org.apache.maven.plugins.assembly.testutils.ZipEntryModes;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.DisabledOnOs;
 import org.junit.jupiter.api.condition.OS;
@@ -169,6 +170,7 @@ class FileSetsOutputTest {
     }
 
     @Test
+    @DisabledOnOs(OS.WINDOWS)
     void symbolicLinkIsCopiedAsRelativeSymbolicLink() throws Exception {
         AssemblyRunner runner = runner();
         File resources = new File(projectDir, "src/main/assembly-resources");
@@ -361,37 +363,53 @@ class FileSetsOutputTest {
                                 + 
"</containerDescriptorHandler></containerDescriptorHandlers>"),
                 "dir");
 
-        // the descriptor handler swallows the matching sources and writes the 
aggregate to outputPath
+        // the matching sources are replaced by one output file; its content 
is not checked here, see
+        // aggregatedFileContainsTheContentOfAllMatchingFiles
         assertTrue(new File(out, "file.txt").isFile());
         assertFalse(new File(out, "b/file.txt").exists());
         assertFalse(new File(out, "a/file.txt").exists());
     }
 
     @Test
-    void platformSpecificDirectoriesAreReportedInTheBuildOutput() throws 
Exception {
+    @Disabled("https://github.com/apache/maven-assembly-plugin/issues/1024 
(MASSEMBLY-815): the aggregate is written"
+            + " before the lazily selected fileSet entries are added, so 
file.txt holds only the header")
+    void aggregatedFileContainsTheContentOfAllMatchingFiles() throws Exception 
{
+        AssemblyRunner runner = runner();
+        runner.write("src/config/a/file.txt", "file A\n");
+        runner.write("src/config/b/file.txt", "file B\n");
+
+        File out = runner.build(
+                descriptor(
+                        "bin",
+                        false,
+                        
fileSet("<directory>src/config</directory><outputDirectory></outputDirectory>"),
+                        
"<containerDescriptorHandlers><containerDescriptorHandler>"
+                                + "<handlerName>file-aggregator</handlerName>"
+                                + 
"<configuration><filePattern>.*/file.txt</filePattern>"
+                                + 
"<outputPath>file.txt</outputPath></configuration>"
+                                + 
"</containerDescriptorHandler></containerDescriptorHandlers>"),
+                "dir");
+
+        String aggregate = new String(Files.readAllBytes(new File(out, 
"file.txt").toPath()), StandardCharsets.UTF_8);
+        assertTrue(aggregate.contains("file A"), aggregate);
+        assertTrue(aggregate.contains("file B"), aggregate);
+    }
+
+    @Test
+    void platformSpecificDirectoriesStillCopyTheFiles() throws Exception {
         AssemblyRunner runner = runner();
         runner.write("adir/emptyfile.txt", "");
 
-        java.io.PrintStream originalErr = System.err;
-        java.io.ByteArrayOutputStream captured = new 
java.io.ByteArrayOutputStream();
-        File out;
-        try {
-            System.setErr(new java.io.PrintStream(captured, true, "UTF-8"));
-            out = runner.build(
-                    
"<assembly><id>src</id><formats><format>dir</format></formats>"
-                            + 
"<includeBaseDirectory>false</includeBaseDirectory><fileSets>"
-                            + "<fileSet><directory>adir</directory></fileSet>"
-                            + "<fileSet><directory>/adir</directory></fileSet>"
-                            + 
"<fileSet><directory>c:\\adir</directory></fileSet>"
-                            + "</fileSets></assembly>",
-                    "dir");
-        } finally {
-            System.setErr(originalErr);
-        }
+        File out = runner.build(
+                "<assembly><id>src</id><formats><format>dir</format></formats>"
+                        + 
"<includeBaseDirectory>false</includeBaseDirectory><fileSets>"
+                        + "<fileSet><directory>adir</directory></fileSet>"
+                        + "<fileSet><directory>/adir</directory></fileSet>"
+                        + "<fileSet><directory>c:\\adir</directory></fileSet>"
+                        + "</fileSets></assembly>",
+                "dir");
 
         assertTrue(new File(out, "adir/emptyfile.txt").isFile());
-        String log = captured.toString("UTF-8");
-        assertTrue(log.contains("assembly descriptor contains a"), "expected a 
platform warning, got: " + log);
     }
 
     @Test

Reply via email to