This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new d48befa CAMEL-16016: Added unit test d48befa is described below commit d48befa92b991f76d4790a8dae4b9721807db17b Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Mar 25 13:11:44 2021 +0100 CAMEL-16016: Added unit test --- .../remote/FtpProducerRawPercentPasswordTest.java | 44 ++++++++++++++++++++++ .../file/remote/services/FtpEmbeddedService.java | 1 + .../camel-ftp/src/test/resources/users.properties | 4 ++ 3 files changed, 49 insertions(+) diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRawPercentPasswordTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRawPercentPasswordTest.java new file mode 100644 index 0000000..145b4d0 --- /dev/null +++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerRawPercentPasswordTest.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.file.remote; + +import java.io.File; + +import org.apache.camel.converter.IOConverter; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Unit test for password parameter using RAW value with % + */ +public class FtpProducerRawPercentPasswordTest extends FtpServerTestSupport { + + private String getFtpUrl() { + return "ftp://jane@localhost:{{ftp.server.port}}/upload?password=RAW(%j#7%c6i)&binary=false"; + } + + @Test + public void testRawPassword() throws Exception { + sendFile(getFtpUrl(), "Hello World", "camel.txt"); + + File file = ftpFile("upload/camel.txt").toFile(); + assertTrue(file.exists(), "The uploaded file should exists"); + assertEquals("Hello World", IOConverter.toString(file, null)); + } +} diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/FtpEmbeddedService.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/FtpEmbeddedService.java index e8c35f4..d1f8277 100644 --- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/FtpEmbeddedService.java +++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/FtpEmbeddedService.java @@ -107,6 +107,7 @@ public class FtpEmbeddedService extends AbstractTestService implements FtpServic createUser(userMgr, "us@r", "t%st", rootDir, true); createUser(userMgr, "anonymous", null, rootDir, false); createUser(userMgr, "joe", "p+%w0&r)d", rootDir, true); + createUser(userMgr, "jane", "%j#7%c6i", rootDir, true); ListenerFactory factory = new ListenerFactory(); factory.setPort(port); diff --git a/components/camel-ftp/src/test/resources/users.properties b/components/camel-ftp/src/test/resources/users.properties index e09f64b..da3530a 100644 --- a/components/camel-ftp/src/test/resources/users.properties +++ b/components/camel-ftp/src/test/resources/users.properties @@ -38,3 +38,7 @@ ftpserver.user.joe ftpserver.user.joe.userpassword=p+%w0&r)d ftpserver.user.joe.homedirectory=./target/res/home ftpserver.user.joe.writepermission=true +ftpserver.user.jane +ftpserver.user.jane.userpassword=%j#7%c6i +ftpserver.user.jane.homedirectory=./target/res/home +ftpserver.user.jane.writepermission=true