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

cstamas pushed a commit to branch MSHARED-1213
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit f7892f8094516f7277984aea8d997a338e5b28df
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Mon Mar 20 22:12:31 2023 +0100

    [MSHARED-1213] Bug fix
    
    Actual count of read is not checked.
---
 pom.xml                                            |  9 ++++++
 .../maven/shared/filtering/FilteringUtilsTest.java | 32 +++++++++++++++++++++-
 src/test/units-files/MSHARED-1213/enunciate.xml    | 10 +++++++
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 0f77fdb..e184b68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -164,6 +164,15 @@
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes combine.children="append">
+            <exclude>src/test/units-files/**</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.eclipse.sisu</groupId>
         <artifactId>sisu-maven-plugin</artifactId>
diff --git 
a/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java 
b/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java
index bb78566..da6941f 100644
--- a/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java
@@ -18,6 +18,14 @@
  */
 package org.apache.maven.shared.filtering;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.CopyOption;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -28,7 +36,29 @@ import static org.junit.Assert.assertEquals;
  * @since 1.0
  *
  */
-public class FilteringUtilsTest {
+public class FilteringUtilsTest extends TestSupport {
+    private static File testDirectory = new File(getBasedir(), 
"target/test-classes/");
+
+    @Test
+    public void testCopy() throws IOException {
+        File fromFile = new File(getBasedir() + 
"/src/test/units-files/MSHARED-1213/enunciate.xml");
+        File toFile = new File(testDirectory, "MSHARED-1213-enunciate.xml");
+        Files.copy(fromFile.toPath(), toFile.toPath(), 
StandardCopyOption.REPLACE_EXISTING);
+        FilteringUtils.copyFile(
+                fromFile,
+                toFile,
+                "UTF-8",
+                new FilterWrapper[] {
+                    new FilterWrapper() {
+                        @Override
+                        public Reader getReader(Reader fileReader) {
+                            return fileReader;
+                        }
+                    }
+                },
+                false);
+    }
+
     @Test
     public void testEscapeWindowsPathStartingWithDrive() {
         assertEquals("C:\\\\Users\\\\Administrator", 
FilteringUtils.escapeWindowsPath("C:\\Users\\Administrator"));
diff --git a/src/test/units-files/MSHARED-1213/enunciate.xml 
b/src/test/units-files/MSHARED-1213/enunciate.xml
new file mode 100644
index 0000000..e75547d
--- /dev/null
+++ b/src/test/units-files/MSHARED-1213/enunciate.xml
@@ -0,0 +1,10 @@
+<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.15.0.xsd";>
+
+  <modules>
+    <jackson>
+      <mixin 
target="com.webcohesion.enunciate.examples.jaxrsjackson.genealogy.data.CompoundId"
+             
source="com.webcohesion.enunciate.examples.jaxrsjackson.genealogy.data.CompoundIdMixin"/>
+    </jackson>
+  </modules>
+
+</enunciate>

Reply via email to