1 | |
package org.apache.maven.scm.tck.command.list; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import java.io.File; |
23 | |
import java.util.List; |
24 | |
|
25 | |
import org.apache.maven.scm.ScmFile; |
26 | |
import org.apache.maven.scm.ScmFileSet; |
27 | |
import org.apache.maven.scm.ScmTckTestCase; |
28 | |
import org.apache.maven.scm.ScmVersion; |
29 | |
import org.apache.maven.scm.command.list.ListScmResult; |
30 | |
import org.apache.maven.scm.provider.ScmProvider; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 0 | public abstract class ListCommandTckTest |
39 | |
extends ScmTckTestCase |
40 | |
{ |
41 | |
public void testListCommandTest() |
42 | |
throws Exception |
43 | |
{ |
44 | 0 | ScmFileSet fileSet = new ScmFileSet( new File( "." ), new File( "." ) ); |
45 | |
|
46 | 0 | List<ScmFile> files = runList( fileSet, false ); |
47 | |
|
48 | 0 | assertEquals( "The result of the list command doesn't have all the files in SCM: " + files, 3, files.size() ); |
49 | 0 | } |
50 | |
|
51 | |
public void testListCommandRecursiveTest() |
52 | |
throws Exception |
53 | |
{ |
54 | 0 | ScmFileSet fileSet = new ScmFileSet( new File( "." ), new File( "." ) ); |
55 | |
|
56 | 0 | List<ScmFile> files = runList( fileSet, true ); |
57 | |
|
58 | 0 | assertEquals( "The result of the list command doesn't have all the files in SCM: " + files, 10, files.size() ); |
59 | 0 | } |
60 | |
|
61 | |
public void testListCommandUnexistantFileTest() |
62 | |
throws Exception |
63 | |
{ |
64 | 0 | ScmFileSet fileSet = new ScmFileSet( new File( "." ), new File( "/void" ) ); |
65 | |
|
66 | 0 | ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() ); |
67 | |
|
68 | 0 | ListScmResult result = provider.list( getScmRepository(), fileSet, false, (ScmVersion) null ); |
69 | |
|
70 | 0 | assertFalse( "Found file when shouldn't", result.isSuccess() ); |
71 | 0 | } |
72 | |
|
73 | |
private List<ScmFile> runList( ScmFileSet fileSet, boolean recursive ) |
74 | |
throws Exception |
75 | |
{ |
76 | 0 | ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() ); |
77 | |
|
78 | 0 | ListScmResult result = provider.list( getScmRepository(), fileSet, recursive, (ScmVersion) null ); |
79 | |
|
80 | 0 | assertTrue( "SCM command failed: " + result.getCommandLine() + " : " + result.getProviderMessage() |
81 | |
+ ( result.getCommandOutput() == null ? "" : ": " + result.getCommandOutput() ), result.isSuccess() ); |
82 | |
|
83 | 0 | return result.getFiles(); |
84 | |
} |
85 | |
} |