[ 
https://issues.apache.org/jira/browse/SCM-891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16577351#comment-16577351
 ] 

ASF GitHub Bot commented on SCM-891:
------------------------------------

asfgit closed pull request #82: SCM-891
URL: https://github.com/apache/maven-scm/pull/82
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/maven-scm-api/src/main/java/org/apache/maven/scm/util/ConsumerUtils.java 
b/maven-scm-api/src/main/java/org/apache/maven/scm/util/ConsumerUtils.java
new file mode 100644
index 000000000..8d063971d
--- /dev/null
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/util/ConsumerUtils.java
@@ -0,0 +1,63 @@
+package org.apache.maven.scm.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * @author <a href="mailto:davide.angelocola+apa...@gmail.com";>Davide 
Angelocola</a>
+ */
+public class ConsumerUtils
+{
+
+    private ConsumerUtils()
+    {
+    }
+
+    /**
+     * Read file f, sending each line to the consumer.
+     * 
+     * @param f
+     * @param consumer
+     * @throws IOException
+     */
+    public static void consumeFile(File f, StreamConsumer consumer) throws 
IOException
+    {
+        BufferedReader r = new BufferedReader( new FileReader( f ) );
+
+        try
+        {
+            String line;
+            while ( (line = r.readLine()) != null )
+            {
+                consumer.consumeLine( line );
+            }
+
+        } finally
+        {
+            r.close();
+        }
+    }
+}
diff --git 
a/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
index 366c1a27f..7e074d1bf 100644
--- 
a/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
@@ -19,11 +19,8 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ChangeFile;
@@ -31,6 +28,7 @@
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.junit.Assert;
 
 public class BazaarChangeLogConsumerTest
@@ -43,14 +41,7 @@ public void testChanglogWithMergeEntries()
 
         BazaarChangeLogConsumer consumer = new BazaarChangeLogConsumer( new 
DefaultLog(), null );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<ChangeSet> mods = consumer.getModifications();
         assertEquals( 4, mods.size() );
@@ -70,4 +61,6 @@ public void testChanglogWithMergeEntries()
         Assert.assertEquals( "Invalid file name", "blablabla.txt", 
ch2f2.getName() );
         Assert.assertEquals( "Invalid original name", "a", 
ch2f2.getOriginalName() );
     }
+
+       
 }
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
index 6ac5e6f2d..94e89355b 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
@@ -19,14 +19,12 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -42,15 +40,8 @@ public void testParse()
 
         PerforceAddConsumer consumer = new PerforceAddConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         List<ScmFile> adds = consumer.getAdditions();
         assertEquals( "Wrong number of entries returned", 3, adds.size() );
         String entry = adds.get( 0 ).getPath();
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
index 9c3fda467..64d410349 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
@@ -23,6 +23,7 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.command.blame.BlameLine;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 import java.io.*;
 
