INT-786, added namespace support for metadata-support strategy and tests
This commit is contained in:
@@ -26,10 +26,12 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.context.metadata.MetadataStore;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
@@ -162,6 +164,5 @@ public class FeedEntryReaderMessageSourceTests {
|
||||
|
||||
assertEquals("Spring Integration adapters", entry3.getTitle().trim());
|
||||
assertEquals(1272044098000L, entry3.getPublishedDate().getTime());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
http://www.springframework.org/schema/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed-2.0.xsd">
|
||||
|
||||
|
||||
<int-feed:inbound-channel-adapter id="feedAdapter" channel="feedChannel" auto-startup="false"
|
||||
<int-feed:inbound-channel-adapter id="feedAdapter"
|
||||
channel="feedChannel"
|
||||
auto-startup="false"
|
||||
metadata-store="metaStore"
|
||||
feedUrl="file:src/test/java/org/springframework/integration/feed/config/sample.rss">
|
||||
<int:poller fixed-rate="10000" max-messages-per-poll="100" />
|
||||
</int-feed:inbound-channel-adapter>
|
||||
@@ -16,4 +19,5 @@
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="metaStore" class="org.springframework.integration.feed.config.FeedMessageSourceBeanDefinitionParserTests.SampleMetadataStore"/>
|
||||
</beans>
|
||||
@@ -36,6 +36,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.context.metadata.MetadataStore;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.feed.FeedEntryReaderMessageSource;
|
||||
@@ -63,11 +64,13 @@ public class FeedMessageSourceBeanDefinitionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateSuccessfullConfiguration(){
|
||||
public void validateSuccessfullConfigurationWithCustomMetastore(){
|
||||
ClassPathXmlApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("FeedMessageSourceBeanDefinitionParserTests-file-context.xml", this.getClass());
|
||||
SourcePollingChannelAdapter adapter = context.getBean("feedAdapter", SourcePollingChannelAdapter.class);
|
||||
FeedEntryReaderMessageSource source = (FeedEntryReaderMessageSource) TestUtils.getPropertyValue(adapter, "source");
|
||||
MetadataStore metaStore = (MetadataStore) TestUtils.getPropertyValue(source, "metadataStore");
|
||||
assertTrue(metaStore instanceof SampleMetadataStore);
|
||||
FeedReaderMessageSource feedReaderMessageSource = (FeedReaderMessageSource) TestUtils.getPropertyValue(source, "feedReaderMessageSource");
|
||||
AbstractFeedFetcher fetcher = (AbstractFeedFetcher) TestUtils.getPropertyValue(feedReaderMessageSource, "fetcher");
|
||||
assertTrue(fetcher instanceof FileUrlFeedFetcher);
|
||||
@@ -166,4 +169,14 @@ public class FeedMessageSourceBeanDefinitionParserTests {
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SampleMetadataStore implements MetadataStore{
|
||||
|
||||
public void write(Properties metadata) {
|
||||
}
|
||||
|
||||
public Properties load() {
|
||||
return new Properties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user