1 | |
package org.apache.maven.scm.provider.cvslib.command.changelog; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.scm.command.changelog.ChangeLogScmResult; |
23 | |
import org.apache.maven.scm.command.changelog.ChangeLogSet; |
24 | |
import org.apache.maven.scm.manager.ScmManager; |
25 | |
import org.apache.maven.scm.provider.cvslib.AbstractCvsScmTest; |
26 | |
import org.apache.maven.scm.provider.cvslib.CvsScmTestUtils; |
27 | |
|
28 | |
import java.util.Date; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 0 | public class CvsChangeLogCommandTest |
36 | |
extends AbstractCvsScmTest |
37 | |
{ |
38 | |
|
39 | |
protected String getModule() |
40 | |
{ |
41 | 0 | return "test-repo/changelog"; |
42 | |
} |
43 | |
|
44 | |
public void testGetCommandWithStartAndEndDate() |
45 | |
throws Exception |
46 | |
{ |
47 | 0 | Date startDate = getDate( 2003, 1, 1 ); |
48 | |
|
49 | 0 | Date endDate = getDate( 2004, 1, 1 ); |
50 | |
|
51 | 0 | testChangeLog( startDate, endDate, 32, null ); |
52 | 0 | } |
53 | |
|
54 | |
public void testGetCommandWithoutEndDate() |
55 | |
throws Exception |
56 | |
{ |
57 | 0 | Date startDate = getDate( 2003, 1, 1 ); |
58 | |
|
59 | 0 | Date endDate = null; |
60 | |
|
61 | 0 | testChangeLog( startDate, endDate, 51, null ); |
62 | 0 | } |
63 | |
|
64 | |
public void testGetCommandWithBranchOrTag() |
65 | |
throws Exception |
66 | |
{ |
67 | 0 | Date startDate = null; |
68 | |
|
69 | 0 | Date endDate = null; |
70 | |
|
71 | 0 | testChangeLog( startDate, endDate, 22, "1.107.4" ); |
72 | 0 | } |
73 | |
|
74 | |
@SuppressWarnings( "deprecation" ) |
75 | |
private void testChangeLog( Date startDate, Date endDate, int changeLogSize, String branch ) |
76 | |
throws Exception |
77 | |
{ |
78 | 0 | if ( !isSystemCmd( CvsScmTestUtils.CVS_COMMAND_LINE ) ) |
79 | |
{ |
80 | 0 | System.err.println( "'" + CvsScmTestUtils.CVS_COMMAND_LINE + "' is not a system command. Ignored " |
81 | |
+ getName() + "." ); |
82 | 0 | return; |
83 | |
} |
84 | |
|
85 | 0 | ScmManager scmManager = getScmManager(); |
86 | |
|
87 | 0 | CvsScmTestUtils.executeCVS( getWorkingDirectory(), |
88 | |
"-f -d " + getTestFile( "src/test/repository/" ) + " co " + getModule() ); |
89 | |
|
90 | 0 | ChangeLogScmResult changeLogResult = scmManager.getProviderByRepository( getScmRepository() ).changeLog( |
91 | |
getScmRepository(), getScmFileSet(), startDate, endDate, 0, branch ); |
92 | |
|
93 | 0 | if ( !changeLogResult.isSuccess() ) |
94 | |
{ |
95 | 0 | fail( changeLogResult.getProviderMessage() + "\n" + changeLogResult.getCommandOutput() ); |
96 | |
} |
97 | |
|
98 | 0 | ChangeLogSet changeLogSet = changeLogResult.getChangeLog(); |
99 | |
|
100 | 0 | assertNotNull( changeLogSet ); |
101 | |
|
102 | 0 | assertEquals( changeLogSize, changeLogSet.getChangeSets().size() ); |
103 | 0 | } |
104 | |
} |