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

reta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/main by this push:
     new f90be231ca Attempt to fix 
org.apache.cxf.systest.jaxrs.JAXRSMultipartTest.testAddBookMixedMultiValueMapParameter
 test case on Windows
f90be231ca is described below

commit f90be231caee50ea99f6bcf4b938360b0091a8a4
Author: Andriy Redko <[email protected]>
AuthorDate: Thu Jul 13 18:59:18 2023 -0400

    Attempt to fix 
org.apache.cxf.systest.jaxrs.JAXRSMultipartTest.testAddBookMixedMultiValueMapParameter
 test case on Windows
---
 .../cxf/systest/jaxrs/JAXRSMultipartTest.java      | 29 +++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
index 55939ff655..842a634aca 100644
--- 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
+++ 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
@@ -360,7 +360,13 @@ public class JAXRSMultipartTest extends 
AbstractBusClientServerTestBase {
     @Test
     public void testAddBookMixedMultiValueMapParameter() throws Exception {
         String address = "http://localhost:"; + PORT + 
"/bookstore/books/mixedmultivaluedmap";
-        doAddBook("multipart/mixed", address, "attachmentFormMixed", 200);
+
+        InputStream is = 
getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/attachmentFormMixed");
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            is = new NoCarriageReturnFileInputStream(is);
+        } 
+
+        doAddBook("multipart/mixed", address, is, 200);
     }
 
     @Test
@@ -1124,4 +1130,25 @@ public class JAXRSMultipartTest extends 
AbstractBusClientServerTestBase {
         return str;
     }
 
+    /**
+     * Windows attachment handling
+     */
+    private static class NoCarriageReturnFileInputStream extends InputStream {
+        private final InputStream is;
+
+        NoCarriageReturnFileInputStream(InputStream is) {
+            this.is = is;
+        }
+
+        @Override
+        public int read() throws IOException {
+            int c;
+
+            do {
+                c = is.read();
+            } while(c != -1 && c == 13);
+
+            return c;
+        }
+    }
 }

Reply via email to