1 package org.apache.maven.scm.provider.svn.svnexe.command.tag;
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
24 import org.apache.maven.scm.ScmTagParameters;
25 import org.apache.maven.scm.provider.svn.command.tag.SvnTagCommandTckTest;
26 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
27 import org.apache.maven.scm.repository.ScmRepository;
28 import org.codehaus.plexus.util.cli.Commandline;
29
30
31
32
33
34
35
36 public class SvnExeTagCommandTckTest
37 extends SvnTagCommandTckTest
38 {
39 public void testTagUserNameSvnSsh()
40 throws Exception
41 {
42 File messageFile = File.createTempFile( "maven-scm", "commit" );
43 messageFile.deleteOnExit();
44
45 testCommandLine( "scm:svn:svn+ssh://foo.com/svn/trunk", "svntag", messageFile, "user",
46 "svn --username user --no-auth-cache --non-interactive copy --file " + messageFile.getAbsolutePath() +
47 " --encoding UTF-8 --parents . svn+ssh://user@foo.com/svn/tags/svntag@", null );
48 }
49
50 public void testTagRemoteTagHttps()
51 throws Exception
52 {
53 File messageFile = File.createTempFile( "maven-scm", "commit" );
54 messageFile.deleteOnExit();
55
56 ScmTagParameters scmTagParameters = new ScmTagParameters();
57 scmTagParameters.setRemoteTagging( true );
58 scmTagParameters.setPinExternals( false );
59 testCommandLine( "scm:svn:https://foo.com/svn/trunk", "svntag", messageFile, "user",
60 "svn --username user --no-auth-cache --non-interactive copy --file " + messageFile.getAbsolutePath()
61 + " --encoding UTF-8 --parents https://foo.com/svn/trunk@ https://foo.com/svn/tags/svntag@", scmTagParameters );
62 }
63
64 public void testTagRemoteTagHttpsWithPinExternals()
65 throws Exception
66 {
67 File messageFile = File.createTempFile( "maven-scm", "commit" );
68 messageFile.deleteOnExit();
69
70 ScmTagParameters scmTagParameters = new ScmTagParameters();
71 scmTagParameters.setRemoteTagging( true );
72 scmTagParameters.setPinExternals( true );
73 testCommandLine( "scm:svn:https://foo.com/svn/trunk", "svntag", messageFile, "user",
74 "svn --username user --no-auth-cache --non-interactive copy --file " + messageFile.getAbsolutePath()
75 + " --encoding UTF-8 --parents --pin-externals https://foo.com/svn/trunk@ https://foo.com/svn/tags/svntag@", scmTagParameters );
76 }
77
78 public void testTagRemoteTagHttpsWithRevision()
79 throws Exception
80 {
81 File messageFile = File.createTempFile( "maven-scm", "commit" );
82 messageFile.deleteOnExit();
83
84 ScmTagParameters scmTagParameters = new ScmTagParameters();
85 scmTagParameters.setRemoteTagging( true );
86 scmTagParameters.setPinExternals( false );
87 scmTagParameters.setScmRevision( "12" );
88 testCommandLine( "scm:svn:https://foo.com/svn/trunk", "svntag", messageFile, "user",
89 "svn --username user --no-auth-cache --non-interactive copy --file " + messageFile.getAbsolutePath()
90 + " --encoding UTF-8 --parents --revision 12 https://foo.com/svn/trunk@ https://foo.com/svn/tags/svntag@",
91 scmTagParameters );
92 }
93
94 public void testTagRemoteTagHttpsWithRevisionAndPinExternals()
95 throws Exception
96 {
97 File messageFile = File.createTempFile( "maven-scm", "commit" );
98 messageFile.deleteOnExit();
99
100 ScmTagParameters scmTagParameters = new ScmTagParameters();
101 scmTagParameters.setRemoteTagging( true );
102 scmTagParameters.setPinExternals( true );
103 scmTagParameters.setScmRevision( "12" );
104 testCommandLine( "scm:svn:https://foo.com/svn/trunk", "svntag", messageFile, "user",
105 "svn --username user --no-auth-cache --non-interactive copy --file " + messageFile.getAbsolutePath()
106 + " --encoding UTF-8 --parents --revision 12 --pin-externals https://foo.com/svn/trunk@ https://foo.com/svn/tags/svntag@",
107 scmTagParameters );
108 }
109
110 private void testCommandLine( String scmUrl, String tag, File messageFile, String user, String commandLine,
111 ScmTagParameters scmTagParameters )
112 throws Exception
113 {
114 File workingDirectory = getTestFile( "target/svn-update-command-test" );
115
116 ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
117
118 SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
119
120 svnRepository.setUser( user );
121
122 Commandline cl = null;
123
124 cl = SvnTagCommand.createCommandLine( svnRepository, workingDirectory, tag, messageFile, scmTagParameters );
125
126 assertCommandLine( commandLine, workingDirectory, cl );
127 }
128 }