Add the possibility to specify a date format for input stream (Starteam only).

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115700 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
evenisse committed 2004-07-08 08:36:51 +00:00
1 parent e9b3b696a0
commit b42c79d878
13 files changed
+228 -13

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@
<pomVersion>3</pomVersion>
<id>maven-changelog-plugin</id>
<name>Maven Changelog Plugin</name>
<currentVersion>1.6</currentVersion>
<currentVersion>1.7-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Produce SCM changelog reports</shortDescription>
<url>http://maven.apache.org/reference/plugins/changelog/</url>
@@ -48,7 +48,7 @@ import org.apache.maven.project.Developer;
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @author <a href="mailto:bodewig@apache.org">Stefan Bodewig</a>
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
* @version $Id: ChangeLog.java,v 1.5 2004/03/02 15:00:17 evenisse Exp $
* @version $Id: ChangeLog.java,v 1.6 2004/07/08 08:36:51 evenisse Exp $
*/
public class ChangeLog
{
@@ -226,6 +226,10 @@ public class ChangeLog
ChangeLogFactory factory = createFactory();
ChangeLogGenerator generator = factory.createGenerator();
ChangeLogParser parser = factory.createParser();
if (getDateFormat() != null)
{
parser.setDateFormatInFile(getDateFormat());
}
generator.init(this);
parser.init(this);
@@ -27,7 +27,7 @@ import java.util.Collection;
* {@link ChangeLogEntry} objects.
*
* @author Glenn McAllister
* @version $Id: ChangeLogParser.java,v 1.2 2004/03/02 15:00:17 evenisse Exp $
* @version $Id: ChangeLogParser.java,v 1.3 2004/07/08 08:36:51 evenisse Exp $
*/
public interface ChangeLogParser
{
@@ -60,4 +60,10 @@ public interface ChangeLogParser
* presumably the {@link #parse}) method.
*/
void cleanup();
/**
* Set the date formatter for parse starteam stream
* @param dateFormat a dateFormat for replace the local format
*/
public void setDateFormatInFile( String dateFormat );
}
@@ -317,5 +317,7 @@ public class ClearcaseChangeLogParser implements ChangeLogParser {
this.status = status;
}
public void setDateFormatInFile( String dateFormat )
{
}
}
@@ -37,7 +37,7 @@ import org.apache.maven.changelog.ChangeLogFile;
* A class to parse cvs log output
*
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @version $Id: CvsChangeLogParser.java,v 1.2 2004/03/02 15:00:18 evenisse Exp $
* @version $Id: CvsChangeLogParser.java,v 1.3 2004/07/08 08:36:51 evenisse Exp $
*/
class CvsChangeLogParser implements ChangeLogParser
{
@@ -319,4 +319,8 @@ class CvsChangeLogParser implements ChangeLogParser
{
this.status = status;
}
public void setDateFormatInFile( String dateFormat )
{
}
}
@@ -262,4 +262,8 @@ class PerforceChangeLogParser implements ChangeLogParser
int days = Integer.parseInt(this.changeLog.getRange());
beforeDate = new Date(System.currentTimeMillis() - (long) days * 24 * 60 * 60 * 1000);
}
public void setDateFormatInFile( String dateFormat )
{
}
}
@@ -41,7 +41,7 @@ import org.apache.commons.logging.LogFactory;
* A class to parse starteam log output
*
* @author <a href="mailto:evenisse@ifrance">Emmanuel Venisse</a>
* @version $Id: StarteamChangeLogParser.java,v 1.4 2004/03/02 15:00:18 evenisse Exp $
* @version $Id: StarteamChangeLogParser.java,v 1.5 2004/07/08 08:36:51 evenisse Exp $
*/
class StarteamChangeLogParser implements ChangeLogParser
{
@@ -141,14 +141,20 @@ class StarteamChangeLogParser implements ChangeLogParser
}
/**
* Set the date formatter for parse starteam stream
* Use only with StarteamChangeLogParserTest class
*/
public void setTestMode( boolean testMode )
{
this.testMode = testMode;
}
/**
* Set the date formatter for parse starteam stream
* @param aSimpleDateFormat a simpleDateFormat for replace the local format
*/
public void setDateFormatInFile(SimpleDateFormat aSimpleDateFormat)
public void setDateFormatInFile( String dateFormat )
{
localFormat = aSimpleDateFormat;
testMode = true;
localFormat = new SimpleDateFormat( dateFormat );
}
/**
@@ -44,7 +44,7 @@ import org.apache.regexp.RESyntaxException;
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
* @author Daniel Rall
* @version $Id: SvnChangeLogParser.java,v 1.5 2004/05/10 02:00:25 dion Exp $
* @version $Id: SvnChangeLogParser.java,v 1.6 2004/07/08 08:36:51 evenisse Exp $
*/
class SvnChangeLogParser implements ChangeLogParser
{
@@ -279,4 +279,8 @@ class SvnChangeLogParser implements ChangeLogParser
return null;
}
}
public void setDateFormatInFile( String dateFormat )
{
}
}
@@ -0,0 +1,91 @@
Folder: Maven (working dir: D:\Artin\projects\Artin\timemission_maven)
History for: project.properties
Description:
Locked by:
Status: Current
----------------------------
Revision: 2 View: Playground Branch Revision: 1.1
Author: Najvarek, Jan Date: 04-6-30 15:12:02 GMT+02:00
test revision
----------------------------
Revision: 1 View: Playground Branch Revision: 1.0
Author: Najvarek, Jan Date: 04-6-30 15:11:36 GMT+02:00
=============================================================================
Folder: lib (working dir: D:\Artin\projects\Artin\timemission_maven\lib)
Folder: interclient (working dir: D:\Artin\projects\Artin\timemission_maven\lib\interclient)
Folder: jars (working dir: D:\Artin\projects\Artin\timemission_maven\lib\interclient\jars)
History for: interclient.jar
Description:
Locked by:
Status: Current
----------------------------
Revision: 1 View: Playground Branch Revision: 1.0
Author: Najvarek, Jan Date: 04-6-28 9:57:29 GMT+02:00
=============================================================================
Folder: j2ee (working dir: D:\Artin\projects\Artin\timemission_maven\lib\j2ee)
Folder: jars (working dir: D:\Artin\projects\Artin\timemission_maven\lib\j2ee\jars)
Folder: jfreechart (working dir: D:\Artin\projects\Artin\timemission_maven\lib\jfreechart)
Folder: jars (working dir: D:\Artin\projects\Artin\timemission_maven\lib\jfreechart\jars)
Folder: mail (working dir: D:\Artin\projects\Artin\timemission_maven\lib\mail)
Folder: jars (working dir: D:\Artin\projects\Artin\timemission_maven\lib\mail\jars)
Folder: src (working dir: D:\Artin\projects\Artin\timemission_maven\src)
Folder: conf (working dir: D:\Artin\projects\Artin\timemission_maven\src\conf)
Folder: java (working dir: D:\Artin\projects\Artin\timemission_maven\src\java)
Folder: cz (working dir: D:\Artin\projects\Artin\timemission_maven\src\java\cz)
Folder: artin (working dir: D:\Artin\projects\Artin\timemission_maven\src\java\cz\artin)
Folder: timemission (working dir: D:\Artin\projects\Artin\timemission_maven\src\java\cz\artin\timemission)
History for: AssignedProject.java
Description:
Locked by:
Status: Current
----------------------------
Revision: 1 View: Playground Branch Revision: 1.0
Author: Najvarek, Jan Date: 04-6-28 9:57:38 GMT+02:00
=============================================================================
History for: AssignedProjectViewDef.java
Description:
Locked by:
Status: Current
----------------------------
Revision: 1 View: Playground Branch Revision: 1.0
Author: Najvarek, Jan Date: 04-6-28 9:57:48 GMT+02:00
=============================================================================
History for: Base32.java
Description:
Locked by:
Status: Current
----------------------------
Revision: 1 View: Playground Branch Revision: 1.0
Author: Najvarek, Jan Date: 04-6-28 9:57:52 GMT+02:00
=============================================================================
Folder: test (working dir: D:\Artin\projects\Artin\timemission_maven\src\test)
Folder: cz (working dir: D:\Artin\projects\Artin\timemission_maven\src\test\cz)
Folder: artin (working dir: D:\Artin\projects\Artin\timemission_maven\src\test\cz\artin)
Folder: timemission (working dir: D:\Artin\projects\Artin\timemission_maven\src\test\cz\artin\timemission)
Folder: webapp (working dir: D:\Artin\projects\Artin\timemission_maven\src\webapp)
Folder: jsp (working dir: D:\Artin\projects\Artin\timemission_maven\src\webapp\jsp)
Folder: target (working dir: D:\Artin\projects\Artin\timemission_maven\target)
Folder: classes (working dir: D:\Artin\projects\Artin\timemission_maven\target\classes)
Folder: cz (working dir: D:\Artin\projects\Artin\timemission_maven\target\classes\cz)
Folder: artin (working dir: D:\Artin\projects\Artin\timemission_maven\target\classes\cz\artin)
Folder: timemission (working dir: D:\Artin\projects\Artin\timemission_maven\target\classes\cz\artin\timemission)
Folder: test-classes (working dir: D:\Artin\projects\Artin\timemission_maven\target\test-classes)
Folder: cz (working dir: D:\Artin\projects\Artin\timemission_maven\target\test-classes\cz)
Folder: artin (working dir: D:\Artin\projects\Artin\timemission_maven\target\test-classes\cz\artin)
Folder: timemission (working dir: D:\Artin\projects\Artin\timemission_maven\target\test-classes\cz\artin\timemission)
Folder: test-reports (working dir: D:\Artin\projects\Artin\timemission_maven\target\test-reports)
Folder: tm (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm)
Folder: jsp (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\jsp)
Folder: WEB-INF (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\WEB-INF)
Folder: classes (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\WEB-INF\classes)
Folder: cz (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\WEB-INF\classes\cz)
Folder: artin (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\WEB-INF\classes\cz\artin)
Folder: timemission (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\WEB-INF\classes\cz\artin\timemission)
Folder: lib (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\WEB-INF\lib)
Folder: tld (working dir: D:\Artin\projects\Artin\timemission_maven\target\tm\WEB-INF\tld)
@@ -0,0 +1,84 @@
package org.apache.maven.starteamlib;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
import junit.framework.TestCase;
import org.apache.maven.changelog.ChangeLogEntry;
/**
* Test cases for {@link StarteamChangeLogParser}
* @author <a href="mailto:evenisse@ifrance.com">Emmanuel Venisse</a>
* @version $Id: StarteamChangeLogParser2Test.java,v 1.1 2004/07/08 08:36:51 evenisse Exp $
*/
public class StarteamChangeLogParser2Test extends TestCase
{
/** the {@link StarteamChangeLogParser} used for testing */
private StarteamChangeLogParser instance;
/** file with test results to check against */
private String testFile;
/**
* Create a test with the given name
* @param testName the name of the test
*/
public StarteamChangeLogParser2Test(String testName)
{
super(testName);
}
/**
* Initialize per test data
* @throws Exception when there is an unexpected problem
*/
public void setUp() throws Exception
{
String baseDir = System.getProperty("basedir");
assertNotNull("The system property basedir was not defined.", baseDir);
testFile = baseDir + "/src/test-resources/starteamlib/starteamlog2.txt";
instance = new StarteamChangeLogParser();
}
/**
* Test of parse method
* @throws Exception when there is an unexpected problem
*/
public void testParse() throws Exception
{
FileInputStream fis = new FileInputStream(testFile);
instance.setDateFormatInFile("yy-MM-dd HH:mm");
Collection entries = instance.parse(fis);
assertEquals("Wrong number of entries returned", 3, entries.size());
ChangeLogEntry entry = null;
for (Iterator i = entries.iterator(); i.hasNext(); )
{
entry = (ChangeLogEntry) i.next();
assertTrue("ChangeLogEntry erroneously picked up",
entry.toString().indexOf("ChangeLogEntry.java") == -1);
}
}
}
@@ -30,7 +30,7 @@ import org.apache.maven.changelog.ChangeLogEntry;
/**
* Test cases for {@link StarteamChangeLogParser}
* @author <a href="mailto:evenisse@ifrance.com">Emmanuel Venisse</a>
* @version $Id: StarteamChangeLogParserTest.java,v 1.2 2004/03/02 15:00:19 evenisse Exp $
* @version $Id: StarteamChangeLogParserTest.java,v 1.3 2004/07/08 08:36:51 evenisse Exp $
*/
public class StarteamChangeLogParserTest extends TestCase
{
@@ -68,7 +68,7 @@ public class StarteamChangeLogParserTest extends TestCase
public void testParse() throws Exception
{
FileInputStream fis = new FileInputStream(testFile);
instance.setDateFormatInFile(new SimpleDateFormat("dd/MM/yy HH:mm", Locale.FRENCH));
instance.setDateFormatInFile("dd/MM/yy HH:mm");
Collection entries = instance.parse(fis);
assertEquals("Wrong number of entries returned", 3, entries.size());
ChangeLogEntry entry = null;
+3
View File
@@ -25,6 +25,9 @@
<author email="evenisse@ifrance.com">Emmanuel Venisse</author>
</properties>
<body>
<release version="1.7" date="In CVS">
<action dev="evenisse" type="fix">Add the possibility to specify a date format for input stream (Starteam only).</action>
</release>
<release version="1.6" date="2004-06-25">
<action dev="brett" type="fix" issue="MPCHANGELOG-34" due-to="Rafael Santiago, Jr.">Prevent any NPE depending on certain repository definition conditions</action>
<action dev="brett" type="fix">Build and run plugin against the installed version of Maven</action>
+7
View File
@@ -83,6 +83,13 @@
the xdoc plugin, it defaults to <code>ISO-8859-1</code>
</td>
</tr>
<tr>
<td>maven.changelog.dateformat</td>
<td>Yes</td>
<td>
The date format in input stream. It's only used by Starteam changelog.
</td>
</tr>
</table>
</section>
<section name="Other properties">