001package org.apache.maven.scm.provider.accurev.cli; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import static org.hamcrest.Matchers.is; 023import static org.junit.Assert.assertThat; 024 025import java.util.ArrayList; 026import java.util.Date; 027import java.util.List; 028 029import org.apache.maven.scm.log.DefaultLog; 030import org.apache.maven.scm.provider.accurev.Stream; 031import org.junit.Test; 032 033public class StreamsConsumerTest 034{ 035 036 @Test 037 public void testname() 038 throws Exception 039 { 040 041 List<Stream> streams = new ArrayList<Stream>(); 042 XppStreamConsumer consumer = new StreamsConsumer( new DefaultLog(), streams ); 043 AccuRevJUnitUtil.consume( "/showstreams.xml", consumer ); 044 045 assertThat( streams.size(), is( 5 ) ); 046 047 Stream s = streams.get( 2 ); 048 /* 049 * <stream name="mvnscm_1275484086_initRepo_ggardner" basis="mvnscm_1275484086_tckTests" basisStreamNumber="2" 050 * depotName="mvnscm_1275484086" streamNumber="3" isDynamic="false" type="workspace" startTime="1275484091" 051 * hidden="true"/> 052 */ 053 assertThat( s.getBasis(), is( "mvnscm_1275484086_tckTests" ) ); 054 assertThat( s.getId(), is( 3L ) ); 055 assertThat( s.getBasisId(), is( 2L ) ); 056 assertThat( s.getName(), is( "mvnscm_1275484086_initRepo_ggardner" ) ); 057 assertThat( s.getStartDate(), is( new Date( 1275484091L * 1000L ) ) ); 058 assertThat( s.getStreamType(), is( "workspace" ) ); 059 assertThat( s.isWorkspace(), is( true ) ); 060 } 061}