@@ -40,14 +41,7 @@ public void testParse()
 
         PerforceBlameConsumer consumer = new PerforceBlameConsumer( new 
DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         Assert.assertEquals( 2, consumer.getLines().size() );
 
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
index 78a53d39a..46ea34591 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
@@ -22,6 +22,7 @@
 import junit.framework.Assert;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 import java.io.*;
 
@@ -39,14 +40,7 @@ public void testParse()
 
         PerforceFilelogConsumer consumer = new PerforceFilelogConsumer( new 
DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         Assert.assertEquals( "earl", consumer.getAuthor( "35" ) );
         Assert.assertEquals( "raj", consumer.getAuthor( "34" ) );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
index b26bd972f..5c6d1ab17 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
@@ -19,15 +19,13 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -43,16 +41,10 @@ public void testParse()
 
         PerforceChangesConsumer consumer =
             new PerforceChangesConsumer( new DefaultLog() );
+        
+        ConsumerUtils.consumeFile( testFile, consumer );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        
         List<String> entries = new ArrayList<String>( consumer.getChanges() );
         assertEquals( "Wrong number of entries returned", 7, entries.size() );
         String changelist = (String) entries.get(2);
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
index 16064183a..2be1691c4 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
@@ -19,10 +19,7 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -30,6 +27,7 @@
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -46,15 +44,8 @@ public void testParse()
         PerforceDescribeConsumer consumer =
             new PerforceDescribeConsumer( "//depot/test", null, new 
DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         List<ChangeSet> entries = new ArrayList<ChangeSet>( 
consumer.getModifications() );
         assertEquals( "Wrong number of entries returned", 7, entries.size() );
         ChangeSet entry = entries.get(0);
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
index 79e9868b7..69be4d30c 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
@@ -20,11 +20,9 @@
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -40,14 +38,7 @@ public void testGoodParse()
 
         PerforceCheckInConsumer consumer = new PerforceCheckInConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertTrue( consumer.getOutput(), consumer.isSuccess() );
         assertEquals( "", consumer.getOutput() );
@@ -60,15 +51,8 @@ public void testGooderParse()
 
         PerforceCheckInConsumer consumer = new PerforceCheckInConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         assertTrue( consumer.getOutput(), consumer.isSuccess() );
         assertEquals( "", consumer.getOutput() );
     }
@@ -80,15 +64,8 @@ public void testBadParse()
 
         PerforceCheckInConsumer consumer = new PerforceCheckInConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         assertFalse( consumer.getOutput(), consumer.isSuccess() );
         assertTrue( consumer.getOutput(), consumer.getOutput().length() > 0 );
     }
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
index d1b2638b8..c2aad02ce 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
@@ -22,11 +22,9 @@
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -45,15 +43,8 @@ public void testGoodParse()
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         assertTrue( consumer.getOutput(), consumer.isSuccess() );
         assertEquals( "", consumer.getOutput() );
         assertEquals( 4, consumer.getCheckedout().size() );
@@ -75,14 +66,7 @@ public void testBadParse()
         consumer.consumeLine( "Client test-test-maven saved." );
         assertTrue( consumer.isSuccess() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.getOutput(), consumer.isSuccess() );
         assertTrue( consumer.getOutput(), consumer.getOutput().length() > 0 );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
index 559def96c..44f273714 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
@@ -20,11 +20,9 @@
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -40,15 +38,8 @@ public void testParse()
 
         PerforceDiffConsumer consumer = new PerforceDiffConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         // Linebreak differences will fail if we try to assert
         // the exact file length so we just use a rough approximation.
         assertTrue( consumer.getOutput().length() > 12500 );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
index c7a07c736..56116323b 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
@@ -19,14 +19,12 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -42,15 +40,8 @@ public void testParse()
 
         PerforceEditConsumer consumer = new PerforceEditConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         List<ScmFile> edits = consumer.getEdits();
         assertEquals( "Wrong number of entries returned", 2, edits.size() );
         String entry = edits.get( 0 ).getPath();
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
index 02def2aac..7122af03d 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
@@ -20,11 +20,9 @@
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse </a>
@@ -39,15 +37,8 @@ public void testGoodParse()
 
         PerforceLoginConsumer consumer = new PerforceLoginConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
     }
@@ -59,14 +50,7 @@ public void testBadParse()
 
         PerforceLoginConsumer consumer = new PerforceLoginConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.isSuccess() );
         assertTrue( consumer.getOutput().startsWith( "Password invalid." ) );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
