1 package org.apache.maven.scm.provider.jazz.command.tag;
2
3 import org.apache.maven.scm.ScmTagParameters;
4 import org.apache.maven.scm.provider.jazz.JazzScmTestCase;
5 import org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository;
6 import org.codehaus.plexus.util.cli.Commandline;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public class JazzTagCommandTest
31 extends JazzScmTestCase
32 {
33 private JazzScmProviderRepository repo;
34
35 protected void setUp()
36 throws Exception
37 {
38 super.setUp();
39 repo = getScmProviderRepository();
40
41
42
43
44 repo.setWorkspace( "Dave's Repository Workspace" );
45 repo.setFlowTarget( "Dave's Stream" );
46 }
47
48 public void testCreateTagCreateSnapshotCommand()
49 throws Exception
50 {
51 ScmTagParameters scmTagParameters = new ScmTagParameters( "My Tag Message" );
52 Commandline cmd = new JazzTagCommand().createTagCreateSnapshotCommand( repo, getScmFileSet(), "My_Tag_Name",
53 scmTagParameters ).getCommandline();
54 String expected =
55 "scm create snapshot --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword --name My_Tag_Name --description \"My Tag Message\" \"Dave's Repository Workspace\"";
56 assertCommandLine( expected, getWorkingDirectory(), cmd );
57 }
58
59 public void testCreateTagCreateWorkspaceCommand()
60 throws Exception
61 {
62 Commandline cmd = new JazzTagCommand().createTagCreateWorkspaceCommand( repo, getScmFileSet(),
63 "My_Snapshot_Name" ).getCommandline();
64 String expected =
65 "scm create workspace --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword My_Snapshot_Name --snapshot My_Snapshot_Name";
66 assertCommandLine( expected, getWorkingDirectory(), cmd );
67 }
68
69 public void testCreateTagDeliverCommand()
70 throws Exception
71 {
72 Commandline cmd =
73 new JazzTagCommand().createTagDeliverCommand( repo, getScmFileSet(), "My_Tag_Name" ).getCommandline();
74 String expected =
75 "scm deliver --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword --source My_Tag_Name --target \"Dave's Stream\"";
76 assertCommandLine( expected, getWorkingDirectory(), cmd );
77 }
78
79 public void testCreateTagSnapshotPromoteCommand()
80 throws Exception
81 {
82 Commandline cmd = new JazzTagCommand().createTagSnapshotPromoteCommand( repo, getScmFileSet(),
83 "My_Snapshot_Name" ).getCommandline();
84 String expected =
85 "scm snapshot promote --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword \"Dave's Stream\" My_Snapshot_Name";
86 assertCommandLine( expected, getWorkingDirectory(), cmd );
87 }
88 }