use of org.springframework.integration.mail.SearchTermStrategy in project spring-integration by spring-projects.
the class ImapIdleChannelAdapterParserTests method customAdapter.
@Test
public void customAdapter() {
Object adapter = context.getBean("customAdapter");
assertEquals(ImapIdleChannelAdapter.class, adapter.getClass());
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
Object channel = context.getBean("channel");
assertSame(channel, adapterAccessor.getPropertyValue("outputChannel"));
assertEquals(Boolean.FALSE, adapterAccessor.getPropertyValue("autoStartup"));
Object receiver = adapterAccessor.getPropertyValue("mailReceiver");
assertEquals(ImapMailReceiver.class, receiver.getClass());
DirectFieldAccessor receiverAccessor = new DirectFieldAccessor(receiver);
Object url = receiverAccessor.getPropertyValue("url");
assertEquals(new URLName("imap:foo"), url);
Properties properties = (Properties) receiverAccessor.getPropertyValue("javaMailProperties");
assertEquals("bar", properties.getProperty("foo"));
assertEquals(Boolean.FALSE, receiverAccessor.getPropertyValue("shouldDeleteMessages"));
SearchTermStrategy stStrategy = context.getBean("searchTermStrategy", SearchTermStrategy.class);
assertEquals(stStrategy, TestUtils.getPropertyValue(adapter, "mailReceiver.searchTermStrategy"));
}
use of org.springframework.integration.mail.SearchTermStrategy in project spring-integration by spring-projects.
the class InboundChannelAdapterParserTests method imapWithSearchTermStrategy.
// ==================== INT-2800 ====================
@Test
public void imapWithSearchTermStrategy() {
AbstractMailReceiver receiver = this.getReceiver("imapWithSearch");
assertEquals(ImapMailReceiver.class, receiver.getClass());
DirectFieldAccessor receiverAccessor = new DirectFieldAccessor(receiver);
Object sts = receiverAccessor.getPropertyValue("searchTermStrategy");
assertNotNull(sts);
assertSame(context.getBean(SearchTermStrategy.class), sts);
assertEquals("flagged", receiverAccessor.getPropertyValue("userFlag"));
}
Aggregations