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.untag;
20
21 import java.io.File;
22
23 import org.apache.maven.scm.ScmFileSet;
24 import org.apache.maven.scm.provider.svn.command.untag.SvnUntagCommandTckTest;
25 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
26 import org.apache.maven.scm.repository.ScmRepository;
27 import org.codehaus.plexus.util.cli.Commandline;
28 import org.junit.Test;
29
30 import static org.apache.maven.scm.provider.svn.SvnScmTestUtils.SVN_COMMAND_LINE;
31
32
33
34
35
36 public class SvnExeUntagCommandTckTest extends SvnUntagCommandTckTest {
37 @Override
38 public String getScmProviderCommand() {
39 return SVN_COMMAND_LINE;
40 }
41
42
43
44
45
46
47 @Test
48 public void testUntagSsh() throws Exception {
49 File messageFile = File.createTempFile("maven-scm", "commit");
50 messageFile.deleteOnExit();
51
52 ScmFileSet scmFileSet = new ScmFileSet(new File("target/svn-untag-command-test"));
53
54 testCommandLine(
55 "scm:svn:svn+ssh://foo.com/svn/trunk",
56 scmFileSet,
57 "svntag",
58 messageFile,
59 "user",
60 "svn --username user --no-auth-cache --non-interactive --file " + messageFile.getAbsolutePath()
61 + " remove svn+ssh://user@foo.com/svn/tags/svntag@");
62 }
63
64
65
66
67
68
69 @Test
70 public void testUntagHttps() throws Exception {
71 File messageFile = File.createTempFile("maven-scm", "commit");
72 messageFile.deleteOnExit();
73
74 ScmFileSet scmFileSet = new ScmFileSet(new File("target/svn-untag-command-test"));
75
76 testCommandLine(
77 "scm:svn:https://foo.com/svn/tags",
78 scmFileSet,
79 "svntag",
80 messageFile,
81 "user",
82 "svn --username user --no-auth-cache --non-interactive --file " + messageFile.getAbsolutePath()
83 + " remove https://foo.com/svn/tags/svntag@");
84 }
85
86
87
88
89
90
91
92
93
94
95
96
97 private void testCommandLine(
98 String scmUrl, ScmFileSet scmFileSet, String tag, File messageFile, String user, String commandLine)
99 throws Exception {
100 File workingDirectory = getTestFile("target/svn-untag-command-test");
101
102 ScmRepository repository = getScmManager().makeScmRepository(scmUrl);
103
104 SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
105
106 svnRepository.setUser(user);
107
108 Commandline cl = new SvnUntagCommand().createCommandline(svnRepository, scmFileSet, tag, messageFile);
109
110 assertCommandLine(commandLine, workingDirectory, cl);
111 }
112 }