You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2008/12/08 19:18:01 UTC
svn commit: r724434 - in /activemq/camel/trunk/components/camel-atom/src:
main/java/org/apache/camel/component/atom/ test/data/
test/java/org/apache/camel/component/atom/
Author: janstey
Date: Mon Dec 8 10:18:00 2008
New Revision: 724434
URL: http://svn.apache.org/viewvc?rev=724434&view=rev
Log:
CAMEL-1156 - Add sortEntries option to camel-atom
Added:
activemq/camel/trunk/components/camel-atom/src/test/data/unsortedfeed.atom
activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java (with props)
Modified:
activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java
activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java
activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerTest.java
Modified: activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java?rev=724434&r1=724433&r2=724434&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java (original)
+++ activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java Mon Dec 8 10:18:00 2008
@@ -44,12 +44,20 @@
private Document<Feed> getDocument() throws IOException, ParseException {
if (document == null) {
document = AtomUtils.parseDocument(endpoint.getFeedUri());
- list = document.getRoot().getEntries();
+ Feed root = document.getRoot();
+ if (endpoint.isSortEntries()) {
+ sortEntries(root);
+ }
+ list = root.getEntries();
entryIndex = list.size() - 1;
}
return document;
}
-
+
+ protected void sortEntries(Feed feed) {
+ feed.sortEntriesByUpdated(true);
+ }
+
@Override
protected void populateList(Object feed) throws ParseException, IOException {
// list is populated already in the createFeed method
Modified: activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java?rev=724434&r1=724433&r2=724434&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java (original)
+++ activemq/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java Mon Dec 8 10:18:00 2008
@@ -43,14 +43,17 @@
public boolean isValidEntry(FeedEndpoint endpoint, Object feed, Object entry) {
Date updated = ((Entry)entry).getUpdated();
+ if (updated == null) { // never been updated so get published date
+ updated = ((Entry)entry).getPublished();
+ }
if (updated == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("No updated time for entry so assuming its valid: entry=[" + entry + "]");
}
return true;
- }
+ }
if (lastUpdate != null) {
- if (lastUpdate.after(updated)) {
+ if (lastUpdate.after(updated) || lastUpdate.equals(updated)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Entry is older than lastupdate=[" + lastUpdate
+ "], no valid entry=[" + entry + "]");
Added: activemq/camel/trunk/components/camel-atom/src/test/data/unsortedfeed.atom
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-atom/src/test/data/unsortedfeed.atom?rev=724434&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-atom/src/test/data/unsortedfeed.atom (added)
+++ activemq/camel/trunk/components/camel-atom/src/test/data/unsortedfeed.atom Mon Dec 8 10:18:00 2008
@@ -0,0 +1,427 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
+ <title type="text">Jon Anstey's Blog</title>
+ <link rel="alternate" type="text/html" href="http://janstey.blogspot.com/" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-12-07T11:57:38+00:00</updated>
+ <generator uri="http://www.blogger.com">Blogger</generator>
+ <openSearch:totalResults
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
+ 10
+ </openSearch:totalResults>
+ <openSearch:startIndex
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
+ 1
+ </openSearch:startIndex>
+ <openSearch:itemsPerPage
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
+ 25
+ </openSearch:itemsPerPage>
+ <id>tag:blogger.com,1999:blog-7653570007295451610</id>
+ <link rel="self" href="http://feeds.feedburner.com/JonAnsteysBlog"
+ type="application/atom+xml" />
+ <entry>
+ <title type="text">How do you use your Apache Camel?</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/11/how-do-you-use-your-apache-camel.html" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-11-12T08:08:35-06:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-2482225272893952676
+ </id>
+ <content type="html">
+ <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://1.bp.blogspot.com/_JZEz3zQ95mA/SRri_qOWMCI/AAAAAAAAADI/PBAuk1poLDw/s1600-h/apache-camel-6.png"><img
+ style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width:
+ 232px; height: 108px;"
+ src="http://1.bp.blogspot.com/_JZEz3zQ95mA/SRri_qOWMCI/AAAAAAAAADI/PBAuk1poLDw/s400/apache-camel-6.png"
+ alt="" id="BLOGGER_PHOTO_ID_5267772297457315874" border="0"
+ /></a><br />The Apache Camel project has been growing by
+ leaps and bounds lately it seems. Much of this growth has been driven by a
+ vibrant community (many thanks to all users! :) ). Its typically hard
+ though to know what kind of applications Camel is being used in. We don't
+ have much visibility into the cool stuff people are doing with Camel. In
+ particular, in would be nice to know what other applications are being
+ used with Camel... eg. CMSs, DBs, ESBs, App Servers, web frameworks, other
+ frameworks, etc etc<br /><br />I've started a thread <a
+ href="http://www.nabble.com/-TO-USERS--How-do-you-use-your-Apache-Camel--tt20460957s22882.html">here</a>
+ trying to capture how folks are using Camel. Please, if you're a user of
+ Camel, take a minute to share how it is being used on the thread or here.
+ This will only help us make Camel better and more useful in the future. No
+ confidential info allowed, of course ;)
+ </content>
+ <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/"
+ url="http://1.bp.blogspot.com/_JZEz3zQ95mA/SRri_qOWMCI/AAAAAAAAADI/PBAuk1poLDw/s72-c/apache-camel-6.png"
+ height="72" width="72" />
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Creating Apache Camel projects with m2eclipse</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/11/creating-apache-camel-projects-with.html" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-11-05T11:20:18-06:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-5257226557237229806
+ </id>
+ <content type="html">
+ I just noticed today that <a
+ href="http://activemq.apache.org/camel">Apache Camel</a> shows up
+ by default in the <a
+ href="http://m2eclipse.sonatype.org/">m2eclipse</a> <a
+ href="http://www.sonatype.com/book/reference/eclipse.html#sect-m2e-create-archetype">New
+ Maven Project</a> dialog. No extra fooling around is required
+ anymore. Very cool!<br /><br /><a onblur="try
+ {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://4.bp.blogspot.com/_JZEz3zQ95mA/SRHTlIaMwPI/AAAAAAAAADA/h3aTEao9fSg/s1600-h/newmavenproject.png"><img
+ style="margin: 0px auto 10px; display: block; text-align: center; cursor:
+ pointer; width: 400px; height: 286px;"
+ src="http://4.bp.blogspot.com/_JZEz3zQ95mA/SRHTlIaMwPI/AAAAAAAAADA/h3aTEao9fSg/s400/newmavenproject.png"
+ alt="" id="BLOGGER_PHOTO_ID_5265222074238812402" border="0"
+ /></a><br />This is by far the easiest way to get started
+ with Apache Camel - you don't even have to leave your IDE.
+ </content>
+ <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/"
+ url="http://4.bp.blogspot.com/_JZEz3zQ95mA/SRHTlIaMwPI/AAAAAAAAADA/h3aTEao9fSg/s72-c/newmavenproject.png"
+ height="72" width="72" />
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Apache Camel 1.5.0 Released!</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/10/apache-camel-150-released.html" />
+ <category term="Apache Camel" />
+ <category term="Open Source" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-10-31T12:02:21-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-6738685122661677555
+ </id>
+ <content type="html">
+ <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://1.bp.blogspot.com/_JZEz3zQ95mA/SQs3Y9gcT2I/AAAAAAAAACo/9fliISzJtHg/s1600-h/apache-camel-6.png"><img
+ style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width:
+ 232px; height: 108px;"
+ src="http://1.bp.blogspot.com/_JZEz3zQ95mA/SQs3Y9gcT2I/AAAAAAAAACo/9fliISzJtHg/s400/apache-camel-6.png"
+ alt="" id="BLOGGER_PHOTO_ID_5263361491479580514" border="0"
+ /></a><br />Several months and 266 fixes later (a new
+ record!), the <a href="http://activemq.apache.org/camel/">Apache
+ Camel</a> team is proud to present version 1.5.0!<br /><br
+ />Go ahead, take a look at the <a
+ href="http://activemq.apache.org/camel/camel-150-release.html">release
+ notes</a> and grab it <a
+ href="http://activemq.apache.org/camel/download.html">here</a>.
+ Its still pretty fresh so it may take a few hours before the release
+ propagates to all Apache download mirrors (try <a
+ href="http://people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/camel/apache-camel/1.5.0/">here</a>
+ otherwise).
+ </content>
+ <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/"
+ url="http://1.bp.blogspot.com/_JZEz3zQ95mA/SQs3Y9gcT2I/AAAAAAAAACo/9fliISzJtHg/s72-c/apache-camel-6.png"
+ height="72" width="72" />
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Repeatable Maven Builds</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/10/repeatable-maven-builds.html" />
+ <category term="Nexus" />
+ <category term="Open Source" />
+ <category term="Maven" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-10-14T17:51:57-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-2808091344275336113
+ </id>
+ <content type="html">
+ A typical problem folks have with Maven seems to be <a
+ href="http://aidan-skinner.livejournal.com/229584.html?thread=615632#t615632">getting
+ repeatable builds</a>. If you've encountered this, you know the
+ pain: an older release needs to be built but now fails with the dreaded
+ "Failed to resolve artifact" error. You can't really depend on most Maven
+ repos to be there indefinitely. I'm sure repos like http://repo1.maven.org
+ are pretty safe but AFAIK the maintainers are under no legal obligation to
+ keep around the artifacts forever. You most likely DO have obligations to
+ customers and thus need to ensure builds are repeatable.<br /><br
+ />You get repeatability for free when you use a repository manager like
+ <a href="http://nexus.sonatype.org/">Nexus</a> - it keeps
+ downloaded artifacts around forever by default. If you don't want to use a
+ repository manager, you're going to have to save those artifacts some
+ other (manual) way. One approach would be to just tar up your local m2
+ repo after each release and store it somewhere safe (like in SVN). Of
+ course, since local repos tend to get huge over time, you should always
+ start from an empty local repo before a release.<br /><br
+ />Hope this helps.
+ </content>
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Why drop Maven?</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/10/why-drop-maven.html" />
+ <category term="Open Source" />
+ <category term="Maven" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-10-14T17:52:03-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-2951217751083066805
+ </id>
+ <content type="html">
+ Recently I've noticed projects dropping Maven in favour of some other
+ build tool... Apache Qpid comes to mind in this case. I'm wondering, is
+ there a real good technical reason that folks do not like Maven? It has
+ its quirks... but really, what tool doesn't? I've been using it for years
+ now and like it better that any other build tool out there.
+ </content>
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Nexus indices added for FUSE</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/09/nexus-indices-added-for-fuse.html" />
+ <category term="m2eclipse" />
+ <category term="Nexus" />
+ <category term="Maven" />
+ <category term="FUSE" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-09-19T16:28:48-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-8495762864343317713
+ </id>
+ <content type="html">
+ I've added <a href="http://nexus.sonatype.org/">Nexus</a>
+ repository indices for the <a
+ href="http://open.iona.com/">FUSE</a> Maven repositories. You can
+ find instructions on how to add these to your <a
+ href="http://m2eclipse.sonatype.org/">m2eclipse</a> installation
+ <a
+ href="http://open.iona.com/wiki/display/ProdInfo/Adding+FUSE+Maven+repos+to+m2eclipse"><span
+ style="text-decoration: underline;">here</span></a>.<br
+ /><br />Why should you care? Well, among many other things, this
+ enables you:<br /><br />1. <a
+ href="http://www.sonatype.com/book/reference/eclipse.html#sect-m2e-create-archetype">Create</a>
+ new projects based on Camel archetypes<br />2. <a
+ href="http://www.sonatype.com/book/reference/eclipse.html#d0e18331">Search</a>
+ for classes in all FUSE artifacts<br />3. <a
+ href="http://www.sonatype.com/book/reference/eclipse.html#d0e18191">Add</a>
+ FUSE dependencies to your project's POM
+ </content>
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Nexus config for Apache Camel</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/09/nexus-config-for-apache-camel.html" />
+ <category term="Nexus" />
+ <category term="Apache Camel" />
+ <category term="Open Source" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-09-09T18:41:22-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-8110068338407384585
+ </id>
+ <content type="html">
+ Some folks have been having issues getting all the Maven repositories set
+ up properly in <a href="http://nexus.sonatype.org/">Nexus</a>
+ for <a href="http://activemq.apache.org/camel/">Apache
+ Camel</a>. Here's my working Nexus config and settings.xml - hope it
+ helps!<br /><a
+ href="http://people.apache.org/%7Ejanstey/blog_stuff/camel_nexus_config/nexus.xml"><br
+ />Nexus config</a> (admittedly polluted with repos from other
+ projects...)<br /><br /><a
+ href="http://people.apache.org/%7Ejanstey/blog_stuff/camel_nexus_config/settings.xml">settings.xml</a><br
+ /><br />I found my Nexus config in /opt/sonatype-work/nexus/conf.
+ I'm not sure what happens when you copy in a new Nexus config file so you
+ should probably make a copy of the sonatype-work directory first :)
+ </content>
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total>
+ </entry>
+ <entry>
+ <title type="text">I'm an Apache Camel committer!</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/09/im-apache-camel-committer.html" />
+ <category term="Apache Camel" />
+ <category term="Open Source" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-09-04T10:32:53-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-8954622480986228001
+ </id>
+ <content type="html">
+ <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://1.bp.blogspot.com/_JZEz3zQ95mA/SL__VwjctTI/AAAAAAAAACg/ytJRqteOmNI/s1600-h/apache-camel-6.png"><img
+ style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;"
+ src="http://1.bp.blogspot.com/_JZEz3zQ95mA/SL__VwjctTI/AAAAAAAAACg/ytJRqteOmNI/s200/apache-camel-6.png"
+ alt="" id="BLOGGER_PHOTO_ID_5242189240558466354" border="0"
+ /></a><br />Over the past few months I've been hacking away
+ on various parts of <a
+ href="http://activemq.apache.org/camel/">Apache Camel</a>. It was
+ initially just for fun, but quickly turned into my day job :) With over 40
+ fixes contributed, the Camel team decided to vote me in as a
+ committer!<br /><br />This is my first committer status on any
+ Apache project so its pretty exciting. I've traditionally been involved
+ with closed source projects only.<br /><br />Looking forward
+ to more Camel hacking!<br /><br />BTW for those who are
+ interesting in contributing to the growing Camel project, <a
+ href="http://icodebythesea.blogspot.com/">Jamie</a> posted a good
+ guide to Apache process <a
+ href="http://icodebythesea.blogspot.com/2008/09/responses-how-to-contribute-to-apache.html">here</a>.
+ </content>
+ <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/"
+ url="http://1.bp.blogspot.com/_JZEz3zQ95mA/SL__VwjctTI/AAAAAAAAACg/ytJRqteOmNI/s72-c/apache-camel-6.png"
+ height="72" width="72" />
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Nexus == easy</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/08/nexus-easy.html" />
+ <category term="Nexus" />
+ <category term="Apache Camel" />
+ <category term="Open Source" />
+ <category term="Maven" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-08-27T18:43:27-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-1016140995124806496
+ </id>
+ <content type="html">
+ I must admit, the <a href="http://maven.apache.org/">Maven</a>
+ setup at work has me a bit spoiled. Direct LAN access to a bunch of Maven
+ mirrors makes for some pretty fast builds. Problem is, when I go off site
+ I have to suffer through slow builds again...<br /><br
+ />Thanks to <a
+ href="http://bsnyderblog.blogspot.com/">Bruce</a> I now have
+ wicked fast builds off site too!! A local instance of <a
+ href="http://nexus.sonatype.org/">Nexus</a> is the answer.
+ Seriously, go take a look at <a
+ href="http://bsnyderblog.blogspot.com/2008/08/do-you-use-maven-if-so-you-need-nexus.html">the
+ steps Bruce posted</a>. It took me like 30 minutes to setup and add
+ about <span style="font-weight: bold;">twenty</span> mirrors -
+ now thats freakin' easy.<br /><br />Heres the best part (I'm
+ building <a href="http://activemq.apache.org/camel">Apache
+ Camel</a> here with a clean local repo):<br /><br />No
+ mirroring<br /><span style="font-family:courier new;">[INFO]
+ Total time: 31 minutes 18 seconds</span><br /><br
+ />Custom internal mirrors<br />[INFO] Total time: 7 minutes 52
+ seconds<br /><br />Nexus mirroring<br />[INFO] Total
+ time: 3 minutes 3 seconds<br /><br />Anyway, bottom line is
+ that I'm impressed. Great work Maven guys!
+ </content>
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total>
+ </entry>
+ <entry>
+ <title type="text">Eclipse Templates for Apache Camel</title>
+ <link rel="alternate" type="text/html"
+ href="http://janstey.blogspot.com/2008/08/eclipse-templates-for-apache-camel.html" />
+ <category term="Apache Camel" />
+ <category term="Open Source" />
+ <author>
+ <name>Jonathan Anstey</name>
+ <email>noreply@blogger.com</email>
+ <uri>http://www.blogger.com/profile/15936382362202148472</uri>
+ </author>
+ <updated>2008-08-27T08:09:43-05:00</updated>
+ <id>
+ tag:blogger.com,1999:blog-7653570007295451610.post-7161378749124824806
+ </id>
+ <content type="html">
+ If you didn't know already, Eclipse allows you to define custom templates
+ for commonly used code snippets. Its a very neat feature for those of us
+ who are memory challenged or don't like typing things twice!<br
+ /><br />I think that Apache Camel users could really benefit from
+ having predefined templates for doing Camel routing. I also hear a lot of
+ requests like "I have this Java DSL route, how do I do this in the Spring
+ XML DSL?" so having both Java and XML templates for the same thing is
+ essential.<br /><br />You can find the templates I did up
+ <a
+ href="http://issues.apache.org/activemq/secure/attachment/16910/camel_java_templates.xml">here</a>
+ &amp; <a
+ href="http://issues.apache.org/activemq/secure/attachment/16911/camel_xml_templates.xml">here</a>.
+ To import these browse to the template screens defined at:<br
+ /><br />Window -> Preferences -> Java -> Editor ->
+ Templates<br />and<br />Window -> Preferences -> Web and
+ XML -> XML Files -> Templates.<br /><br />Once imported,
+ you can type Ctrl + Space and then type 'camel' to search for the camel
+ templates. You should see something like this in the Java and XML
+ editors:<br /><br /><a onblur="try
+ {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://2.bp.blogspot.com/_JZEz3zQ95mA/SLSnY6Y4TjI/AAAAAAAAAB4/iLfLvi1ljtE/s1600-h/java_template_selection.png"><img
+ style="margin: 0px auto 10px; display: block; text-align: center; cursor:
+ pointer;"
+ src="http://2.bp.blogspot.com/_JZEz3zQ95mA/SLSnY6Y4TjI/AAAAAAAAAB4/iLfLvi1ljtE/s320/java_template_selection.png"
+ alt="" id="BLOGGER_PHOTO_ID_5238996312971038258" border="0"
+ /></a><a onblur="try
+ {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://4.bp.blogspot.com/_JZEz3zQ95mA/SLSnZd9AEfI/AAAAAAAAACA/qy6BVcAG6_U/s1600-h/xml_template_selection.png"><img
+ style="margin: 0px auto 10px; display: block; text-align: center; cursor:
+ pointer;"
+ src="http://4.bp.blogspot.com/_JZEz3zQ95mA/SLSnZd9AEfI/AAAAAAAAACA/qy6BVcAG6_U/s320/xml_template_selection.png"
+ alt="" id="BLOGGER_PHOTO_ID_5238996322517783026" border="0"
+ /></a><br />When you select, say a Content Based Router,
+ you'll get a route something like this in the Java and XML editors:<br
+ /><br /><a onblur="try
+ {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://4.bp.blogspot.com/_JZEz3zQ95mA/SLSphdkYyDI/AAAAAAAAACY/_mqBSr3uJpU/s1600-h/java_template.png"><img
+ style="margin: 0px auto 10px; display: block; text-align: center; cursor:
+ pointer;"
+ src="http://4.bp.blogspot.com/_JZEz3zQ95mA/SLSphdkYyDI/AAAAAAAAACY/_mqBSr3uJpU/s400/java_template.png"
+ alt="" id="BLOGGER_PHOTO_ID_5238998658876753970" border="0"
+ /></a><br /><a onblur="try
+ {parent.deselectBloggerImageGracefully();} catch(e) {}"
+ href="http://3.bp.blogspot.com/_JZEz3zQ95mA/SLSn-w1dxdI/AAAAAAAAACQ/-gE7mDXagzM/s1600-h/xml_template.png"><img
+ style="margin: 0px auto 10px; display: block; text-align: center; cursor:
+ pointer; width: 381px; height: 201px;"
+ src="http://3.bp.blogspot.com/_JZEz3zQ95mA/SLSn-w1dxdI/AAAAAAAAACQ/-gE7mDXagzM/s320/xml_template.png"
+ alt="" id="BLOGGER_PHOTO_ID_5238996963241608658" border="0"
+ /></a><br />The formatting was a bit wonky for these
+ Eclipse templates so you might want to pretty up your routes before
+ showing anyone else :)<br /><br />Let me know what you think!
+ </content>
+ <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/"
+ url="http://2.bp.blogspot.com/_JZEz3zQ95mA/SLSnY6Y4TjI/AAAAAAAAAB4/iLfLvi1ljtE/s72-c/java_template_selection.png"
+ height="72" width="72" />
+ <thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total>
+ </entry>
+</feed>
Modified: activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerTest.java?rev=724434&r1=724433&r2=724434&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerTest.java (original)
+++ activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerTest.java Mon Dec 8 10:18:00 2008
@@ -16,9 +16,15 @@
*/
package org.apache.camel.component.atom;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import javax.naming.Context;
+
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.util.jndi.JndiContext;
/**
* Unit test for AtomEntryPollingConsumer
@@ -43,14 +49,22 @@
mock.assertIsSatisfied();
}
+ @Override
+ protected Context createJndiContext() throws Exception {
+ JndiContext jndi = new JndiContext();
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
+ jndi.bind("myDate", df.parse("2007-11-13 14:35:00 +0100"));
+ return jndi;
+ }
+
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
from("atom:file:src/test/data/feed.atom?splitEntries=true&consumer.delay=500").to("mock:result1");
- from("atom:file:src/test/data/feed.atom?splitEntries=true&filter=false&consumer.delay=500").to("mock:result2");
+ from("atom:file:src/test/data/feed.atom?splitEntries=true&filter=false&consumer.delay=500").to("mock:result2");
- from("atom:file:src/test/data/feed.atom?splitEntries=true&filter=true&lastUpdate=2007-11-13T14:35:00&consumer.delay=500").to("mock:result3");
+ from("atom:file:src/test/data/feed.atom?splitEntries=true&filter=true&lastUpdate=#myDate&consumer.delay=500").to("mock:result3");
}
};
}
Added: activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java?rev=724434&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java (added)
+++ activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java Mon Dec 8 10:18:00 2008
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.component.atom;
+
+import java.util.Date;
+
+import javax.naming.Context;
+
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.camel.Body;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.ExpressionBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.util.jndi.JndiContext;
+
+public class AtomEntrySortTest extends ContextTestSupport {
+
+ public void testSortedEntries() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:sorted");
+ mock.expectsAscending(ExpressionBuilder.beanExpression("myBean", "getPubDate"));
+ mock.expectedMessageCount(10);
+ mock.assertIsSatisfied();
+ }
+
+ public void testUnSortedEntries() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:unsorted");
+ mock.expectsAscending(ExpressionBuilder.beanExpression("myBean", "getPubDate"));
+ mock.expectedMessageCount(10);
+ mock.setResultWaitTime(2000L);
+ mock.assertIsNotSatisfied(2000L);
+ }
+
+ @Override
+ protected Context createJndiContext() throws Exception {
+ JndiContext jndi = new JndiContext();
+ jndi.bind("myBean", new MyBean());
+ return jndi;
+ }
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("atom:file:src/test/data/unsortedfeed.atom?splitEntries=true&sortEntries=true&consumer.delay=50").to("mock:sorted");
+ from("atom:file:src/test/data/unsortedfeed.atom?splitEntries=true&sortEntries=false&consumer.delay=50").to("mock:unsorted");
+ }
+ };
+ }
+
+ public static class MyBean {
+ public Date getPubDate(@Body Object body) {
+ Entry syndEntry = (Entry) body;
+ return syndEntry.getUpdated();
+ }
+ }
+}
Propchange: activemq/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java
------------------------------------------------------------------------------
svn:eol-style = native