1 package org.apache.maven.scm.provider.jazz.command;
2
3 import org.apache.maven.scm.ScmFileSet;
4 import org.apache.maven.scm.provider.jazz.JazzScmTestCase;
5 import org.codehaus.plexus.util.Os;
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 JazzScmCommandTest
31 extends JazzScmTestCase
32 {
33 public void testFileList()
34 {
35 assertTrue( getScmFileSet().getFileList().size() > 0 );
36 }
37
38 public void testJazzScmCommand()
39 throws Exception
40 {
41 ScmFileSet scmFileSet = new ScmFileSet( getWorkingCopy() );
42 JazzScmCommand listCommand = new JazzScmCommand( "list", getScmProviderRepository(), scmFileSet, null );
43 String expected =
44 "scm list --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword";
45
46 assertCommandLine( expected, getWorkingDirectory(), listCommand.getCommandline() );
47
48 }
49
50 public void testCryptPassword()
51 throws Exception
52 {
53 JazzScmCommand listCommand = new JazzScmCommand( "list", getScmProviderRepository(), null, null );
54 String actual = JazzScmCommand.cryptPassword( listCommand.getCommandline() );
55 String expected = Os.isFamily( Os.FAMILY_WINDOWS )
56 ? "cmd.exe /X /C \"scm list --repository-uri https://localhost:9443/jazz --username myUserName --password *****\""
57 : "/bin/sh -c scm list --repository-uri https://localhost:9443/jazz --username myUserName --password '*****'";
58
59 System.out.println( "actual:" + actual );
60 assertEquals( "cryptPassword failed!", expected, actual );
61 }
62 }