Coverage Report - org.apache.maven.scm.provider.clearcase.command.status.ClearCaseStatusConsumer
 
Classes in this File Line Coverage Branch Coverage Complexity
ClearCaseStatusConsumer
90 %
9/10
50 %
1/2
1,333
 
 1  
 package org.apache.maven.scm.provider.clearcase.command.status;
 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 org.apache.maven.scm.ScmFile;
 23  
 import org.apache.maven.scm.ScmFileStatus;
 24  
 import org.apache.maven.scm.log.ScmLogger;
 25  
 import org.codehaus.plexus.util.cli.StreamConsumer;
 26  
 
 27  
 import java.io.File;
 28  
 import java.util.ArrayList;
 29  
 import java.util.List;
 30  
 
 31  
 /**
 32  
  * @author <a href="mailto:wim.deblauwe@gmail.com">Wim Deblauwe</a>
 33  
  * @version $Id: ClearCaseStatusConsumer.java 1056991 2011-01-09 18:09:10Z olamy $
 34  
  */
 35  
 public class ClearCaseStatusConsumer
 36  
     implements StreamConsumer
 37  
 {
 38  
     private ScmLogger logger;
 39  
 
 40  
     private File workingDirectory;
 41  
 
 42  1
     private List<ScmFile> checkedOutFiles = new ArrayList<ScmFile>();
 43  
 
 44  
     // ----------------------------------------------------------------------
 45  
     //
 46  
     // ----------------------------------------------------------------------
 47  
 
 48  
     public ClearCaseStatusConsumer( ScmLogger logger, File workingDirectory )
 49  1
     {
 50  1
         this.logger = logger;
 51  1
         this.workingDirectory = workingDirectory;
 52  1
     }
 53  
 
 54  
     // ----------------------------------------------------------------------
 55  
     // Stream Consumer Implementation
 56  
     // ----------------------------------------------------------------------
 57  
 
 58  
     /** {@inheritDoc} */
 59  
     public void consumeLine( String line )
 60  
     {
 61  1
         if ( logger.isDebugEnabled() )
 62  
         {
 63  0
             logger.debug( line );
 64  
         }
 65  1
         checkedOutFiles.add(
 66  
             new ScmFile( workingDirectory.getAbsolutePath() + line.substring( 1 ), ScmFileStatus.CHECKED_OUT ) );
 67  1
     }
 68  
 
 69  
     // ----------------------------------------------------------------------
 70  
     //
 71  
     // ----------------------------------------------------------------------
 72  
 
 73  
     public List<ScmFile> getCheckedOutFiles()
 74  
     {
 75  1
         return checkedOutFiles;
 76  
     }
 77  
 }