1 package org.apache.maven.scm.provider.cvslib;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.Assert;
23 import org.apache.maven.scm.ScmTestCase;
24 import org.codehaus.plexus.PlexusTestCase;
25 import org.codehaus.plexus.util.FileUtils;
26
27 import java.io.File;
28 import java.io.IOException;
29
30
31
32
33
34 public final class CvsScmTestUtils
35 {
36
37 public static final String CVS_COMMAND_LINE = "cvs";
38
39 private CvsScmTestUtils()
40 {
41 }
42
43 public static String getScmUrl( File repository, String module )
44 {
45 return "scm:cvs|local|" + repository + "|" + module;
46 }
47
48 public static void executeCVS( File workingDirectory, String arguments )
49 throws Exception
50 {
51 ScmTestCase.execute( workingDirectory, CVS_COMMAND_LINE, arguments );
52 }
53
54 public static void initRepo( File repository, File workingDirectory, File assertionDirectory )
55 throws IOException
56 {
57 initRepo( "src/test/repository/", repository, workingDirectory );
58
59 FileUtils.deleteDirectory( assertionDirectory );
60
61 Assert.assertTrue( assertionDirectory.mkdirs() );
62 }
63
64 public static void initRepo( String source, File repository, File workingDirectory )
65 throws IOException
66 {
67
68 File src = PlexusTestCase.getTestFile( source );
69
70 FileUtils.deleteDirectory( repository );
71
72 Assert.assertTrue( repository.mkdirs() );
73
74 FileUtils.copyDirectoryStructure( src, repository );
75
76 FileUtils.deleteDirectory( workingDirectory );
77
78 Assert.assertTrue( workingDirectory.mkdirs() );
79 }
80 }