001package org.apache.maven.scm.provider.tfs.command.blame; 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 junit.framework.Assert; 023import org.apache.maven.scm.ScmTestCase; 024import org.apache.maven.scm.command.blame.BlameLine; 025import org.apache.maven.scm.log.DefaultLog; 026 027import java.io.BufferedReader; 028import java.io.File; 029import java.io.FileInputStream; 030import java.io.InputStreamReader; 031 032/** 033 * @author Evgeny Mandrikov 034 */ 035public class TfsBlameConsumerTest 036 extends ScmTestCase 037{ 038 039 public void testConsumer() 040 throws Exception 041 { 042 File testFile = getTestFile( "src/test/resources/tfs/annotatelog.txt" ); 043 044 TfsBlameConsumer consumer = new TfsBlameConsumer( new DefaultLog() ); 045 046 FileInputStream fis = new FileInputStream( testFile ); 047 BufferedReader in = new BufferedReader( new InputStreamReader( fis ) ); 048 String s = in.readLine(); 049 while ( s != null ) 050 { 051 consumer.consumeLine( s ); 052 s = in.readLine(); 053 } 054 055 Assert.assertEquals( 3, consumer.getLines().size() ); 056 057 BlameLine line1 = (BlameLine) consumer.getLines().get( 0 ); 058 Assert.assertEquals( "3", line1.getRevision() ); 059 Assert.assertEquals( "hatusr01", line1.getAuthor() ); 060 061 BlameLine line2 = (BlameLine) consumer.getLines().get( 1 ); 062 Assert.assertEquals( "4", line2.getRevision() ); 063 Assert.assertEquals( "buckh", line2.getAuthor() ); 064 } 065 066}