1 package org.apache.maven.scm.provider.accurev.cli;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.hamcrest.Matchers.is;
23 import static org.hamcrest.Matchers.notNullValue;
24 import static org.junit.Assert.assertThat;
25
26 import java.io.IOException;
27 import java.io.InputStream;
28 import java.util.HashMap;
29 import java.util.Map;
30
31 import org.apache.maven.scm.ScmTestCase;
32 import org.apache.maven.scm.log.ScmLogger;
33 import org.apache.maven.scm.provider.accurev.WorkSpace;
34 import org.junit.Before;
35 import org.junit.Test;
36 import org.junit.runner.RunWith;
37 import org.junit.runners.JUnit4;
38
39 @RunWith( JUnit4.class )
40 public class WorkSpaceConsumerTest
41 extends ScmTestCase
42 {
43
44 private ScmLogger logger;
45
46 @Override
47 protected InputStream getCustomConfiguration()
48 throws Exception
49 {
50 return AccuRevJUnitUtil.getPlexusConfiguration();
51 }
52
53 @Before
54 public void setup()
55 throws Exception
56 {
57 setUp();
58 logger = AccuRevJUnitUtil.getLogger( getContainer() );
59 }
60
61 @Test
62 public void testConsumeShowWorkSpaces()
63 throws IOException
64 {
65
66 Map<String, WorkSpace> wsMap = new HashMap<String, WorkSpace>();
67 XppStreamConsumer consumer = new WorkSpaceConsumer( logger, wsMap );
68 AccuRevJUnitUtil.consume( "/showworkspaces.xml", consumer );
69
70 WorkSpace ws = wsMap.get( "maventst_ggardner" );
71 assertThat( ws, notNullValue() );
72 assertThat( ws.getTransactionId(), is( 49L ) );
73
74 }
75
76 @Test
77 public void testConsumeShowRefTrees()
78 throws IOException
79 {
80
81 Map<String, WorkSpace> wsMap = new HashMap<String, WorkSpace>();
82 XppStreamConsumer consumer = new WorkSpaceConsumer( logger, wsMap );
83 AccuRevJUnitUtil.consume( "/showrefs.xml", consumer );
84
85 WorkSpace ws = wsMap.get( "maven-scm-INT-reftree" );
86 assertThat( ws, notNullValue() );
87 assertThat( ws.getTransactionId(), is( 12L ) );
88
89 }
90
91 }