1 package org.apache.maven.scm.provider.accurev.cli;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import static org.hamcrest.Matchers.is;
23 import static org.hamcrest.MatcherAssert.assertThat;
24
25 import java.util.ArrayList;
26 import java.util.Date;
27 import java.util.List;
28
29 import org.apache.maven.scm.log.DefaultLog;
30 import org.apache.maven.scm.provider.accurev.Stream;
31 import org.junit.Test;
32
33 public class StreamsConsumerTest
34 {
35
36 @Test
37 public void testname()
38 throws Exception
39 {
40
41 List<Stream> streams = new ArrayList<Stream>();
42 XppStreamConsumer consumer = new StreamsConsumer( new DefaultLog(), streams );
43 AccuRevJUnitUtil.consume( "/showstreams.xml", consumer );
44
45 assertThat( streams.size(), is( 5 ) );
46
47 Stream s = streams.get( 2 );
48 /*
49 * <stream name="mvnscm_1275484086_initRepo_ggardner" basis="mvnscm_1275484086_tckTests" basisStreamNumber="2"
50 * depotName="mvnscm_1275484086" streamNumber="3" isDynamic="false" type="workspace" startTime="1275484091"
51 * hidden="true"/>
52 */
53 assertThat( s.getBasis(), is( "mvnscm_1275484086_tckTests" ) );
54 assertThat( s.getId(), is( 3L ) );
55 assertThat( s.getBasisId(), is( 2L ) );
56 assertThat( s.getName(), is( "mvnscm_1275484086_initRepo_ggardner" ) );
57 assertThat( s.getStartDate(), is( new Date( 1275484091L * 1000L ) ) );
58 assertThat( s.getStreamType(), is( "workspace" ) );
59 assertThat( s.isWorkspace(), is( true ) );
60 }
61 }