1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.scm.provider.svn.svnexe.command.export;
20
21 import java.io.File;
22
23 import org.apache.maven.scm.ScmTestCase;
24 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
25 import org.apache.maven.scm.repository.ScmRepository;
26 import org.codehaus.plexus.util.cli.Commandline;
27 import org.junit.Test;
28
29 public class SvnExportCommandTest extends ScmTestCase {
30
31 @Test
32 public void testGetExportCommandLineWithImplicitExportDirectory() throws Exception {
33 File exportDirectory = new File(getBasedir());
34
35 testCommandLine(
36 "scm:svn:http://foo.com/svn/trunk",
37 exportDirectory,
38 null,
39 "svn --non-interactive export --force http://foo.com/svn/trunk@");
40 }
41
42 @Test
43 public void testGetExportCommandLineWithExplicitExportDirectory() throws Exception {
44 File exportDirectory = new File(getBasedir());
45
46 testCommandLine(
47 "scm:svn:http://foo.com/svn/trunk",
48 exportDirectory,
49 exportDirectory,
50 "svn --non-interactive export --force http://foo.com/svn/trunk@ " + exportDirectory + "@");
51 }
52
53 private void testCommandLine(String scmUrl, File workingDirectory, File exportDirectory, String commandLine)
54 throws Exception {
55 ScmRepository repository = getScmManager().makeScmRepository(scmUrl);
56
57 SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
58
59 Commandline cl = SvnExeExportCommand.createCommandLine(
60 svnRepository,
61 exportDirectory,
62 null,
63 svnRepository.getUrl(),
64 exportDirectory != null ? exportDirectory.getAbsolutePath() : null);
65
66 assertCommandLine(commandLine, exportDirectory, cl);
67 }
68 }