|
47 | 47 | import org.springframework.context.ApplicationContext; |
48 | 48 | import org.springframework.context.annotation.Bean; |
49 | 49 | import org.springframework.context.event.EventListener; |
50 | | -import org.springframework.expression.spel.standard.SpelExpressionParser; |
51 | 50 | import org.springframework.integration.IntegrationMessageHeaderAccessor; |
52 | 51 | import org.springframework.integration.channel.DirectChannel; |
53 | 52 | import org.springframework.integration.endpoint.SourcePollingChannelAdapter; |
| 53 | +import org.springframework.integration.expression.FunctionExpression; |
54 | 54 | import org.springframework.integration.file.FileHeaders; |
55 | 55 | import org.springframework.integration.file.filters.FileListFilter; |
56 | 56 | import org.springframework.integration.file.remote.MessageSessionCallback; |
|
71 | 71 | import org.springframework.integration.ftp.session.FtpRemoteFileTemplate; |
72 | 72 | import org.springframework.integration.support.MessageBuilder; |
73 | 73 | import org.springframework.integration.support.PartialSuccessException; |
74 | | -import org.springframework.integration.test.context.TestApplicationContextAware; |
75 | 74 | import org.springframework.integration.test.util.TestUtils; |
76 | 75 | import org.springframework.messaging.Message; |
77 | 76 | import org.springframework.messaging.MessagingException; |
|
99 | 98 | */ |
100 | 99 | @SpringJUnitConfig |
101 | 100 | @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) |
102 | | -public class FtpServerOutboundTests extends FtpTestSupport implements TestApplicationContextAware { |
| 101 | +public class FtpServerOutboundTests extends FtpTestSupport { |
103 | 102 |
|
104 | 103 | @Autowired |
105 | 104 | private SessionFactory<FTPFile> ftpSessionFactory; |
@@ -376,8 +375,7 @@ public void testInt3100RawGET() throws Exception { |
376 | 375 | @Test |
377 | 376 | public void testRawGETWithTemplate() { |
378 | 377 | RemoteFileTemplate<FTPFile> template = new RemoteFileTemplate<>(this.ftpSessionFactory); |
379 | | - template.setFileNameExpression(new SpelExpressionParser().parseExpression("payload")); |
380 | | - template.setBeanFactory(TEST_INTEGRATION_CONTEXT); |
| 378 | + template.setFileNameExpression(new FunctionExpression<Message<?>>(Message::getPayload)); |
381 | 379 | template.afterPropertiesSet(); |
382 | 380 | final ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); |
383 | 381 | assertThat(template.get(new GenericMessage<>("ftpSource/ ftpSource1.txt"), |
@@ -846,7 +844,9 @@ public void handleEvent(ApacheMinaFtpEvent event) { |
846 | 844 | else if (event.getSession().getClientAddress().equals(this.clientAddress)) { |
847 | 845 | this.events.add(event); |
848 | 846 | } |
849 | | - if (event instanceof SessionClosedEvent) { |
| 847 | + if (event instanceof SessionClosedEvent |
| 848 | + && event.getSession().getClientAddress().equals(this.clientAddress)) { |
| 849 | + |
850 | 850 | this.latch.countDown(); |
851 | 851 | } |
852 | 852 | } |
|
0 commit comments