You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2012/12/18 10:03:28 UTC
svn commit: r1423355 - in /maven/plugins/trunk/maven-changes-plugin: ./
src/main/java/org/apache/maven/plugin/changes/
src/main/java/org/apache/maven/plugin/issues/ src/main/resources/
src/test/java/org/apache/maven/plugin/changes/
Author: ltheussl
Date: Tue Dec 18 09:03:16 2012
New Revision: 1423355
URL: http://svn.apache.org/viewvc?rev=1423355&view=rev
Log:
[MCHANGES-46] add rss feed generation using rome library
Added:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/FeedGenerator.java (with props)
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/FeedGeneratorTest.java (with props)
Modified:
maven/plugins/trunk/maven-changes-plugin/pom.xml
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/AbstractIssuesReportGenerator.java
maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report.properties
maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_de.properties
maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_fr.properties
maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_pt_BR.properties
maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_sv.properties
Modified: maven/plugins/trunk/maven-changes-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/pom.xml?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/pom.xml Tue Dec 18 09:03:16 2012
@@ -356,6 +356,13 @@ under the License.
<version>4.1.2</version>
</dependency>
+ <!-- for rss feed generation -->
+ <dependency>
+ <groupId>rome</groupId>
+ <artifactId>rome</artifactId>
+ <version>1.0</version>
+ </dependency>
+
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java Tue Dec 18 09:03:16 2012
@@ -20,9 +20,14 @@ package org.apache.maven.plugin.changes;
*/
import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
+import java.io.Writer;
+
import java.net.URL;
+
import java.text.SimpleDateFormat;
+
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
@@ -42,9 +47,9 @@ import org.apache.maven.reporting.MavenR
import org.apache.maven.shared.filtering.MavenFileFilter;
import org.apache.maven.shared.filtering.MavenFileFilterRequest;
import org.apache.maven.shared.filtering.MavenFilteringException;
+
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.io.input.XmlStreamReader;
@@ -203,6 +208,22 @@ public class ChangesMojo
private String url;
/**
+ * The type of the feed to generate.
+ *
+ * <p>
+ * Supported values are:
+ * <code>"rss_0.9", "rss_0.91N" (RSS 0.91 Netscape), "rss_0.91U" (RSS 0.91 Userland),
+ * "rss_0.92", "rss_0.93", "rss_0.94", "rss_1.0", "rss_2.0", "atom_0.3", "atom_1.0"</code>.
+ * </p>
+ *
+ * <p>If not specified, no feed is generated.</p>
+ *
+ * @since 2.9
+ */
+ @Parameter
+ private String feedType;
+
+ /**
* The path of the <code>changes.xml</code> file that will be converted into an HTML report.
*/
@Parameter( property = "changes.xmlPath", defaultValue = "src/changes/changes.xml" )
@@ -314,6 +335,15 @@ public class ChangesMojo
getLog().warn( "No issue management URL defined in POM. Links to your issues will not work correctly." );
}
+ boolean feedGenerated = false;
+
+ if ( StringUtils.isNotEmpty( feedType ) )
+ {
+ feedGenerated = generateFeed( changesXml, locale );
+ }
+
+ report.setLinkToFeed( feedGenerated );
+
report.doGenerateReport( getBundle( locale ), getSink() );
// Copy the images
@@ -473,4 +503,48 @@ public class ChangesMojo
}
}
}
+
+ private boolean generateFeed( final ChangesXML changesXml, final Locale locale )
+ {
+ getLog().debug( "Generating " + feedType + " feed." );
+
+ boolean success = true;
+
+ final FeedGenerator feed = new FeedGenerator( locale );
+ feed.setLink( project.getUrl() + "/changes-report.html" ); // TODO: better way?
+ feed.setTitle( project.getName() + ": " + changesXml.getTitle() );
+ feed.setAuthor( changesXml.getAuthor() );
+ feed.setDateFormat( new SimpleDateFormat( publishDateFormat, new Locale( publishDateLocale ) ) );
+
+ Writer writer = null;
+
+ try
+ {
+ writer = new FileWriter( new File( getReportOutputDirectory(), "changes.rss" ) );
+ feed.export( changesXml.getReleaseList(), feedType, writer );
+ }
+ catch ( IOException ex )
+ {
+ success = false;
+ getLog().warn( "Failed to create rss feed: " + ex.getMessage() );
+ getLog().debug( ex );
+ }
+ finally
+ {
+ try
+ {
+ if ( writer != null )
+ {
+ writer.close();
+ }
+ }
+ catch ( IOException ex )
+ {
+ getLog().warn( "Failed to close writer: " + ex.getMessage() );
+ getLog().debug( ex );
+ }
+ }
+
+ return success;
+ }
}
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java Tue Dec 18 09:03:16 2012
@@ -27,6 +27,7 @@ import java.util.Map;
import java.util.ResourceBundle;
import org.apache.commons.lang.StringUtils;
+
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.util.HtmlTools;
import org.apache.maven.plugin.issues.AbstractIssuesReportGenerator;
@@ -74,6 +75,8 @@ public class ChangesReportGenerator exte
private boolean addActionDate;
+ private boolean linkToFeed;
+
/**
* @since 2.4
*/
@@ -171,6 +174,16 @@ public class ChangesReportGenerator exte
this.addActionDate = addActionDate;
}
+ public boolean isLinkToFeed()
+ {
+ return linkToFeed;
+ }
+
+ public void setLinkToFeed( boolean generateLinkTofeed )
+ {
+ this.linkToFeed = generateLinkTofeed;
+ }
+
/**
* Checks whether links to the issues can be generated for the given system.
*
@@ -468,14 +481,17 @@ public class ChangesReportGenerator exte
sink.table_();
- // @todo Temporarily commented out until MCHANGES-46 is completely solved
- // sink.rawText( bundle.getString( "report.changes.text.rssfeed" ) );
- // sink.text( " " );
- // sink.link( "changes.rss" );
- // sinkFigure( "images/rss.png", sink );
- // sink.link_();
- //
- // sink.lineBreak();
+ // MCHANGES-46
+ if ( linkToFeed )
+ {
+ sink.paragraph();
+ sink.text( bundle.getString( "report.changes.text.rssfeed" ) );
+ sink.nonBreakingSpace();
+ sink.link( "changes.rss" );
+ sinkFigure( sink, "images/rss.png", "rss feed" );
+ sink.link_();
+ sink.paragraph_();
+ }
sink.section2_();
}
Added: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/FeedGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/FeedGenerator.java?rev=1423355&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/FeedGenerator.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/FeedGenerator.java Tue Dec 18 09:03:16 2012
@@ -0,0 +1,276 @@
+package org.apache.maven.plugin.changes;
+
+/*
+ * 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 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;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.maven.doxia.util.HtmlTools;
+
+import org.apache.maven.plugins.changes.model.Release;
+
+
+/**
+ *
+ * @author ltheussl
+ */
+public class FeedGenerator
+{
+ private final ResourceBundle rbundle;
+ private final SyndFeed feed;
+
+ private String link;
+ private String title;
+ private String author;
+ private DateFormat dateFormat;
+
+ /**
+ * Initialize feedGenerator for a given locale.
+ *
+ * @param locale a locale for i18n.
+ */
+ public FeedGenerator( final Locale locale )
+ {
+ this.feed = new SyndFeedImpl();
+ this.rbundle = ResourceBundle.getBundle( "changes-report", locale, this.getClass().getClassLoader() );
+ }
+
+ /**
+ * The author of the feed.
+ *
+ * @return the author.
+ */
+ public String getAuthor()
+ {
+ return author;
+ }
+
+ /**
+ * Set the author of the feed.
+ *
+ * @param author not null.
+ */
+ public void setAuthor( final String author )
+ {
+ this.author = author.trim(); // this also assures that author is not null.
+ }
+
+ /**
+ * The title of the feed.
+ *
+ * @return the title.
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+ /**
+ * Set the title of the feed.
+ *
+ * @param title not null.
+ */
+ public void setTitle( final String title )
+ {
+ this.title = title.trim(); // this also assures that title is not null.
+ }
+
+ /**
+ * The DateFormat.
+ *
+ * @return may be null.
+ */
+ public DateFormat getDateFormat()
+ {
+ return dateFormat;
+ }
+
+ /**
+ * Set the date format.
+ * This should match the date format used for the release dates in changes.xml.
+ *
+ * @param dateFormat may be null.
+ */
+ public void setDateFormat( final DateFormat dateFormat )
+ {
+ this.dateFormat = dateFormat;
+ }
+
+ /**
+ * The main link of the feed.
+ *
+ * @return the link.
+ */
+ public String getLink()
+ {
+ return link;
+ }
+
+ /**
+ * Set the main link of the feed.
+ *
+ * @param link not null.
+ */
+ public void setLink( final String link )
+ {
+ this.link = link.trim(); // this also assures that link is not null.
+ }
+
+ /**
+ * Determine if a given feed type is supported. The currently supported values are:
+ * <code>"rss_0.9", "rss_0.91N" (RSS 0.91 Netscape), "rss_0.91U" (RSS 0.91 Userland),
+ * "rss_0.92", "rss_0.93", "rss_0.94", "rss_1.0", "rss_2.0", "atom_0.3", "atom_1.0"</code>.
+ *
+ * @param type the feed type to check. May be null.
+ *
+ * @return true if if the given type is supported by the rome library, false otherwise.
+ */
+ public boolean isSupportedFeedType( final String type )
+ {
+ return getSupportedFeedTypes().contains( type );
+ }
+
+ /**
+ * A List of supported feed types.
+ *
+ * @return a List of supported feed types.
+ *
+ * @see #isSupportedFeedType(java.lang.String)
+ */
+ @SuppressWarnings( "unchecked" )
+ public List<String> getSupportedFeedTypes()
+ {
+ return feed.getSupportedFeedTypes();
+ }
+
+ /**
+ * Extract a feed and export it to a Writer.
+ *
+ * @param releases the List of Releases. Only the last release is used in the feed.
+ * @param feedType The type of the feed to generate.
+ * See {@link #isSupportedFeedType(java.lang.String)} for supported values.
+ *
+ * @param writer a Writer. Note that this is not flushed nor closed upon exit.
+ *
+ * @throws IOException if an error occurs during export.
+ */
+ public void export( final List<Release> releases, final String feedType, final Writer writer )
+ throws IOException
+ {
+ feed.setFeedType( feedType );
+ feed.setTitle( title );
+ feed.setAuthor( author );
+ feed.setPublishedDate( new Date() );
+ feed.setLink( link );
+ feed.setDescription( rbundle.getString( "report.changes.text.rssfeed.description" ) );
+ feed.setLanguage( rbundle.getLocale().getLanguage() );
+ //feed.setCopyright( );
+ //feed.setEncoding();
+ feed.setEntries( getEntries( releases ) );
+
+ try
+ {
+ new SyndFeedOutput().output( feed, writer );
+ }
+ catch ( FeedException ex )
+ {
+ throw new IOException( ex );
+ }
+ }
+
+ private List<SyndEntry> getEntries( final List<Release> releases )
+ {
+ final List<SyndEntry> entries = new ArrayList<SyndEntry>( 1 );
+
+ if ( releases.size() > 0 )
+ {
+ final Release release = releases.get( 0 ); // TODO: is this guaranteed to be the latest?
+
+ final SyndEntry entry = new SyndEntryImpl();
+ entry.setTitle( release.getVersion() );
+ entry.setLink( link + "#" + HtmlTools.encodeId( release.getVersion() ) );
+ entry.setDescription( getSyndContent( release ) );
+ entry.setPublishedDate( getDate( release.getDateRelease(), dateFormat ) );
+
+ entries.add( entry );
+ }
+
+ return entries;
+ }
+
+ private static SyndContent getSyndContent( final Release release )
+ {
+ final SyndContent syndContent = new SyndContentImpl();
+ syndContent.setType( "text/html" );
+
+ final StringBuilder sb = new StringBuilder( 512 );
+
+ final String description = release.getDescription();
+
+ if ( description != null && description.trim().length() > 0 )
+ {
+ sb.append( "<p>" ).append( description ).append( "</p>" );
+ }
+
+ // TODO: localize?
+ sb.append( "<p>Version " )
+ .append( release.getVersion() ).append( " is available with " )
+ .append( release.getActions().size() ).append( " fixed issues.</p>" );
+
+ syndContent.setValue( sb.toString() );
+
+ return syndContent;
+ }
+
+ private static Date getDate( final String dateRelease, final DateFormat dateFormat )
+ {
+ if ( dateFormat == null )
+ {
+ return new Date();
+ }
+
+ try
+ {
+ return dateFormat.parse( dateRelease );
+ }
+ catch ( ParseException ex )
+ {
+ return new Date();
+ }
+ }
+}
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/FeedGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/FeedGenerator.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/AbstractIssuesReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/AbstractIssuesReportGenerator.java?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/AbstractIssuesReportGenerator.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/AbstractIssuesReportGenerator.java Tue Dec 18 09:03:16 2012
@@ -139,11 +139,7 @@ public abstract class AbstractIssuesRepo
attributes.addAttribute( "alt", altText );
attributes.addAttribute( "title", altText );
- sink.figure( null );
-
sink.figureGraphics( image, attributes );
-
- sink.figure_();
}
protected void sinkHeader( Sink sink, String header )
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report.properties?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report.properties Tue Dec 18 09:03:16 2012
@@ -28,6 +28,7 @@ report.changes.label.releaseDate=Date
report.changes.label.releaseDescription=Description
report.changes.label.releasehistory=Release History
report.changes.text.no.changes=No changes in this release.
-report.changes.text.rssfeed=Get the RSS feed of the last changes
+report.changes.text.rssfeed=Get the RSS feed of the last changes:
+report.changes.text.rssfeed.description=These are the latest changes of the project.
report.changes.text.thanx=Thanks to
report.changes.text.fixes=Fixes
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_de.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_de.properties?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_de.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_de.properties Tue Dec 18 09:03:16 2012
@@ -15,19 +15,19 @@
# specific language governing permissions and limitations
# under the License.
-report.issues.name=Änderungsbericht
-report.issues.description=Bericht über die Änderungen zwischen den Projekt-Releases.
-report.issues.header=Änderungsbericht
+report.issues.name=\u00c4nderungsbericht
+report.issues.description=Bericht \u00fcber die \u00c4nderungen zwischen den Projekt-Releases.
+report.issues.header=\u00c4nderungsbericht
report.issues.label.assignee=Durch
report.issues.label.fixVersion=Version
-report.issues.label.summary=Änderungen
+report.issues.label.summary=\u00c4nderungen
report.issues.label.type=Typ
report.issues.label.updated=Datum
report.changes.label.release=Release
report.changes.label.releaseDate=Datum
report.changes.label.releaseDescription=Beschreibung
report.changes.label.releasehistory=Release-Geschichte
-report.changes.text.no.changes=Keine Änderungen für dieses Release.
-report.changes.text.rssfeed=RSS-Feed der letzten Änderungen
+report.changes.text.no.changes=Keine \u00c4nderungen f\u00fcr dieses Release.
+report.changes.text.rssfeed=RSS-Feed der letzten \u00c4nderungen:
report.changes.text.thanx=Dank gilt
-report.changes.text.fixes=Schließt
+report.changes.text.fixes=Schlie\u00dft
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_fr.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_fr.properties?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_fr.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_fr.properties Tue Dec 18 09:03:16 2012
@@ -16,7 +16,7 @@
# under the License.
report.issues.name=Rapport des changements
-report.issues.description=Rapport des changements dans les versions publi\u00E9es du projet.
+report.issues.description=Rapport des changements dans les versions publi\u00e9es du projet.
report.issues.header=Rapport des changements
report.issues.label.assignee=Par
report.issues.label.fixVersion=Version
@@ -26,8 +26,8 @@ report.issues.label.updated=Date
report.changes.label.release=Release
report.changes.label.releaseDate=Date
report.changes.label.releaseDescription=Description
-report.changes.label.releasehistory=Historique des versions publi\u00E9es
-report.changes.text.rssfeed=Obtenir le flux RSS des derniers changements
-report.changes.text.thanx=Gr\u00E2ce \u00E2
+report.changes.label.releasehistory=Historique des versions publi\u00e9es
+report.changes.text.rssfeed=Obtenir le flux RSS des derniers changements:
+report.changes.text.thanx=Gr\u00e2ce \u00e2
report.changes.text.fixes=Corrige
report.changes.text.no.changes=Pas de changement dans cette version
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_pt_BR.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_pt_BR.properties?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_pt_BR.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_pt_BR.properties Tue Dec 18 09:03:16 2012
@@ -28,6 +28,6 @@ report.changes.label.releaseDate=Data
report.changes.label.releaseDescription=Descri\u00e7\u00e3o
report.changes.label.releasehistory=Hist\u00f3rico de Lan\u00e7amentos
report.changes.text.no.changes=Sem mudan\u00e7as nesta vers\u00e3o.
-report.changes.text.rssfeed=Obtenha via RSS as \u00faltimas mudan\u00e7as
+report.changes.text.rssfeed=Obtenha via RSS as \u00faltimas mudan\u00e7as:
report.changes.text.thanx=Agradecimentos a
report.changes.text.fixes=Corre\u00e7\u00f5es
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_sv.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_sv.properties?rev=1423355&r1=1423354&r2=1423355&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_sv.properties (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/resources/changes-report_sv.properties Tue Dec 18 09:03:16 2012
@@ -28,6 +28,6 @@ report.changes.label.releaseDate=Datum
report.changes.label.releaseDescription=Beskrivning
report.changes.label.releasehistory=Releasehistorik
report.changes.text.no.changes=Inga \u00e4ndringar i denna release.
-report.changes.text.rssfeed=H\u00e4mta RSS fl\u00f6det f\u00f6r de senaste \u00e4ndringarna
+report.changes.text.rssfeed=H\u00e4mta RSS fl\u00f6det f\u00f6r de senaste \u00e4ndringarna:
report.changes.text.thanx=Tack till
report.changes.text.fixes=Fixar
Added: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/FeedGeneratorTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/FeedGeneratorTest.java?rev=1423355&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/FeedGeneratorTest.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/FeedGeneratorTest.java Tue Dec 18 09:03:16 2012
@@ -0,0 +1,105 @@
+package org.apache.maven.plugin.changes;
+
+/*
+ * 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.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import junit.framework.TestCase;
+
+import org.apache.maven.plugins.changes.model.Release;
+
+/**
+ *
+ * @author ltheussl
+ */
+public class FeedGeneratorTest
+ extends TestCase
+{
+ /**
+ * Test of isSupportedFeedType method, of class FeedGenerator.
+ */
+ public void testIsSupportedFeedType()
+ {
+ final FeedGenerator generator = new FeedGenerator( Locale.ENGLISH );
+
+ assertTrue( "rss_0.9 not supported?", generator.isSupportedFeedType( "rss_0.9" ) );
+ assertTrue( "rss_0.91N not supported?", generator.isSupportedFeedType( "rss_0.91N" ) );
+ assertTrue( "rss_0.91U not supported?", generator.isSupportedFeedType( "rss_0.91U" ) );
+ assertTrue( "rss_0.92 not supported?", generator.isSupportedFeedType( "rss_0.92" ) );
+ assertTrue( "rss_0.93 not supported?", generator.isSupportedFeedType( "rss_0.93" ) );
+ assertTrue( "rss_0.94 not supported?", generator.isSupportedFeedType( "rss_0.94" ) );
+ assertTrue( "rss_1.0 not supported?", generator.isSupportedFeedType( "rss_1.0" ) );
+ assertTrue( "rss_2.0 not supported?", generator.isSupportedFeedType( "rss_2.0" ) );
+ assertTrue( "atom_0.3 not supported?", generator.isSupportedFeedType( "atom_0.3" ) );
+ assertTrue( "atom_1.0 not supported?", generator.isSupportedFeedType( "atom_1.0" ) );
+
+ assertFalse( generator.isSupportedFeedType( "" ) );
+ assertFalse( generator.isSupportedFeedType( null ) );
+ assertFalse( generator.isSupportedFeedType( "rss" ) );
+ }
+
+ /**
+ * Test of export method, of class FeedGenerator.
+ *
+ * @throws Exception if any.
+ */
+ public void testExport()
+ throws Exception
+ {
+ final FeedGenerator generator = new FeedGenerator( Locale.ENGLISH );
+ generator.setAuthor( "author" );
+ generator.setTitle( "title" );
+ generator.setLink( "url" );
+ generator.setDateFormat( null );
+
+ Release release = new Release();
+ release.setVersion( "1.0" );
+ List<Release> releases = new ArrayList<Release>( 1 );
+
+ try
+ {
+ // test with no release: should fail
+ generator.export( releases, "rss_0.9", new StringWriter( 512 ) );
+ fail( "0 releases not allowed!" );
+ }
+ catch ( IOException ex )
+ {
+ assertNotNull( ex );
+ }
+
+ releases.add( release );
+
+ for ( String type: generator.getSupportedFeedTypes() )
+ {
+ Writer writer = new StringWriter( 512 );
+ generator.export( releases, type, writer );
+ String result = writer.toString(); // TODO: save for inspection?
+ assertNotNull( result );
+ assertTrue( result.length() > 0 );
+ writer.close();
+ }
+ }
+}
Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/FeedGeneratorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/FeedGeneratorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision