File Cleanup - Event to JMX
This commit is contained in:
@@ -19,20 +19,24 @@ package org.springframework.integration.ftp;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class FtpMessageHistoryTests {
|
||||
@Test
|
||||
public void testMessageHistory() throws Exception {
|
||||
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("ftp-message-history-context.xml", this.getClass());
|
||||
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("ftp-message-history-context.xml",
|
||||
this.getClass());
|
||||
SourcePollingChannelAdapter adapter = ac.getBean("adapterFtp", SourcePollingChannelAdapter.class);
|
||||
assertEquals("adapterFtp", adapter.getComponentName());
|
||||
assertEquals("ftp:inbound-channel-adapter", adapter.getComponentType());
|
||||
ac.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class FtpParserInboundTests {
|
||||
@Test
|
||||
public void testLocalFilesAutoCreationTrue() throws Exception {
|
||||
assertTrue(!new File("target/foo").exists());
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-context.xml", this.getClass()).close();
|
||||
assertTrue(new File("target/foo").exists());
|
||||
assertTrue(!new File("target/bar").exists());
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class FtpParserInboundTests {
|
||||
public void testLocalFilesAutoCreationFalse() throws Exception {
|
||||
assertTrue(!new File("target/bar").exists());
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-fail-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-fail-context.xml", this.getClass()).close();
|
||||
fail("BeansException expected.");
|
||||
}
|
||||
catch (BeansException e) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.io.File;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
@@ -31,6 +30,7 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class FtpInboundOutboundSanitySample {
|
||||
|
||||
@@ -55,18 +55,20 @@ public class FtpInboundOutboundSanitySample {
|
||||
fileB.delete();
|
||||
}
|
||||
|
||||
new ClassPathXmlApplicationContext("FtpInboundChannelAdapterSample-context.xml", this.getClass());
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"FtpInboundChannelAdapterSample-context.xml", this.getClass());
|
||||
Thread.sleep(3000);
|
||||
fileA = new File("local-test-dir/b.test");
|
||||
fileB = new File("local-test-dir/b.test");
|
||||
assertTrue(fileA.exists());
|
||||
assertTrue(fileB.exists());
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testFtpOutboundChannelAdapter() throws Exception {
|
||||
ApplicationContext ac =
|
||||
ClassPathXmlApplicationContext ac =
|
||||
new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterSample-context.xml", this.getClass());
|
||||
File fileA = new File("local-test-dir/a.test");
|
||||
File fileB = new File("local-test-dir/b.test");
|
||||
@@ -78,6 +80,7 @@ public class FtpInboundOutboundSanitySample {
|
||||
fileB = new File("remote-target-dir/b.test");
|
||||
assertTrue(fileA.exists());
|
||||
assertTrue(fileB.exists());
|
||||
ac.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.integration.metadata.SimpleMetadataStore;
|
||||
public class FtpPersistentAcceptOnceFileListFilterTests {
|
||||
|
||||
@Test
|
||||
public void testRollback() {
|
||||
public void testRollback() throws Exception {
|
||||
FtpPersistentAcceptOnceFileListFilter filter = new FtpPersistentAcceptOnceFileListFilter(
|
||||
new SimpleMetadataStore(), "rollback:");
|
||||
FTPFile ftpFile1 = new FTPFile();
|
||||
@@ -60,6 +60,7 @@ public class FtpPersistentAcceptOnceFileListFilterTests {
|
||||
assertEquals("baz", now.get(1).getName());
|
||||
now = filter.filterFiles(files);
|
||||
assertEquals(0, now.size());
|
||||
filter.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user