Author: aheritier Date: Mon Jul 31 15:07:52 2006 New Revision: 427322 URL: http://svn.apache.org/viewvc?rev=427322&view=rev Log: Three-letter time zone IDs are deprecated since jdk 1.2. On my windows XP SP2 (Fr) with a JDK 1.4.2_12, there's a problem with the daylight setting which isn't used. The same code worked with a JDK 5.0
Modified: maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java Modified: maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java?rev=427322&r1=427321&r2=427322&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java (original) +++ maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java Mon Jul 31 15:07:52 2006 @@ -18,103 +18,106 @@ */ import java.io.FileInputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.List; import java.util.Locale; -import java.util.ArrayList; -import java.text.SimpleDateFormat; +import java.util.TimeZone; + import junit.framework.TestCase; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.maven.changelog.ChangeLogEntry; /** * Test cases for [EMAIL PROTECTED] SvnChangeLogParser}. - * + * * @author <a href="mailto:[EMAIL PROTECTED]">Pete Kazmier</a> - * @version $Id$ + * @version $Id: SvnChangeLogParserTest.java 293395 2005-10-03 17:14:54Z + * ltheussl $ */ -public class SvnChangeLogParserTest extends TestCase -{ - /** Date formatter */ - private static final SimpleDateFormat DATE = - new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US); - - /** The [EMAIL PROTECTED] SvnChangeLogParser} used for testing */ - private SvnChangeLogParser parser; - - /** 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 SvnChangeLogParserTest(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/svnlib/svnlog.txt"; - parser = new SvnChangeLogParser(); - } - - /** - * Test the subversion parser. - * - * @throws Exception when there is an unexpected problem - */ - public void testParse() throws Exception - { - FileInputStream fis = new FileInputStream(testFile); - List entries = new ArrayList(parser.parse(fis)); - - assertEquals("Wrong number of entries returned", 14, entries.size()); - - ChangeLogEntry entry = (ChangeLogEntry) entries.get(0); - assertEquals("Entry 0 was parsed incorrectly", - "kaz\n" + - DATE.parse("Mon Aug 26 20:33:26 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 16, " + - "/poolserver/trunk/project.properties, 16]\n" + - "Minor formatting changes.\n\n", - entry.toString()); - /* check author with space was parsed correctly */ - entry = (ChangeLogEntry) entries.get(1); - assertEquals("Entry 0 was parsed incorrectly", - "kaz toto",entry.getAuthor()); - - entry = (ChangeLogEntry) entries.get(7); - assertEquals("Entry 6 was parsed incorrectly", - "(no author)\n" + - DATE.parse("Fri Aug 23 11:11:52 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 9]\n" + - "Testing script out again ...\n\n", - entry.toString()); - - entry = (ChangeLogEntry) entries.get(9); - assertEquals("Entry 8 was parsed incorrectly", - "pete\n" + - DATE.parse("Fri Aug 23 11:03:39 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 7]\n" + - "Reformatted the indentation (really just an excuse to test out\n" + - "subversion).\n\n", - entry.toString()); - - entry = (ChangeLogEntry) entries.get(13); - assertEquals("Entry 12 was parsed incorrectly", - "DOMAIN\\user\n" + - DATE.parse("Wed Aug 21 00:20:25 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 1]\n" + - "Cleaned up some whitespace.\n\n", - entry.toString()); - } +public class SvnChangeLogParserTest extends TestCase { + + private static final Log LOGGER = LogFactory + .getLog(SvnChangeLogParserTest.class); + + /** Date formatter */ + private static final SimpleDateFormat DATE = new SimpleDateFormat( + "EEE MMM dd HH:mm:ss z yyyy", Locale.US); + + /** The [EMAIL PROTECTED] SvnChangeLogParser} used for testing */ + private SvnChangeLogParser parser; + + /** 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 SvnChangeLogParserTest(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/svnlib/svnlog.txt"; + parser = new SvnChangeLogParser(); + } + + /** + * Test the subversion parser. + * + * @throws Exception + * when there is an unexpected problem + */ + public void testParse() throws Exception { + FileInputStream fis = new FileInputStream(testFile); + List entries = new ArrayList(parser.parse(fis)); + + assertEquals("Wrong number of entries returned", 14, entries.size()); + + ChangeLogEntry entry = (ChangeLogEntry) entries.get(0); + assertEquals("Entry 0 was parsed incorrectly", "kaz\n" + + DATE.parse("Mon Aug 26 20:33:26 -0400 2002") + "\n" + + "[/poolserver/trunk/build.xml, 16, " + + "/poolserver/trunk/project.properties, 16]\n" + + "Minor formatting changes.\n\n", entry.toString()); + /* check author with space was parsed correctly */ + entry = (ChangeLogEntry) entries.get(1); + assertEquals("Entry 0 was parsed incorrectly", "kaz toto", entry + .getAuthor()); + + entry = (ChangeLogEntry) entries.get(7); + assertEquals("Entry 6 was parsed incorrectly", "(no author)\n" + + DATE.parse("Fri Aug 23 11:11:52 -0400 2002") + "\n" + + "[/poolserver/trunk/build.xml, 9]\n" + + "Testing script out again ...\n\n", entry.toString()); + + entry = (ChangeLogEntry) entries.get(9); + assertEquals( + "Entry 8 was parsed incorrectly", + "pete\n" + + DATE.parse("Fri Aug 23 11:03:39 -0400 2002") + + "\n" + + "[/poolserver/trunk/build.xml, 7]\n" + + "Reformatted the indentation (really just an excuse to test out\n" + + "subversion).\n\n", entry.toString()); + + entry = (ChangeLogEntry) entries.get(13); + assertEquals("Entry 12 was parsed incorrectly", "DOMAIN\\user\n" + + DATE.parse("Wed Aug 21 00:20:25 -0400 2002") + "\n" + + "[/poolserver/trunk/build.xml, 1]\n" + + "Cleaned up some whitespace.\n\n", entry.toString()); + } }