001package org.apache.maven.scm.provider.jazz.command.changelog;
002
003import org.apache.maven.scm.ChangeFile;
004import org.apache.maven.scm.ChangeSet;
005import org.apache.maven.scm.ScmFileStatus;
006import org.apache.maven.scm.log.DefaultLog;
007import org.apache.maven.scm.provider.jazz.JazzScmTestCase;
008import org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository;
009import org.codehaus.plexus.util.cli.Commandline;
010
011import java.util.ArrayList;
012import java.util.Calendar;
013import java.util.List;
014
015/*
016 * Licensed to the Apache Software Foundation (ASF) under one
017 * or more contributor license agreements.  See the NOTICE file
018 * distributed with this work for additional information
019 * regarding copyright ownership.  The ASF licenses this file
020 * to you under the Apache License, Version 2.0 (the
021 * "License"); you may not use this file except in compliance
022 * with the License.  You may obtain a copy of the License at
023 *
024 * http://www.apache.org/licenses/LICENSE-2.0
025 *
026 * Unless required by applicable law or agreed to in writing,
027 * software distributed under the License is distributed on an
028 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
029 * KIND, either express or implied.  See the License for the
030 * specific language governing permissions and limitations
031 * under the License.
032 */
033
034/**
035 * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
036 */
037public class JazzChangeLogCommandTest
038    extends JazzScmTestCase
039{
040    private JazzScmProviderRepository repo;
041
042    List<ChangeSet> changeSets;
043
044    private JazzHistoryConsumer historyConsumer;
045
046    private JazzListChangesetConsumer listChangesetConsumer;
047
048    private static final String userDateFormat = "";
049
050    protected void setUp()
051        throws Exception
052    {
053        super.setUp();
054        repo = getScmProviderRepository();
055        changeSets = new ArrayList<ChangeSet>();
056        historyConsumer = new JazzHistoryConsumer( repo, new DefaultLog(), changeSets );
057        listChangesetConsumer = new JazzListChangesetConsumer( repo, new DefaultLog(), changeSets, userDateFormat );
058
059        // Simulate the output of the parsing of the "scm status" command.
060        // IE, fill in the workspace details
061        // Needed for the workspace for the list changesets command.
062        repo.setWorkspace( "Dave's Repository Workspace" );
063    }
064
065    public void testCreateHistoryCommand()
066        throws Exception
067    {
068        Commandline cmd = new JazzChangeLogCommand().createHistoryCommand( repo, getScmFileSet() ).getCommandline();
069        String expected =
070            "scm history --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword --maximum 10000000";
071        assertCommandLine( expected, getWorkingDirectory(), cmd );
072    }
073
074    public void testCreateListChangesetCommand()
075        throws Exception
076    {
077        // Dummy up two change sets.
078        ChangeSet changeSet = new ChangeSet();
079        changeSet.setRevision( "1010" );
080        changeSets.add( changeSet );
081        changeSet = new ChangeSet();
082        changeSet.setRevision( "1012" );
083        changeSets.add( changeSet );
084
085        // Now test them
086        Commandline cmd =
087            new JazzChangeLogCommand().createListChangesetCommand( repo, getScmFileSet(), changeSets ).getCommandline();
088        String expected =
089            "scm list changesets --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword --workspace \"Dave's Repository Workspace\" 1010 1012";
090        assertCommandLine( expected, getWorkingDirectory(), cmd );
091    }
092
093    public void testHistoryConsumer()
094        throws Exception
095    {
096        historyConsumer.consumeLine( "Change sets:" );
097        historyConsumer.consumeLine(
098            "  (1589)  ---$ Deb \"[maven-release-plugin] prepare for next development itera...\"" );
099        historyConsumer.consumeLine( "  (1585)  ---$ Deb \"[maven-release-plugin] prepare release GPDB-1.0.21\"" );
100        historyConsumer.consumeLine( "  (1584)  ---$ Deb \"This is my first changeset (2)\"" );
101        historyConsumer.consumeLine( "  (1583)  ---$ Deb \"This is my first changeset (1)\"" );
102        historyConsumer.consumeLine( "  (1323)  ---$ Deb <No comment>" );
103        historyConsumer.consumeLine( "  (1319)  ---$ Deb <No comment>" );
104
105        assertEquals( "Wrong number of change sets parsed!", 6, changeSets.size() );
106        // The order needs to be preserved.
107        assertEquals( "Parsing sequence error (1)", "1589", changeSets.get( 0 ).getRevision() );
108        assertEquals( "Parsing sequence error (2)", "1585", changeSets.get( 1 ).getRevision() );
109        assertEquals( "Parsing sequence error (3)", "1584", changeSets.get( 2 ).getRevision() );
110        assertEquals( "Parsing sequence error (4)", "1583", changeSets.get( 3 ).getRevision() );
111        assertEquals( "Parsing sequence error (5)", "1323", changeSets.get( 4 ).getRevision() );
112        assertEquals( "Parsing sequence error (6)", "1319", changeSets.get( 5 ).getRevision() );
113    }
114
115    public void testListChangesetConsumer()
116        throws Exception
117    {
118        // Dummy up our changeset list, as parsed from the previous "scm history" command
119        ChangeSet changeSet = new ChangeSet();
120        changeSet.setRevision( "1589" );
121        changeSets.add( changeSet );
122        changeSet = new ChangeSet();
123        changeSet.setRevision( "1585" );
124        changeSets.add( changeSet );
125        changeSet = new ChangeSet();
126        changeSet.setRevision( "1584" );
127        changeSets.add( changeSet );
128        changeSet = new ChangeSet();
129        changeSet.setRevision( "1583" );
130        changeSets.add( changeSet );
131        changeSet = new ChangeSet();
132        changeSet.setRevision( "1323" );
133        changeSets.add( changeSet );
134        changeSet = new ChangeSet();
135        changeSet.setRevision( "1319" );
136        changeSets.add( changeSet );
137
138        listChangesetConsumer.consumeLine( "Change sets:" );
139        listChangesetConsumer.consumeLine(
140            "  (1589)  ---$ Deb \"[maven-release-plugin] prepare for next development iteration\"" );
141        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
142        listChangesetConsumer.consumeLine( "    Modified: Feb 25, 2012 10:15 PM (Yesterday)" );
143        listChangesetConsumer.consumeLine( "    Changes:" );
144        listChangesetConsumer.consumeLine( "      ---c- (1170) \\GPDB\\GPDBEAR\\pom.xml" );
145        listChangesetConsumer.consumeLine( "      ---c- (1171) \\GPDB\\GPDBResources\\pom.xml" );
146        listChangesetConsumer.consumeLine( "      ---c- (1167) \\GPDB\\GPDBWeb\\pom.xml" );
147        listChangesetConsumer.consumeLine( "      ---c- (1165) \\GPDB\\pom.xml" );
148        listChangesetConsumer.consumeLine(
149            "  (1585)  ---$ Deb \"[maven-release-plugin] prepare release GPDB-1.0.21\"" );
150        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
151        listChangesetConsumer.consumeLine( "    Modified: Feb 25, 2012 10:13 PM (Yesterday)" );
152        listChangesetConsumer.consumeLine( "    Changes:" );
153        listChangesetConsumer.consumeLine( "      ---c- (1170) \\GPDB\\GPDBEAR\\pom.xml" );
154        listChangesetConsumer.consumeLine( "      ---c- (1171) \\GPDB\\GPDBResources\\pom.xml" );
155        listChangesetConsumer.consumeLine( "      ---c- (1167) \\GPDB\\GPDBWeb\\pom.xml" );
156        listChangesetConsumer.consumeLine( "      ---c- (1165) \\GPDB\\pom.xml" );
157        listChangesetConsumer.consumeLine( "  (1584)  ---$ Deb \"This is my first changeset (2)\"" );
158        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
159        listChangesetConsumer.consumeLine( "    Modified: Feb 25, 2012 10:13 PM (Yesterday)" );
160        listChangesetConsumer.consumeLine( "  (1583)  ---$ Deb \"This is my first changeset (1)\"" );
161        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
162        listChangesetConsumer.consumeLine( "    Modified: Feb 25, 2012 10:13 PM (Yesterday)" );
163        listChangesetConsumer.consumeLine( "  (1323)  ---$ Deb <No comment>" );
164        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
165        listChangesetConsumer.consumeLine( "    Modified: Feb 24, 2012 11:04 PM (Last Week)" );
166        listChangesetConsumer.consumeLine( "    Changes:" );
167        listChangesetConsumer.consumeLine( "      ---c- (1170) \\GPDB\\GPDBEAR\\pom.xml" );
168        listChangesetConsumer.consumeLine( "      ---c- (1171) \\GPDB\\GPDBResources\\pom.xml" );
169        listChangesetConsumer.consumeLine( "      ---c- (1167) \\GPDB\\GPDBWeb\\pom.xml" );
170        listChangesetConsumer.consumeLine( "      ---c- (1165) \\GPDB\\pom.xml" );
171        listChangesetConsumer.consumeLine( "  (1319)  ---$ Deb <No comment>" );
172        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
173        listChangesetConsumer.consumeLine( "    Modified: Feb 24, 2012 11:03 PM (Last Week)" );
174        listChangesetConsumer.consumeLine( "    Changes:" );
175        listChangesetConsumer.consumeLine( "      ---c- (1170) \\GPDB\\GPDBEAR\\pom.xml" );
176        listChangesetConsumer.consumeLine( "      ---c- (1171) \\GPDB\\GPDBResources\\pom.xml" );
177        listChangesetConsumer.consumeLine( "      ---c- (1167) \\GPDB\\GPDBWeb\\pom.xml" );
178        listChangesetConsumer.consumeLine( "      ---c- (1165) \\GPDB\\pom.xml" );
179
180        assertEquals( "Wrong number of change sets parsed!", 6, changeSets.size() );
181        // The order needs to be preserved.
182        // Check revisions
183        assertEquals( "Parsing sequence error (1)", "1589", changeSets.get( 0 ).getRevision() );
184        assertEquals( "Parsing sequence error (2)", "1585", changeSets.get( 1 ).getRevision() );
185        assertEquals( "Parsing sequence error (3)", "1584", changeSets.get( 2 ).getRevision() );
186        assertEquals( "Parsing sequence error (4)", "1583", changeSets.get( 3 ).getRevision() );
187        assertEquals( "Parsing sequence error (5)", "1323", changeSets.get( 4 ).getRevision() );
188        assertEquals( "Parsing sequence error (6)", "1319", changeSets.get( 5 ).getRevision() );
189        // Check Author
190        assertEquals( "Parsing error - Author (1)", "Deb", changeSets.get( 0 ).getAuthor() );
191        assertEquals( "Parsing error - Author (2)", "Deb", changeSets.get( 1 ).getAuthor() );
192        assertEquals( "Parsing error - Author (3)", "Deb", changeSets.get( 2 ).getAuthor() );
193        assertEquals( "Parsing error - Author (4)", "Deb", changeSets.get( 3 ).getAuthor() );
194        assertEquals( "Parsing error - Author (5)", "Deb", changeSets.get( 4 ).getAuthor() );
195        assertEquals( "Parsing error - Author (6)", "Deb", changeSets.get( 5 ).getAuthor() );
196        // Check Comments
197        assertEquals( "Parsing error - Comment (1)", "[maven-release-plugin] prepare for next development iteration",
198                      changeSets.get( 0 ).getComment() );
199        assertEquals( "Parsing error - Comment (2)", "[maven-release-plugin] prepare release GPDB-1.0.21",
200                      changeSets.get( 1 ).getComment() );
201        assertEquals( "Parsing error - Comment (3)", "This is my first changeset (2)",
202                      changeSets.get( 2 ).getComment() );
203        assertEquals( "Parsing error - Comment (4)", "This is my first changeset (1)",
204                      changeSets.get( 3 ).getComment() );
205        assertEquals( "Parsing error - Comment (5)", "No comment", changeSets.get( 4 ).getComment() );
206        assertEquals( "Parsing error - Comment (6)", "No comment", changeSets.get( 5 ).getComment() );
207        // Check Dates
208        assertEquals( "Parsing error - Date (1)", getDate( 2012, 01, 25, 22, 15, 0, null ),
209                      changeSets.get( 0 ).getDate() );
210        assertEquals( "Parsing error - Date (2)", getDate( 2012, 01, 25, 22, 13, 0, null ),
211                      changeSets.get( 1 ).getDate() );
212        assertEquals( "Parsing error - Date (3)", getDate( 2012, 01, 25, 22, 13, 0, null ),
213                      changeSets.get( 2 ).getDate() );
214        assertEquals( "Parsing error - Date (4)", getDate( 2012, 01, 25, 22, 13, 0, null ),
215                      changeSets.get( 3 ).getDate() );
216        assertEquals( "Parsing error - Date (5)", getDate( 2012, 01, 24, 23, 04, 0, null ),
217                      changeSets.get( 4 ).getDate() );
218        assertEquals( "Parsing error - Date (6)", getDate( 2012, 01, 24, 23, 03, 0, null ),
219                      changeSets.get( 5 ).getDate() );
220        // Check files
221        List<ChangeFile> files;
222        files = changeSets.get( 0 ).getFiles();
223        assertEquals( "Parsing error - Files (1)", 4, files.size() );
224        assertEquals( "Parsing error - Files (1) (1)", "\\GPDB\\GPDBEAR\\pom.xml", files.get( 0 ).getName() );
225        assertEquals( "Parsing error - Files (1) (2)", "\\GPDB\\GPDBResources\\pom.xml", files.get( 1 ).getName() );
226        assertEquals( "Parsing error - Files (1) (3)", "\\GPDB\\GPDBWeb\\pom.xml", files.get( 2 ).getName() );
227        assertEquals( "Parsing error - Files (1) (4)", "\\GPDB\\pom.xml", files.get( 3 ).getName() );
228        files = changeSets.get( 1 ).getFiles();
229        assertEquals( "Parsing error - Files (2)", 4, files.size() );
230        assertEquals( "Parsing error - Files (2) (1)", "\\GPDB\\GPDBEAR\\pom.xml", files.get( 0 ).getName() );
231        assertEquals( "Parsing error - Files (2) (2)", "\\GPDB\\GPDBResources\\pom.xml", files.get( 1 ).getName() );
232        assertEquals( "Parsing error - Files (2) (3)", "\\GPDB\\GPDBWeb\\pom.xml", files.get( 2 ).getName() );
233        assertEquals( "Parsing error - Files (2) (4)", "\\GPDB\\pom.xml", files.get( 3 ).getName() );
234        files = changeSets.get( 2 ).getFiles();
235        assertEquals( "Parsing error - Files (3)", 0, files.size() );   // Yes Virginia, an empty ChangeSet is valid
236        files = changeSets.get( 3 ).getFiles();
237        assertEquals( "Parsing error - Files (4)", 0, files.size() );   // Yes Virginia, an empty ChangeSet is valid
238        files = changeSets.get( 4 ).getFiles();
239        assertEquals( "Parsing error - Files (5)", 4, files.size() );
240        assertEquals( "Parsing error - Files (5) (1)", "\\GPDB\\GPDBEAR\\pom.xml", files.get( 0 ).getName() );
241        assertEquals( "Parsing error - Files (5) (2)", "\\GPDB\\GPDBResources\\pom.xml", files.get( 1 ).getName() );
242        assertEquals( "Parsing error - Files (5) (3)", "\\GPDB\\GPDBWeb\\pom.xml", files.get( 2 ).getName() );
243        assertEquals( "Parsing error - Files (5) (4)", "\\GPDB\\pom.xml", files.get( 3 ).getName() );
244        files = changeSets.get( 5 ).getFiles();
245        assertEquals( "Parsing error - Files (6)", 4, files.size() );
246        assertEquals( "Parsing error - Files (6) (1)", "\\GPDB\\GPDBEAR\\pom.xml", files.get( 0 ).getName() );
247        assertEquals( "Parsing error - Files (6) (2)", "\\GPDB\\GPDBResources\\pom.xml", files.get( 1 ).getName() );
248        assertEquals( "Parsing error - Files (6) (3)", "\\GPDB\\GPDBWeb\\pom.xml", files.get( 2 ).getName() );
249        assertEquals( "Parsing error - Files (6) (4)", "\\GPDB\\pom.xml", files.get( 3 ).getName() );
250        // Check file actions = ScmFileStatus
251        files = changeSets.get( 0 ).getFiles();
252        assertEquals( "Parsing error - File Status (1) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
253        assertEquals( "Parsing error - File Status (1) (2)", ScmFileStatus.MODIFIED, files.get( 1 ).getAction() );
254        assertEquals( "Parsing error - File Status (1) (3)", ScmFileStatus.MODIFIED, files.get( 2 ).getAction() );
255        assertEquals( "Parsing error - File Status (1) (4)", ScmFileStatus.MODIFIED, files.get( 3 ).getAction() );
256        files = changeSets.get( 1 ).getFiles();
257        assertEquals( "Parsing error - File Status (2) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
258        assertEquals( "Parsing error - File Status (2) (2)", ScmFileStatus.MODIFIED, files.get( 1 ).getAction() );
259        assertEquals( "Parsing error - File Status (2) (3)", ScmFileStatus.MODIFIED, files.get( 2 ).getAction() );
260        assertEquals( "Parsing error - File Status (2) (4)", ScmFileStatus.MODIFIED, files.get( 3 ).getAction() );
261        files = changeSets.get( 4 ).getFiles();
262        assertEquals( "Parsing error - File Status (5) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
263        assertEquals( "Parsing error - File Status (5) (2)", ScmFileStatus.MODIFIED, files.get( 1 ).getAction() );
264        assertEquals( "Parsing error - File Status (5) (3)", ScmFileStatus.MODIFIED, files.get( 2 ).getAction() );
265        assertEquals( "Parsing error - File Status (5) (4)", ScmFileStatus.MODIFIED, files.get( 3 ).getAction() );
266        files = changeSets.get( 5 ).getFiles();
267        assertEquals( "Parsing error - File Status (6) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
268        assertEquals( "Parsing error - File Status (6) (2)", ScmFileStatus.MODIFIED, files.get( 1 ).getAction() );
269        assertEquals( "Parsing error - File Status (6) (3)", ScmFileStatus.MODIFIED, files.get( 2 ).getAction() );
270        assertEquals( "Parsing error - File Status (6) (4)", ScmFileStatus.MODIFIED, files.get( 3 ).getAction() );
271    }
272
273    public void testListChangesetConsumerWithTimeOnly()
274        throws Exception
275    {
276        // Dummy up our changeset list, as parsed from the previous "scm history" command
277        ChangeSet changeSet = new ChangeSet();
278        changeSet.setRevision( "1809" );
279        changeSets.add( changeSet );
280        changeSet = new ChangeSet();
281        changeSet.setRevision( "1801" );
282        changeSets.add( changeSet );
283        changeSet = new ChangeSet();
284        changeSet.setRevision( "1799" );
285        changeSets.add( changeSet );
286        changeSet = new ChangeSet();
287        changeSet.setRevision( "1764" );
288        changeSets.add( changeSet );
289
290        listChangesetConsumer.consumeLine( "Change sets:" );
291        listChangesetConsumer.consumeLine(
292            "  (1809)  ---$ Deb \"[maven-release-plugin] prepare for next development iteration\"" );
293        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
294        listChangesetConsumer.consumeLine( "    Modified: 6:20 PM (5 minutes ago)" );
295        listChangesetConsumer.consumeLine( "    Changes:" );
296        listChangesetConsumer.consumeLine( "      ---c- (1170) \\GPDB\\GPDBEAR\\pom.xml" );
297        listChangesetConsumer.consumeLine( "      ---c- (1171) \\GPDB\\GPDBResources\\pom.xml" );
298        listChangesetConsumer.consumeLine( "      ---c- (1167) \\GPDB\\GPDBWeb\\pom.xml" );
299        listChangesetConsumer.consumeLine( "      ---c- (1165) \\GPDB\\pom.xml" );
300        listChangesetConsumer.consumeLine(
301            "  (1801)  ---$ Deb \"[maven-release-plugin] prepare release GPDB-1.0.26\"" );
302        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
303        listChangesetConsumer.consumeLine( "    Modified: 6:18 PM (10 minutes ago)" );
304        listChangesetConsumer.consumeLine( "    Changes:" );
305        listChangesetConsumer.consumeLine( "      ---c- (1170) \\GPDB\\GPDBEAR\\pom.xml" );
306        listChangesetConsumer.consumeLine( "      ---c- (1171) \\GPDB\\GPDBResources\\pom.xml" );
307        listChangesetConsumer.consumeLine( "      ---c- (1167) \\GPDB\\GPDBWeb\\pom.xml" );
308        listChangesetConsumer.consumeLine( "  (1799)  ---$ Deb <No comment>" );
309        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
310        listChangesetConsumer.consumeLine( "    Modified: 6:18 PM (10 minutes ago)" );
311        listChangesetConsumer.consumeLine( "    Changes:" );
312        listChangesetConsumer.consumeLine( "      ---c- (1165) \\GPDB\\pom.xml" );
313        listChangesetConsumer.consumeLine( "  (1764)  ---$ Deb <No comment>" );
314        listChangesetConsumer.consumeLine( "    Component: (1158) \"GPDB\"" );
315        listChangesetConsumer.consumeLine( "    Modified: Mar 1, 2012 2:34 PM" );
316        listChangesetConsumer.consumeLine( "    Changes:" );
317        listChangesetConsumer.consumeLine( "      ---c- (1165) \\GPDB\\pom.xml" );
318
319        assertEquals( "Wrong number of change sets parsed!", 4, changeSets.size() );
320        // The order needs to be preserved.
321        // Check revisions
322        assertEquals( "Parsing sequence error (1)", "1809", changeSets.get( 0 ).getRevision() );
323        assertEquals( "Parsing sequence error (2)", "1801", changeSets.get( 1 ).getRevision() );
324        assertEquals( "Parsing sequence error (3)", "1799", changeSets.get( 2 ).getRevision() );
325        assertEquals( "Parsing sequence error (4)", "1764", changeSets.get( 3 ).getRevision() );
326        // Check Author
327        assertEquals( "Parsing error - Author (1)", "Deb", changeSets.get( 0 ).getAuthor() );
328        assertEquals( "Parsing error - Author (2)", "Deb", changeSets.get( 1 ).getAuthor() );
329        assertEquals( "Parsing error - Author (3)", "Deb", changeSets.get( 2 ).getAuthor() );
330        assertEquals( "Parsing error - Author (4)", "Deb", changeSets.get( 3 ).getAuthor() );
331        // Check Comments
332        assertEquals( "Parsing error - Comment (1)", "[maven-release-plugin] prepare for next development iteration",
333                      changeSets.get( 0 ).getComment() );
334        assertEquals( "Parsing error - Comment (2)", "[maven-release-plugin] prepare release GPDB-1.0.26",
335                      changeSets.get( 1 ).getComment() );
336        assertEquals( "Parsing error - Comment (3)", "No comment", changeSets.get( 2 ).getComment() );
337        assertEquals( "Parsing error - Comment (4)", "No comment", changeSets.get( 3 ).getComment() );
338        // Check Dates
339        Calendar today = Calendar.getInstance();
340        assertEquals( "Parsing error - Date (1)", getDate( today.get( Calendar.YEAR ), today.get( Calendar.MONTH ),
341                                                           today.get( Calendar.DAY_OF_MONTH ), 18, 20, 0, null ),
342                      changeSets.get( 0 ).getDate() );
343        assertEquals( "Parsing error - Date (2)", getDate( today.get( Calendar.YEAR ), today.get( Calendar.MONTH ),
344                                                           today.get( Calendar.DAY_OF_MONTH ), 18, 18, 0, null ),
345                      changeSets.get( 1 ).getDate() );
346        assertEquals( "Parsing error - Date (3)", getDate( today.get( Calendar.YEAR ), today.get( Calendar.MONTH ),
347                                                           today.get( Calendar.DAY_OF_MONTH ), 18, 18, 0, null ),
348                      changeSets.get( 2 ).getDate() );
349        assertEquals( "Parsing error - Date (4)", getDate( 2012, 02, 01, 14, 34, 0, null ),
350                      changeSets.get( 3 ).getDate() );
351        // Check files
352        List<ChangeFile> files;
353        files = changeSets.get( 0 ).getFiles();
354        assertEquals( "Parsing error - Files (1)", 4, files.size() );
355        assertEquals( "Parsing error - Files (1) (1)", "\\GPDB\\GPDBEAR\\pom.xml", files.get( 0 ).getName() );
356        assertEquals( "Parsing error - Files (1) (2)", "\\GPDB\\GPDBResources\\pom.xml", files.get( 1 ).getName() );
357        assertEquals( "Parsing error - Files (1) (3)", "\\GPDB\\GPDBWeb\\pom.xml", files.get( 2 ).getName() );
358        assertEquals( "Parsing error - Files (1) (4)", "\\GPDB\\pom.xml", files.get( 3 ).getName() );
359        files = changeSets.get( 1 ).getFiles();
360        assertEquals( "Parsing error - Files (2)", 3, files.size() );
361        assertEquals( "Parsing error - Files (2) (1)", "\\GPDB\\GPDBEAR\\pom.xml", files.get( 0 ).getName() );
362        assertEquals( "Parsing error - Files (2) (2)", "\\GPDB\\GPDBResources\\pom.xml", files.get( 1 ).getName() );
363        assertEquals( "Parsing error - Files (2) (3)", "\\GPDB\\GPDBWeb\\pom.xml", files.get( 2 ).getName() );
364        files = changeSets.get( 2 ).getFiles();
365        assertEquals( "Parsing error - Files (3)", 1, files.size() );
366        assertEquals( "Parsing error - Files (3) (1)", "\\GPDB\\pom.xml", files.get( 0 ).getName() );
367        files = changeSets.get( 3 ).getFiles();
368        assertEquals( "Parsing error - Files (4)", 1, files.size() );
369        assertEquals( "Parsing error - Files (4) (1)", "\\GPDB\\pom.xml", files.get( 0 ).getName() );
370        // Check file actions = ScmFileStatus
371        files = changeSets.get( 0 ).getFiles();
372        assertEquals( "Parsing error - File Status (1) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
373        assertEquals( "Parsing error - File Status (1) (2)", ScmFileStatus.MODIFIED, files.get( 1 ).getAction() );
374        assertEquals( "Parsing error - File Status (1) (3)", ScmFileStatus.MODIFIED, files.get( 2 ).getAction() );
375        assertEquals( "Parsing error - File Status (1) (4)", ScmFileStatus.MODIFIED, files.get( 3 ).getAction() );
376        files = changeSets.get( 1 ).getFiles();
377        assertEquals( "Parsing error - File Status (2) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
378        assertEquals( "Parsing error - File Status (2) (2)", ScmFileStatus.MODIFIED, files.get( 1 ).getAction() );
379        assertEquals( "Parsing error - File Status (2) (3)", ScmFileStatus.MODIFIED, files.get( 2 ).getAction() );
380        files = changeSets.get( 2 ).getFiles();
381        assertEquals( "Parsing error - File Status (3) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
382        files = changeSets.get( 3 ).getFiles();
383        assertEquals( "Parsing error - File Status (4) (1)", ScmFileStatus.MODIFIED, files.get( 0 ).getAction() );
384    }
385
386    public void testStripDelimiters()
387        throws Exception
388    {
389        assertEquals( "stripDelimiters() is broken! (1)", "Plain Text",
390                      listChangesetConsumer.stripDelimiters( "Plain Text" ) );
391        assertEquals( "stripDelimiters() is broken! (2)", "Plain Text",
392                      listChangesetConsumer.stripDelimiters( "\"Plain Text" ) );
393        assertEquals( "stripDelimiters() is broken! (3)", "Plain Text",
394                      listChangesetConsumer.stripDelimiters( "Plain Text\"" ) );
395        assertEquals( "stripDelimiters() is broken! (4)", "Plain Text",
396                      listChangesetConsumer.stripDelimiters( "\"Plain Text\"" ) );
397        assertEquals( "stripDelimiters() is broken! (5)", "Plain Text",
398                      listChangesetConsumer.stripDelimiters( "<Plain Text" ) );
399        assertEquals( "stripDelimiters() is broken! (6)", "Plain Text",
400                      listChangesetConsumer.stripDelimiters( "Plain Text>" ) );
401        assertEquals( "stripDelimiters() is broken! (7)", "Plain Text",
402                      listChangesetConsumer.stripDelimiters( "<Plain Text>" ) );
403    }
404
405}