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