1 | |
package org.apache.maven.scm.tck.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.ChangeSet; |
23 | |
import org.apache.maven.scm.ScmBranch; |
24 | |
import org.apache.maven.scm.ScmFileSet; |
25 | |
import org.apache.maven.scm.ScmTckTestCase; |
26 | |
import org.apache.maven.scm.ScmTestCase; |
27 | |
import org.apache.maven.scm.ScmVersion; |
28 | |
import org.apache.maven.scm.command.changelog.ChangeLogScmResult; |
29 | |
import org.apache.maven.scm.command.checkin.CheckInScmResult; |
30 | |
import org.apache.maven.scm.provider.ScmProvider; |
31 | |
|
32 | |
import java.util.Date; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | 0 | public abstract class ChangeLogCommandTckTest |
45 | |
extends ScmTckTestCase |
46 | |
{ |
47 | |
private static final String COMMIT_MSG = "Second changelog"; |
48 | |
|
49 | |
public void testChangeLogCommand() |
50 | |
throws Exception |
51 | |
{ |
52 | 0 | Thread.sleep( 1000 ); |
53 | 0 | ScmProvider provider = getScmManager().getProviderByRepository( getScmRepository() ); |
54 | 0 | ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() ); |
55 | |
|
56 | |
|
57 | 0 | ChangeLogScmResult result = |
58 | |
provider.changeLog( getScmRepository(), fileSet, null, null, 0, (ScmBranch) null, null ); |
59 | 0 | assertTrue( result.getProviderMessage(), result.isSuccess() ); |
60 | 0 | assertEquals( 1, result.getChangeLog().getChangeSets().size() ); |
61 | |
|
62 | |
|
63 | 0 | Date timeBeforeSecond = new Date(); |
64 | |
|
65 | |
|
66 | 0 | Thread.sleep( 2000 ); |
67 | |
|
68 | |
|
69 | 0 | ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" ); |
70 | 0 | CheckInScmResult checkInResult = provider.checkIn( getScmRepository(), fileSet, COMMIT_MSG ); |
71 | 0 | assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() ); |
72 | |
|
73 | 0 | result = provider.changeLog( getScmRepository(), fileSet, (ScmVersion) null, null ); |
74 | 0 | assertTrue( result.getProviderMessage(), result.isSuccess() ); |
75 | 0 | assertEquals( 2, result.getChangeLog().getChangeSets().size() ); |
76 | |
|
77 | |
|
78 | 0 | Date currentTime = new Date(); |
79 | 0 | result = provider |
80 | |
.changeLog( getScmRepository(), fileSet, timeBeforeSecond, currentTime, 0, new ScmBranch( "" ) ); |
81 | |
|
82 | |
|
83 | 0 | assertTrue( result.getProviderMessage(), result.isSuccess() ); |
84 | 0 | assertEquals( 1, result.getChangeLog().getChangeSets().size() ); |
85 | 0 | ChangeSet changeset = result.getChangeLog().getChangeSets().get( 0 ); |
86 | 0 | assertTrue( changeset.getDate().after( timeBeforeSecond ) ); |
87 | 0 | assertEquals( COMMIT_MSG, changeset.getComment() ); |
88 | 0 | } |
89 | |
} |