index fab19ce1a..2576e18e0 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
@@ -19,14 +19,12 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -42,14 +40,7 @@ public void testParse()
 
         PerforceRemoveConsumer consumer = new PerforceRemoveConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<ScmFile> removes = consumer.getRemovals();
         assertEquals( "Wrong number of entries returned", 2, removes.size() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
index 2fb5a0b97..ce332edb1 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
@@ -22,11 +22,9 @@
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 /**
@@ -42,15 +40,8 @@ public void testGoodParse()
 
         PerforceStatusConsumer consumer = new PerforceStatusConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
         List<String> results = consumer.getDepotfiles();
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
index 708f83e55..6c3dbf966 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
@@ -19,14 +19,12 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse </a>
@@ -41,15 +39,8 @@ public void testGoodParse()
 
         PerforceTagConsumer consumer = new PerforceTagConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
         List<ScmFile> results = consumer.getTagged();
@@ -65,14 +56,7 @@ public void testBadParse()
 
         PerforceTagConsumer consumer = new PerforceTagConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.isSuccess() );
         assertTrue(
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
index 3b012cea3..790d97ecc 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
@@ -19,14 +19,12 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse </a>
@@ -41,14 +39,7 @@ public void testGoodParse()
 
         PerforceUnEditConsumer consumer = new PerforceUnEditConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertTrue( consumer.isSuccess() );
         List<ScmFile> edits = consumer.getEdits();
@@ -65,15 +56,8 @@ public void testBadParse()
 
         PerforceUnEditConsumer consumer = new PerforceUnEditConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         assertFalse( consumer.isSuccess() );
         assertTrue( consumer.getOutput().indexOf( ".classpath - file(s) not 
opened on this client." ) == 0 );
         assertTrue( consumer.getOutput().indexOf( ".project - file(s) not 
opened on this client." ) > 0 );
diff --git 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
index 7b98214f4..8f3a0a723 100644
--- 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
@@ -22,11 +22,9 @@
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
@@ -62,21 +60,10 @@ public void setUp()
 
         File basedir = new File( "C:/Test" );
 
-        FileInputStream fis = new FileInputStream( testFile );
-
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-
-        String s = in.readLine();
-
         StarteamChangeLogConsumer consumer =
             new StarteamChangeLogConsumer( basedir, new DefaultLog(), null, 
null, null );
 
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         return consumer.getModifications();
     }
diff --git 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
index d22f72de5..b550ad116 100644
--- 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
@@ -19,15 +19,13 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.Collection;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:dant...@gmail.com";>Dan T. Tran</a>
@@ -48,22 +46,11 @@ public void setUp()
     public void testParse()
         throws Exception
     {
-        FileInputStream fis = new FileInputStream( testFile );
-
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-
-        String s = in.readLine();
-
         File basedir = new File( getBasedir() );
 
         StarteamDiffConsumer consumer = new StarteamDiffConsumer( new 
DefaultLog(), basedir );
 
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         Collection<ScmFile> entries = consumer.getChangedFiles();
 
diff --git 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
index 43d93a330..bd1144cf1 100644
--- 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
@@ -19,13 +19,11 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:dant...@gmail.com";>Dan T. Tran</a>
@@ -49,20 +47,9 @@ public void setUp()
     public void testParse()
         throws Exception
     {
-        FileInputStream fis = new FileInputStream( testFile );
-
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-
-        String s = in.readLine();
-
         StarteamStatusConsumer consumer = new StarteamStatusConsumer( new 
DefaultLog(), new File( WORKING_DIR ) );
 
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
         
         assertEquals( "Wrong number of entries returned", 4, 
consumer.getChangedFiles().size() );
 
diff --git 
a/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
index 498423142..f1764b980 100644
--- 
a/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
@@ -23,11 +23,9 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.command.blame.BlameLine;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author Evgeny Mandrikov
@@ -43,15 +41,8 @@ public void testConsumer()
 
         TfsBlameConsumer consumer = new TfsBlameConsumer( new DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, consumer );
+        
         Assert.assertEquals( 3, consumer.getLines().size() );
 
         BlameLine line1 = (BlameLine) consumer.getLines().get( 0 );
diff --git 
a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
index 07fb3cb50..3b74398e4 100644
--- 
a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
@@ -22,11 +22,9 @@
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.log.DefaultLog;
 import org.apache.maven.scm.provider.cvslib.AbstractCvsScmTest;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -65,16 +63,7 @@ public void testParse()
         throws Exception
     {
         CvsChangeLogConsumer command = new CvsChangeLogConsumer( new 
DefaultLog(), null );
-
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            command.consumeLine( s );
-            s = in.readLine();
-        }
-
+        ConsumerUtils.consumeFile( testFile, command );
         Collection<ChangeSet> entries = command.getModifications();
         assertEquals( "Wrong number of entries returned", 3, entries.size() );
         ChangeSet entry = null;
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
index 12830acaf..ad1780244 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
@@ -22,11 +22,10 @@
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.util.List;
 import java.util.Map;
 
@@ -44,14 +43,7 @@ public void testEmptyLogConsumer()
 
         File f = getTestFile( 
"/src/test/resources/git/diff/git-diff-empty.log" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getChangedFiles();
 
@@ -65,15 +57,8 @@ public void testLog1Consumer()
 
         File f = getTestFile( "src/test/resources/git/diff/git-diff1.log" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
-
+        ConsumerUtils.consumeFile( f, consumer );
+        
         List<ScmFile> changedFiles = consumer.getChangedFiles();
 
         assertEquals( 1, changedFiles.size() );
@@ -95,15 +80,8 @@ public void testLog2Consumer()
 
         File f = getTestFile( "src/test/resources/git/diff/git-diff2.log" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
-
+        ConsumerUtils.consumeFile( f, consumer );
+        
         List<ScmFile> changedFiles = consumer.getChangedFiles();
 
         assertEquals( 2, changedFiles.size() );
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
index a7671b662..84e1ba93a 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
@@ -22,6 +22,7 @@
 import junit.framework.Assert;
 import org.apache.maven.scm.command.blame.BlameLine;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 
 import java.io.BufferedReader;
@@ -182,14 +183,9 @@ private GitBlameConsumer consumeFile( String fileName ) 
throws IOException
 
         File f = getTestFile( fileName );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
+        ConsumerUtils.consumeFile( f, consumer ); 
 
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
         return consumer;
     }
+
 }
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
index c8365bf36..64d67a95a 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
@@ -23,12 +23,11 @@
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 import org.junit.Assert;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.text.SimpleDateFormat;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -61,14 +60,7 @@ public void testConsumer1()
 
         File f = getTestFile( 
"/src/test/resources/git/changelog/gitwhatchanged.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ChangeSet> modifications = consumer.getModifications();
 
@@ -117,15 +109,8 @@ public void testConsumer2()
 
         File f = getTestFile( 
"/src/test/resources/git/changelog/gitwhatchanged2.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
-
+        ConsumerUtils.consumeFile( f, consumer );
+        
         List<ChangeSet> modifications = consumer.getModifications();
 
         // must use *Linked* HashMap to have predictable toString
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
index 55f3a0a23..7e9a36428 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
@@ -23,11 +23,10 @@
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
 import 
org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.util.List;
 
 /**
@@ -56,14 +55,7 @@ public void testLog1Consumer()
 
         File f = getTestFile( "/src/test/resources/git/remove/gitrm.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getRemovedFiles();
         
@@ -80,14 +72,7 @@ public void testEmptyLogConsumer()
 
         File f = getTestFile( 
"/src/test/resources/git/remove/gitrm-empty.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getRemovedFiles();
         
diff --git 
a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
index 7ed440376..09fd0dcf1 100644
--- 
a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
@@ -23,13 +23,12 @@
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.logging.Logger;
 import org.junit.Assert;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.io.IOException;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -154,14 +153,7 @@ public void testConsumeLine_InvalidDate()
     private void consumeLog( final File logFile )
         throws IOException
     {
-        final BufferedReader reader = new BufferedReader( new FileReader( 
logFile ) );
-        String line = reader.readLine();
-
-        while ( line != null )
-        {
-            consumer.consumeLine( line );
-            line = reader.readLine();
-        }
+        ConsumerUtils.consumeFile( logFile, consumer );
     }
 
     public void testConsumerWithPattern1()
@@ -171,14 +163,7 @@ public void testConsumerWithPattern1()
 
         File f = getTestFile( "/src/test/resources/svn/changelog/svnlog.txt" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ChangeSet> modifications = consumer.getModifications();
 
@@ -228,14 +213,7 @@ public void testConsumerWithPattern2()
 
         File f = getTestFile( "/src/test/resources/svn/changelog/svnlog2.txt" 
);
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List modifications = consumer.getModifications();
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Remove duplicate code in tests
> ------------------------------
>
>                 Key: SCM-891
>                 URL: https://issues.apache.org/jira/browse/SCM-891
>             Project: Maven SCM
>          Issue Type: Improvement
>    Affects Versions: 1.10.0
>            Reporter: Davide Angelocola
>            Assignee: Michael Osipov
>            Priority: Trivial
>             Fix For: 1.10.1
>
>
> Introduce a shared utility method to send a text file, line by line, into a
> {code:java}
> StreamConsumer{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to