getting rid of warnings
This commit is contained in:
@@ -24,7 +24,7 @@ import org.apache.commons.net.ftp.FTPClient;
|
||||
*
|
||||
* @author Iwein Fuld
|
||||
*/
|
||||
public interface FtpClientPool extends FtpClientFactory {
|
||||
public interface FtpClientPool extends FtpClientFactory<FTPClient> {
|
||||
|
||||
/**
|
||||
* Releases the client back to the pool. When calling this method the caller
|
||||
|
||||
@@ -16,14 +16,8 @@
|
||||
|
||||
package org.springframework.integration.ftp;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.AbstractFactoryBean;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ResourceLoaderAware;
|
||||
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.integration.file.FileNameGenerator;
|
||||
|
||||
/**
|
||||
@@ -33,8 +27,7 @@ import org.springframework.integration.file.FileNameGenerator;
|
||||
* @author Iwein Fuld
|
||||
* @author Josh Long
|
||||
*/
|
||||
public class FtpSendingMessageHandlerFactoryBean extends AbstractFactoryBean<FtpSendingMessageHandler>
|
||||
implements ResourceLoaderAware, ApplicationContextAware {
|
||||
public class FtpSendingMessageHandlerFactoryBean extends AbstractFactoryBean<FtpSendingMessageHandler> {
|
||||
|
||||
protected int port;
|
||||
|
||||
@@ -52,12 +45,8 @@ public class FtpSendingMessageHandlerFactoryBean extends AbstractFactoryBean<Ftp
|
||||
|
||||
private int fileType;
|
||||
|
||||
private ResourceLoader resourceLoader;
|
||||
|
||||
private FileNameGenerator fileNameGenerator;
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
|
||||
public void setCharset(String charset) {
|
||||
this.charset = charset;
|
||||
@@ -95,14 +84,6 @@ public class FtpSendingMessageHandlerFactoryBean extends AbstractFactoryBean<Ftp
|
||||
this.remoteDirectory = remoteDirectory;
|
||||
}
|
||||
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends FtpSendingMessageHandler> getObjectType() {
|
||||
return FtpSendingMessageHandler.class;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.ftp;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
|
||||
@@ -13,22 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.ftp;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
@@ -38,29 +33,26 @@ import org.springframework.integration.test.util.TestUtils;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class FtpParserOutboundTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void testFtpOutboundWithFileGenerator() throws Exception{
|
||||
ClassPathXmlApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("FtpParserOutboundTests-context.xml", this.getClass());
|
||||
|
||||
new ClassPathXmlApplicationContext("FtpParserOutboundTests-context.xml", this.getClass());
|
||||
FileNameGenerator fileNameGenerator = context.getBean("fileNameGenerator", FileNameGenerator.class);
|
||||
assertNotNull(fileNameGenerator);
|
||||
when(fileNameGenerator.generateFileName(Mockito.any(Message.class))).thenReturn("oleg-ftp-test.txt");
|
||||
|
||||
EventDrivenConsumer fileOutboundEndpoint = context.getBean("ftpOutboundAdapter", EventDrivenConsumer.class);
|
||||
FtpSendingMessageHandler handler = (FtpSendingMessageHandler) TestUtils.getPropertyValue(fileOutboundEndpoint, "handler");
|
||||
Message<String> message = new GenericMessage<String>("ftp file generator test");
|
||||
try {
|
||||
handler.handleMessage(message);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
verify(fileNameGenerator, times(1)).generateFileName(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -10,7 +26,9 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
* @author Josh Long
|
||||
*/
|
||||
public class OutboundFtpExample {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("outbound-ftp-context.xml");
|
||||
new ClassPathXmlApplicationContext("outbound-ftp-context.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -10,7 +26,9 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
* @author Josh Long
|
||||
*/
|
||||
public class OutboundFtpsExample {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("outbound-ftps-context.xml");
|
||||
new ClassPathXmlApplicationContext("outbound-ftps-context.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user