1 package org.apache.maven.scm.provider.jazz.command.blame;
2
3 import org.apache.maven.scm.log.DefaultLog;
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 import java.util.Locale;
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 public class JazzBlameCommandTest
33 extends JazzScmTestCase
34 {
35 private JazzScmProviderRepository repo;
36
37 private JazzBlameConsumer blameConsumer;
38
39 private Locale defaultLocale;
40
41 protected void setUp()
42 throws Exception
43 {
44 super.setUp();
45 repo = getScmProviderRepository();
46 blameConsumer = new JazzBlameConsumer( repo, new DefaultLog() );
47 defaultLocale = Locale.getDefault();
48 }
49
50 protected void tearDown()
51 throws Exception
52 {
53 Locale.setDefault( defaultLocale );
54 }
55
56 public void testCreateBlameCommand()
57 throws Exception
58 {
59 Commandline cmd =
60 new JazzBlameCommand().createBlameCommand( repo, getScmFileSet(), "test.txt" ).getCommandline();
61 String expected = "scm annotate --username myUserName --password myPassword test.txt";
62 assertCommandLine( expected, getWorkingDirectory(), cmd );
63 }
64
65 public void testConsumer()
66 {
67
68
69
70
71 blameConsumer.consumeLine( "1 Deb (1008) 2011-12-14 Test.txt" );
72 blameConsumer.consumeLine( "2 Deb (1005) 2011-12-14 59 My commit comment." );
73
74 assertEquals( "Wrong number of lines parsed!", 2, blameConsumer.getLines().size() );
75 }
76
77 }