diff options
author | Maria Odea B. Ching <oching@apache.org> | 2008-04-30 02:18:43 +0000 |
---|---|---|
committer | Maria Odea B. Ching <oching@apache.org> | 2008-04-30 02:18:43 +0000 |
commit | a8bc40dbd4e39841dca02c43b8634317a0cb6844 (patch) | |
tree | c48b3af651e81a4bc7831a0d007405fe312ce5e0 /archiva-modules/archiva-web/archiva-rss/src | |
parent | 0b42dd6a563d6fc6d8353ff113a9594af6e18f2e (diff) | |
download | archiva-a8bc40dbd4e39841dca02c43b8634317a0cb6844.tar.gz archiva-a8bc40dbd4e39841dca02c43b8634317a0cb6844.zip |
[MRM-773]
-added the servlet that would handle the rss feed requests
-created tests for the servlet
-removed thrown exception in getSpringConfigLocation() that is being overridden in PlexusInStringTestCase
-updated jsps to the new rss feed urls
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@652230 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rss/src')
6 files changed, 20 insertions, 24 deletions
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 index eb7328fb6..8934ad6aa 100644 --- 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 @@ -54,33 +54,26 @@ public class RssFeedGenerator private String DEFAULT_LINK = "http://localhost:8080/archiva/rss/"; public SyndFeed generateFeed( String title, String description, List<RssFeedEntry> dataEntries, - String outputFilename ) + String queryString ) { - SyndFeed feed = null; - List<SyndEntry> existingEntries = null; - - feed = new SyndFeedImpl(); + SyndFeed feed = new SyndFeedImpl(); feed.setTitle( title ); - feed.setLink( DEFAULT_LINK + outputFilename ); + feed.setLink( DEFAULT_LINK + queryString ); feed.setDescription( description ); feed.setLanguage( DEFAULT_LANGUAGE ); feed.setPublishedDate( Calendar.getInstance().getTime() ); feed.setFeedType( DEFAULT_FEEDTYPE ); - feed.setEntries( getEntries( dataEntries, existingEntries ) ); + feed.setEntries( getEntries( dataEntries ) ); log.debug( "Finished generating the feed \'" + title + "\'." ); return feed; } - private List<SyndEntry> getEntries( List<RssFeedEntry> dataEntries, List<SyndEntry> existingEntries ) + private List<SyndEntry> getEntries( List<RssFeedEntry> dataEntries ) { - List<SyndEntry> entries = existingEntries; - if ( entries == null ) - { - entries = new ArrayList<SyndEntry>(); - } + List<SyndEntry> entries = new ArrayList<SyndEntry>(); SyndEntry entry; SyndContent description; diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/AbstractArtifactsRssFeedProcessor.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/AbstractArtifactsRssFeedProcessor.java index e982f7375..ecce863db 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/AbstractArtifactsRssFeedProcessor.java +++ b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/AbstractArtifactsRssFeedProcessor.java @@ -56,17 +56,18 @@ public abstract class AbstractArtifactsRssFeedProcessor entry.setDescription( description ); entries.add( entry ); } - - String repoId = artifact.getModel().getRepositoryId(); + if ( !isRepoLevel ) { entry = new RssFeedEntry( getTitle() + "\'" + artifact.getGroupId() + ":" + artifact.getArtifactId() + "\'" + " as of " + new Date( whenGathered ) ); - description = getDescription() + "\'" + repoId + "\'" + ": \n" + artifact.toString() + " | "; + description = getDescription() + "\'" + artifact.getGroupId() + ":" + artifact.getArtifactId() + + "\'" + ": \n" + artifact.toString() + " | "; } else { + String repoId = artifact.getModel().getRepositoryId(); entry = new RssFeedEntry( getTitle() + "\'" + repoId + "\'" + " as of " + new Date( whenGathered ) ); description = getDescription() + "\'" + repoId + "\'" + ": \n" + artifact.toString() + " | "; } diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java index c79a88aba..776042796 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java +++ b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java @@ -48,7 +48,7 @@ public class NewArtifactsRssFeedProcessor { private String title = "New Artifacts in Repository "; - private String desc = "New Versions of Artifact "; + private String desc = "These are the new artifacts found in the repository "; /** * @plexus.requirement @@ -89,7 +89,7 @@ public class NewArtifactsRssFeedProcessor List<RssFeedEntry> entries = processData( artifacts, true ); return generator.generateFeed( getTitle() + "\'" + repoId + "\'", "New artifacts found in repository " + - "\'" + repoId + "\'" + " during repository scan.", entries, "new_artifacts_" + repoId + ".xml" ); + "\'" + repoId + "\'" + " during repository scan.", entries, "rss_feeds?repoId=" + repoId ); } catch ( ArchivaDatabaseException ae ) { diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java index fde40f079..058838aed 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java +++ b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessor.java @@ -49,7 +49,7 @@ public class NewVersionsOfArtifactRssFeedProcessor { private String title = "New Versions of Artifact "; - private String desc = "These are the new artifacts found in the repository "; + private String desc = "These are the new versions of artifact "; /** * @plexus.requirement @@ -71,8 +71,8 @@ public class NewVersionsOfArtifactRssFeedProcessor String repoId = reqParams.get( RssFeedProcessor.KEY_REPO_ID ); String groupId = reqParams.get( RssFeedProcessor.KEY_GROUP_ID ); String artifactId = reqParams.get( RssFeedProcessor.KEY_ARTIFACT_ID ); - - if ( repoId != null && groupId != null && artifactId != null ) + + if ( groupId != null && artifactId != null ) { return processNewVersionsOfArtifact( repoId, groupId, artifactId ); } @@ -87,12 +87,14 @@ public class NewVersionsOfArtifactRssFeedProcessor Constraint artifactVersions = new ArtifactVersionsConstraint( repoId, groupId, artifactId, "whenGathered" ); List<ArchivaArtifact> artifacts = artifactDAO.queryArtifacts( artifactVersions ); + log.info( "Queried artifacts size :: " + artifacts.size() ); + List<RssFeedEntry> entries = processData( artifacts, false ); String key = groupId + ":" + artifactId; return generator.generateFeed( getTitle() + "\'" + key + "\'", "New versions of artifact " + "\'" + key + "\' found in repository " + "\'" + repoId + "\'" + " during repository scan.", entries, - "new_versions_" + key + ".xml" ); + "rss_feeds?groupId=" + groupId + "&artifactId=" + artifactId ); } catch ( ObjectNotFoundException oe ) diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java index 5d4d89b67..cce0d1606 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java +++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java @@ -116,7 +116,7 @@ public class NewArtifactsRssFeedProcessorTest SyndFeed feed = newArtifactsProcessor.process( reqParams ); assertTrue( feed.getTitle().equals( "New Artifacts in Repository 'test-repo'" ) ); - assertTrue( feed.getLink().equals( "http://localhost:8080/archiva/rss/new_artifacts_test-repo.xml" ) ); + assertTrue( feed.getLink().equals( "http://localhost:8080/archiva/rss/rss_feeds?repoId=test-repo" ) ); assertTrue( feed.getDescription().equals( "New artifacts found in repository 'test-repo' during repository scan." ) ); assertTrue( feed.getLanguage().equals( "en-us" ) ); diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java index 098cdd8be..15f763c4d 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java +++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java @@ -93,7 +93,7 @@ public class NewVersionsOfArtifactRssFeedProcessorTest SyndFeed feed = newVersionsProcessor.process( reqParams ); assertEquals( "New Versions of Artifact 'org.apache.archiva:artifact-two'", feed.getTitle() ); - assertEquals( "http://localhost:8080/archiva/rss/new_versions_org.apache.archiva:artifact-two.xml", + assertEquals( "http://localhost:8080/archiva/rss/rss_feeds?groupId=org.apache.archiva&artifactId=artifact-two", feed.getLink() ); assertEquals( "New versions of artifact 'org.apache.archiva:artifact-two' found in repository 'test-repo' during repository scan.", |