]> source.dussan.org Git - archiva.git/commitdiff
[MRM-123]
authorMaria Odea B. Ching <oching@apache.org>
Thu, 3 Apr 2008 03:42:59 +0000 (03:42 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Thu, 3 Apr 2008 03:42:59 +0000 (03:42 +0000)
-move the rss classes to it's own module

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@644151 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-common/pom.xml
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/rss/RssFeedEntry.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/rss/RssFeedGenerator.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/rss/RssFeedGeneratorTest.java [deleted file]
archiva-modules/archiva-web/archiva-rss/pom.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/RssFeedEntry.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/RssFeedGenerator.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java [new file with mode: 0644]
archiva-modules/archiva-web/pom.xml

index 1bce1011340311cf08b1afe6cd114a00897739da..de064e520f8f84d8fa7f132611b9f5d10ddd99fd 100644 (file)
       <artifactId>xalan</artifactId>
       <version>2.7.0</version>
     </dependency>
-    <dependency>
-      <groupId>rome</groupId>
-      <artifactId>rome</artifactId>
-      <version>0.9</version>
-    </dependency>
     <dependency>
       <groupId>dom4j</groupId>
       <artifactId>dom4j</artifactId>
       <version>1.6.1</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>xmlunit</groupId>
-      <artifactId>xmlunit</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/rss/RssFeedEntry.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/rss/RssFeedEntry.java
deleted file mode 100644 (file)
index cb9f81c..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.apache.maven.archiva.common.rss;
-
-/*
- * 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.
- */
-
-/**
- * Holds the data for the SyndEntry in the RSS feed.
- * 
- * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- * @version
- */
-public class RssFeedEntry
-{
-    private String title;
-    
-    private String link;
-    
-    private String description;
-    
-    private String author;
-    
-    private String category;
-    
-    private String comments;
-    
-    private String enclosure;
-    
-    private String guid;
-    
-    private String source;
-
-    public String getTitle()
-    {
-        return title;
-    }
-
-    public void setTitle( String title )
-    {
-        this.title = title;
-    }
-
-    public String getLink()
-    {
-        return link;
-    }
-
-    public void setLink( String link )
-    {
-        this.link = link;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public void setDescription( String description )
-    {
-        this.description = description;
-    }
-
-    public String getAuthor()
-    {
-        return author;
-    }
-
-    public void setAuthor( String author )
-    {
-        this.author = author;
-    }
-
-    public String getCategory()
-    {
-        return category;
-    }
-
-    public void setCategory( String category )
-    {
-        this.category = category;
-    }
-
-    public String getComments()
-    {
-        return comments;
-    }
-
-    public void setComments( String comments )
-    {
-        this.comments = comments;
-    }
-
-    public String getEnclosure()
-    {
-        return enclosure;
-    }
-
-    public void setEnclosure( String enclosure )
-    {
-        this.enclosure = enclosure;
-    }
-
-    public String getGuid()
-    {
-        return guid;
-    }
-
-    public void setGuid( String guid )
-    {
-        this.guid = guid;
-    }
-
-    public String getSource()
-    {
-        return source;
-    }
-
-    public void setSource( String source )
-    {
-        this.source = source;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/rss/RssFeedGenerator.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/rss/RssFeedGenerator.java
deleted file mode 100644 (file)
index 8187b7c..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.apache.maven.archiva.common.rss;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.sun.syndication.feed.synd.SyndContent;
-import com.sun.syndication.feed.synd.SyndContentImpl;
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndEntryImpl;
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.feed.synd.SyndFeedImpl;
-import com.sun.syndication.io.FeedException;
-import com.sun.syndication.io.SyndFeedOutput;
-
-/**
- * Generates RSS feeds.
- * 
- * @plexus.component role="org.apache.maven.archiva.common.rss.RssFeedGenerator"
- * 
- * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- * @version
- */
-public class RssFeedGenerator
-{
-    private Logger log = LoggerFactory.getLogger( RssFeedGenerator.class );
-
-    // TODO: make configurable
-    public static String DEFAULT_FEEDTYPE = "rss_2.0";
-
-    public static String DEFAULT_LANGUAGE = "en-us";
-
-    public void generateFeed( String title, String link, String description, List<RssFeedEntry> dataEntries,
-                              File outputFile )
-    {
-        SyndFeed feed = new SyndFeedImpl();
-        feed.setFeedType( DEFAULT_FEEDTYPE );
-
-        feed.setTitle( title );
-        feed.setLink( link );
-        feed.setDescription( description );
-        feed.setLanguage( DEFAULT_LANGUAGE );
-        feed.setPublishedDate( Calendar.getInstance().getTime() );
-
-        feed.setEntries( getEntries( dataEntries ) );
-
-        try
-        {
-            Writer writer = new FileWriter( outputFile );
-            SyndFeedOutput output = new SyndFeedOutput();
-            output.output( feed, writer );
-            writer.close();
-        }
-        catch ( IOException ie )
-        {
-            log.error( "Error occurred while generating the feed : " + ie.getMessage() );
-        }
-        catch ( FeedException fe )
-        {
-            log.error( "Error occurred while generating the feed : " + fe.getMessage() );
-        }
-    }
-
-    private List<SyndEntry> getEntries( List<RssFeedEntry> dataEntries )
-    {
-        List<SyndEntry> entries = new ArrayList<SyndEntry>();
-        SyndEntry entry;
-        SyndContent description;
-
-        for ( RssFeedEntry dataEntry : dataEntries )
-        {
-            entry = new SyndEntryImpl();
-            entry.setTitle( dataEntry.getTitle() );
-            entry.setLink( dataEntry.getLink() );
-            entry.setPublishedDate( Calendar.getInstance().getTime() );
-
-            description = new SyndContentImpl();
-            description.setType( "text/plain" );
-            description.setValue( dataEntry.getDescription() );
-            entry.setDescription( description );
-
-            entries.add( entry );
-        }
-
-        return entries;
-    }
-
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/rss/RssFeedGeneratorTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/rss/RssFeedGeneratorTest.java
deleted file mode 100644 (file)
index cf2b0e7..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.apache.maven.archiva.common.rss;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.io.FileUtils;
-import org.codehaus.plexus.PlexusTestCase;
-import org.custommonkey.xmlunit.XMLAssert;
-
-/**
- * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- * @version
- */
-public class RssFeedGeneratorTest
-    extends PlexusTestCase
-{
-    private RssFeedGenerator generator;
-
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-
-        generator = (RssFeedGenerator) lookup( RssFeedGenerator.class );
-
-        File outputDir = new File( getBasedir(), "/target/test-classes/rss-feeds" );
-        outputDir.mkdir();
-    }
-
-    public void testGenerateFeed()
-        throws Exception
-    {
-        File outputFile = new File( getBasedir(), "/target/test-classes/rss-feeds/generated-rss2.0-feed.xml" );
-
-        List<RssFeedEntry> entries = new ArrayList<RssFeedEntry>();
-        RssFeedEntry entry = new RssFeedEntry();
-
-        entry.setTitle( "Item 1" );
-        entry.setLink( "http://rss-2.0-test-feed.com" );
-        entry.setDescription( "RSS 2.0 feed item 1." );
-        entry.setGuid( "http://rss-2.0-test-feed.com/item1" );
-        entries.add( entry );
-
-        entry = new RssFeedEntry();
-        entry.setTitle( "Item 2" );
-        entry.setLink( "http://rss-2.0-test-feed.com" );
-        entry.setDescription( "RSS 2.0 feed item 2." );
-        entry.setGuid( "http://rss-2.0-test-feed.com/item2" );
-        entries.add( entry );
-
-        entry = new RssFeedEntry();
-        entry.setTitle( "Item 3" );
-        entry.setLink( "http://rss-2.0-test-feed.com" );
-        entry.setDescription( "RSS 2.0 feed item 3." );
-        entry.setGuid( "http://rss-2.0-test-feed.com/item3" );
-        entries.add( entry );
-
-        generator.generateFeed( "Test Feed", "http://localhost:8080/archiva", "The test feed from Archiva.", entries,
-                                outputFile );
-
-        String generatedContent = FileUtils.readFileToString( outputFile );
-
-        XMLAssert.assertXpathEvaluatesTo( "Test Feed", "//channel/title", generatedContent );
-        XMLAssert.assertXpathEvaluatesTo( "http://localhost:8080/archiva", "//channel/link", generatedContent );
-        XMLAssert.assertXpathEvaluatesTo( "The test feed from Archiva.", "//channel/description", generatedContent );
-        XMLAssert.assertXpathEvaluatesTo( "en-us", "//channel/language", generatedContent );
-
-        String expectedItem1 =
-            "<channel><item><title>Item 1</title></item><item><title>Item 2</title></item>"
-                + "<item><title>Item 3</title></item></channel>";
-        XMLAssert.assertXpathsEqual( "//channel/item/title", expectedItem1, "//channel/item/title", generatedContent );
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-modules/archiva-web/archiva-rss/pom.xml
new file mode 100644 (file)
index 0000000..585f165
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <artifactId>archiva-web</artifactId>
+    <groupId>org.apache.archiva</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>archiva-rss</artifactId>
+  <name>Archiva Web :: RSS</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>rome</groupId>
+      <artifactId>rome</artifactId>
+      <version>0.9</version>
+    </dependency>
+    <dependency>
+      <groupId>xmlunit</groupId>
+      <artifactId>xmlunit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/RssFeedEntry.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/RssFeedEntry.java
new file mode 100644 (file)
index 0000000..9a766d8
--- /dev/null
@@ -0,0 +1,137 @@
+package org.apache.archiva.rss;
+
+/*
+ * 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.
+ */
+
+/**
+ * Holds the data for the SyndEntry in the RSS feed.
+ * 
+ * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
+ * @version
+ */
+public class RssFeedEntry
+{
+    private String title;
+    
+    private String link;
+    
+    private String description;
+    
+    private String author;
+    
+    private String category;
+    
+    private String comments;
+    
+    private String enclosure;
+    
+    private String guid;
+    
+    private String source;
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+    public void setTitle( String title )
+    {
+        this.title = title;
+    }
+
+    public String getLink()
+    {
+        return link;
+    }
+
+    public void setLink( String link )
+    {
+        this.link = link;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public String getAuthor()
+    {
+        return author;
+    }
+
+    public void setAuthor( String author )
+    {
+        this.author = author;
+    }
+
+    public String getCategory()
+    {
+        return category;
+    }
+
+    public void setCategory( String category )
+    {
+        this.category = category;
+    }
+
+    public String getComments()
+    {
+        return comments;
+    }
+
+    public void setComments( String comments )
+    {
+        this.comments = comments;
+    }
+
+    public String getEnclosure()
+    {
+        return enclosure;
+    }
+
+    public void setEnclosure( String enclosure )
+    {
+        this.enclosure = enclosure;
+    }
+
+    public String getGuid()
+    {
+        return guid;
+    }
+
+    public void setGuid( String guid )
+    {
+        this.guid = guid;
+    }
+
+    public String getSource()
+    {
+        return source;
+    }
+
+    public void setSource( String source )
+    {
+        this.source = source;
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/RssFeedGenerator.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/RssFeedGenerator.java
new file mode 100644 (file)
index 0000000..c6f50b3
--- /dev/null
@@ -0,0 +1,114 @@
+package org.apache.archiva.rss;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.sun.syndication.feed.synd.SyndContent;
+import com.sun.syndication.feed.synd.SyndContentImpl;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndEntryImpl;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.feed.synd.SyndFeedImpl;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.SyndFeedOutput;
+
+/**
+ * Generates RSS feeds.
+ * 
+ * @plexus.component role="org.apache.archiva.rss.RssFeedGenerator"
+ * 
+ * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
+ * @version
+ */
+public class RssFeedGenerator
+{
+    private Logger log = LoggerFactory.getLogger( RssFeedGenerator.class );
+
+    // TODO: make configurable
+    public static String DEFAULT_FEEDTYPE = "rss_2.0";
+
+    public static String DEFAULT_LANGUAGE = "en-us";
+
+    public void generateFeed( String title, String link, String description, List<RssFeedEntry> dataEntries,
+                              File outputFile )
+    {
+        SyndFeed feed = new SyndFeedImpl();
+        feed.setFeedType( DEFAULT_FEEDTYPE );
+
+        feed.setTitle( title );
+        feed.setLink( link );
+        feed.setDescription( description );
+        feed.setLanguage( DEFAULT_LANGUAGE );
+        feed.setPublishedDate( Calendar.getInstance().getTime() );
+
+        feed.setEntries( getEntries( dataEntries ) );
+
+        try
+        {
+            Writer writer = new FileWriter( outputFile );
+            SyndFeedOutput output = new SyndFeedOutput();
+            output.output( feed, writer );
+            writer.close();
+        }
+        catch ( IOException ie )
+        {
+            log.error( "Error occurred while generating the feed : " + ie.getMessage() );
+        }
+        catch ( FeedException fe )
+        {
+            log.error( "Error occurred while generating the feed : " + fe.getMessage() );
+        }
+    }
+
+    private List<SyndEntry> getEntries( List<RssFeedEntry> dataEntries )
+    {
+        List<SyndEntry> entries = new ArrayList<SyndEntry>();
+        SyndEntry entry;
+        SyndContent description;
+
+        for ( RssFeedEntry dataEntry : dataEntries )
+        {
+            entry = new SyndEntryImpl();
+            entry.setTitle( dataEntry.getTitle() );
+            entry.setLink( dataEntry.getLink() );
+            entry.setPublishedDate( Calendar.getInstance().getTime() );
+
+            description = new SyndContentImpl();
+            description.setType( "text/plain" );
+            description.setValue( dataEntry.getDescription() );
+            entry.setDescription( description );
+
+            entries.add( entry );
+        }
+
+        return entries;
+    }
+
+}
diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java
new file mode 100644 (file)
index 0000000..ac86c82
--- /dev/null
@@ -0,0 +1,93 @@
+package org.apache.archiva.rss;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.codehaus.plexus.PlexusTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
+
+/**
+ * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
+ * @version
+ */
+public class RssFeedGeneratorTest
+    extends PlexusTestCase
+{
+    private RssFeedGenerator generator;
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        generator = (RssFeedGenerator) lookup( RssFeedGenerator.class );
+
+        File outputDir = new File( getBasedir(), "/target/test-classes/rss-feeds" );
+        outputDir.mkdir();
+    }
+
+    public void testGenerateFeed()
+        throws Exception
+    {
+        File outputFile = new File( getBasedir(), "/target/test-classes/rss-feeds/generated-rss2.0-feed.xml" );
+
+        List<RssFeedEntry> entries = new ArrayList<RssFeedEntry>();
+        RssFeedEntry entry = new RssFeedEntry();
+
+        entry.setTitle( "Item 1" );
+        entry.setLink( "http://rss-2.0-test-feed.com" );
+        entry.setDescription( "RSS 2.0 feed item 1." );
+        entry.setGuid( "http://rss-2.0-test-feed.com/item1" );
+        entries.add( entry );
+
+        entry = new RssFeedEntry();
+        entry.setTitle( "Item 2" );
+        entry.setLink( "http://rss-2.0-test-feed.com" );
+        entry.setDescription( "RSS 2.0 feed item 2." );
+        entry.setGuid( "http://rss-2.0-test-feed.com/item2" );
+        entries.add( entry );
+
+        entry = new RssFeedEntry();
+        entry.setTitle( "Item 3" );
+        entry.setLink( "http://rss-2.0-test-feed.com" );
+        entry.setDescription( "RSS 2.0 feed item 3." );
+        entry.setGuid( "http://rss-2.0-test-feed.com/item3" );
+        entries.add( entry );
+
+        generator.generateFeed( "Test Feed", "http://localhost:8080/archiva", "The test feed from Archiva.", entries,
+                                outputFile );
+
+        String generatedContent = FileUtils.readFileToString( outputFile );
+
+        XMLAssert.assertXpathEvaluatesTo( "Test Feed", "//channel/title", generatedContent );
+        XMLAssert.assertXpathEvaluatesTo( "http://localhost:8080/archiva", "//channel/link", generatedContent );
+        XMLAssert.assertXpathEvaluatesTo( "The test feed from Archiva.", "//channel/description", generatedContent );
+        XMLAssert.assertXpathEvaluatesTo( "en-us", "//channel/language", generatedContent );
+
+        String expectedItem1 =
+            "<channel><item><title>Item 1</title></item><item><title>Item 2</title></item>"
+                + "<item><title>Item 3</title></item></channel>";
+        XMLAssert.assertXpathsEqual( "//channel/item/title", expectedItem1, "//channel/item/title", generatedContent );
+    }
+}
index 45240897bbdeb11bdf18d53479993c1ec5095135..e1ee19300014b3e78f7f81a276e0a141e16384df 100644 (file)
@@ -13,9 +13,7 @@
   ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.archiva</groupId>
@@ -34,6 +32,7 @@
     <module>archiva-security</module>
     <module>archiva-webapp</module>
     <module>archiva-webdav</module>
+    <module>archiva-rss</module>
   </modules>
 
   <profiles>
@@ -44,4 +43,4 @@
       </modules>
     </profile>
   </profiles>
-</project>
+</project>
\ No newline at end of file