This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 247835a [CXF-8281]add a test for using Chinese as attachment file name
247835a is described below
commit 247835a2a4babb280bead861f102450f2e62f6a4
Author: Freeman Fang <[email protected]>
AuthorDate: Thu Jul 9 07:48:22 2020 -0400
[CXF-8281]add a test for using Chinese as attachment file name
---
.../apache/cxf/systest/mtom/ClientMtomXopTest.java | 37 +++++++++++++++++++++
.../test/resources/\346\265\213\350\257\225.bmp" | Bin 0 -> 163166 bytes
2 files changed, 37 insertions(+)
diff --git
a/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
index 16a0a2b..e96a21f 100644
---
a/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
+++
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
@@ -358,6 +358,43 @@ public class ClientMtomXopTest extends
AbstractBusClientServerTestBase {
}
@Test
+ public void testMtomWithChineseFileName() throws Exception {
+ TestMtom mtomPort = createPort(MTOM_SERVICE, MTOM_PORT,
TestMtom.class, true, true);
+ try {
+ Holder<DataHandler> param = new Holder<>();
+ Holder<String> name;
+
+ URL fileURL = getClass().getClassLoader().getResource("测试.bmp");
+
+ Object[] validationTypes = new Object[]{Boolean.TRUE,
SchemaValidationType.IN, SchemaValidationType.BOTH};
+ for (Object validationType : validationTypes) {
+
((BindingProvider)mtomPort).getRequestContext().put(Message.SCHEMA_VALIDATION_ENABLED,
+
validationType);
+ param.value = new DataHandler(fileURL);
+ name = new Holder<>("have name");
+ mtomPort.testXop(name, param);
+
+ assertEquals("can't get file name", "return detail 测试.bmp",
java.net.URLDecoder.decode(name.value));
+ assertNotNull(param.value);
+ }
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception)ex.getCause();
+ } catch (Exception ex) {
+ if (ex.getMessage().contains("Connection reset")
+ && System.getProperty("java.specification.version",
"1.5").contains("1.6")) {
+ //There seems to be a bug/interaction with Java 1.6 and Jetty
where
+ //Jetty will occasionally send back a RST prior to all the
data being
+ //sent back to the client when using localhost (which is what
we do)
+ //we'll ignore for now
+ return;
+ }
+ System.out.println(System.getProperties());
+ ex.printStackTrace();
+ throw ex;
+ }
+ }
+
+ @Test
public void testMtomWithFileName() throws Exception {
TestMtom mtomPort = createPort(MTOM_SERVICE, MTOM_PORT,
TestMtom.class, true, true);
try {
diff --git
"a/systests/uncategorized/src/test/resources/\346\265\213\350\257\225.bmp"
"b/systests/uncategorized/src/test/resources/\346\265\213\350\257\225.bmp"
new file mode 100755
index 0000000..800c536
Binary files /dev/null and
"b/systests/uncategorized/src/test/resources/\346\265\213\350\257\225.bmp"
differ