Coverage Report - org.apache.maven.scm.provider.synergy.consumer.SynergyGetTaskObjectsConsumer
 
Classes in this File Line Coverage Branch Coverage Complexity
SynergyGetTaskObjectsConsumer
80 %
12/15
33 %
2/6
2
 
 1  
 package org.apache.maven.scm.provider.synergy.consumer;
 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.ChangeFile;
 23  
 import org.apache.maven.scm.log.ScmLogger;
 24  
 import org.apache.maven.scm.provider.synergy.util.SynergyUtil;
 25  
 import org.apache.maven.scm.util.AbstractConsumer;
 26  
 
 27  
 import java.util.ArrayList;
 28  
 import java.util.List;
 29  
 import java.util.StringTokenizer;
 30  
 
 31  
 /**
 32  
  * Mainly inspired from CruiseControl
 33  
  *
 34  
  * @author <a href="julien.henry@capgemini.com">Julien Henry</a>
 35  
  * @author Olivier Lamy
 36  
  * @version $Id: SynergyGetTaskObjectsConsumer.java 1054408 2011-01-02 14:05:25Z olamy $
 37  
  */
 38  
 public class SynergyGetTaskObjectsConsumer
 39  
     extends AbstractConsumer
 40  
 {
 41  
 
 42  1
     private List<ChangeFile> entries = new ArrayList<ChangeFile>();
 43  
 
 44  
     public static final String OUTPUT_FORMAT = "%name" + SynergyUtil.SEPARATOR + // 0
 45  
         "%version" + SynergyUtil.SEPARATOR;
 46  
 
 47  
     /**
 48  
      * @return the entries
 49  
      */
 50  
     public List<ChangeFile> getFiles()
 51  
     {
 52  1
         return entries;
 53  
     }
 54  
 
 55  
     public SynergyGetTaskObjectsConsumer( ScmLogger logger )
 56  
     {
 57  1
         super( logger );
 58  1
     }
 59  
 
 60  
     /** {@inheritDoc} */
 61  
     public void consumeLine( String line )
 62  
     {
 63  1
         if ( getLogger().isDebugEnabled() )
 64  
         {
 65  0
             getLogger().debug( "Consume: " + line );
 66  
         }
 67  1
         StringTokenizer tokenizer = new StringTokenizer( line.trim(), SynergyUtil.SEPARATOR );
 68  1
         if ( tokenizer.countTokens() == 2 )
 69  
         {
 70  1
             ChangeFile f = new ChangeFile( tokenizer.nextToken() );
 71  1
             f.setRevision( tokenizer.nextToken() );
 72  1
             entries.add( f );
 73  1
         }
 74  
         else
 75  
         {
 76  0
             if ( getLogger().isErrorEnabled() )
 77  
             {
 78  0
                 getLogger().error(
 79  
                                    "Invalid token count in SynergyGetTaskObjects [" + tokenizer.countTokens()
 80  
                                        + "]" );
 81  
             }
 82  
         }
 83  1
     }
 84  
 
 85  
 }