essobedo commented on code in PR #365: URL: https://github.com/apache/camel-karaf/pull/365#discussion_r1644699426
########## tests/features/camel-ftp/src/test/java/org/apache/karaf/camel/itest/FtpServerResource.java: ########## @@ -0,0 +1,84 @@ +package org.apache.karaf.camel.itest; Review Comment: Add missing Apache header ########## tests/camel-integration-test/src/main/java/org/apache/karaf/camel/itests/ExternalResourceWithPrerequisite.java: ########## @@ -0,0 +1,43 @@ +package org.apache.karaf.camel.itests; Review Comment: Add missing Apache header ########## tests/features/camel-ftp/src/main/java/org/apache/karaf/camel/test/CamelFtpRouteSupplier.java: ########## @@ -0,0 +1,51 @@ +/* + * 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.karaf.camel.test; + +import java.util.function.Function; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.model.RouteDefinition; +import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteSupplier; +import org.apache.karaf.camel.itests.CamelRouteSupplier; +import org.osgi.service.component.annotations.Component; + + +@Component( + name = "karaf-camel-ftp-test", + immediate = true, + service = CamelRouteSupplier.class +) +public class CamelFtpRouteSupplier extends AbstractCamelSingleFeatureResultMockBasedRouteSupplier { + + @Override + protected void configureProducer(RouteBuilder builder, RouteDefinition producerRoute) { + //uploads a file "test.txt" containing "OK" + producerRoute.log("storing file in ftp") + .setBody(builder.constant("OK")) + .toF("ftp://localhost:%s/test.txt?username=scott&password=tiger&binary=true&passiveMode=true&delay=1000", Review Comment: User name and password should be provided instead of being hard coded ########## tests/features/camel-ftp/src/test/java/org/apache/karaf/camel/itest/FtpServerResource.java: ########## @@ -0,0 +1,84 @@ +package org.apache.karaf.camel.itest; + +import static org.apache.karaf.camel.itest.CamelFtpITest.FTP_PORT_PROPERTY; + +import java.util.Collections; +import java.util.List; + +import org.apache.ftpserver.ConnectionConfigFactory; +import org.apache.ftpserver.FtpServer; +import org.apache.ftpserver.FtpServerFactory; +import org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory; +import org.apache.ftpserver.ftplet.FtpException; +import org.apache.ftpserver.ftplet.UserManager; +import org.apache.ftpserver.listener.Listener; +import org.apache.ftpserver.listener.ListenerFactory; +import org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor; +import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory; +import org.apache.ftpserver.usermanager.impl.BaseUser; +import org.apache.ftpserver.usermanager.impl.WritePermission; +import org.apache.karaf.camel.itests.AvailablePortProvider; +import org.apache.karaf.camel.itests.ExternalResource; +import org.apache.karaf.camel.itests.ExternalResourceWithPrerequisite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class FtpServerResource extends ExternalResourceWithPrerequisite { + + private static final Logger LOG = LoggerFactory.getLogger(FtpServerResource.class); + private static final AvailablePortProvider portProvider = new AvailablePortProvider(List.of(FTP_PORT_PROPERTY)); Review Comment: Does it need to be static? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
