Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 170   Methods: 6
NCLOC: 49   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Continuus.java 0% 0% 0% 0%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
 5   
  * reserved.
 6   
  *
 7   
  * Redistribution and use in source and binary forms, with or without
 8   
  * modification, are permitted provided that the following conditions
 9   
  * are met:
 10   
  *
 11   
  * 1. Redistributions of source code must retain the above copyright
 12   
  *    notice, this list of conditions and the following disclaimer.
 13   
  *
 14   
  * 2. Redistributions in binary form must reproduce the above copyright
 15   
  *    notice, this list of conditions and the following disclaimer in
 16   
  *    the documentation and/or other materials provided with the
 17   
  *    distribution.
 18   
  *
 19   
  * 3. The end-user documentation included with the redistribution, if
 20   
  *    any, must include the following acknowlegement:
 21   
  *       "This product includes software developed by the
 22   
  *        Apache Software Foundation (http://www.apache.org/)."
 23   
  *    Alternately, this acknowlegement may appear in the software itself,
 24   
  *    if and wherever such third-party acknowlegements normally appear.
 25   
  *
 26   
  * 4. The names "Ant" and "Apache Software
 27   
  *    Foundation" must not be used to endorse or promote products derived
 28   
  *    from this software without prior written permission. For written
 29   
  *    permission, please contact apache@apache.org.
 30   
  *
 31   
  * 5. Products derived from this software may not be called "Apache"
 32   
  *    nor may "Apache" appear in their names without prior written
 33   
  *    permission of the Apache Group.
 34   
  *
 35   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 36   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 37   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 38   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 39   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 40   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 41   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 42   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 43   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 44   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 45   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 46   
  * SUCH DAMAGE.
 47   
  * ====================================================================
 48   
  *
 49   
  * This software consists of voluntary contributions made by many
 50   
  * individuals on behalf of the Apache Software Foundation.  For more
 51   
  * information on the Apache Software Foundation, please see
 52   
  * <http://www.apache.org/>.
 53   
  */
 54   
 
 55   
 package org.apache.tools.ant.taskdefs.optional.ccm;
 56   
 
 57   
 import org.apache.tools.ant.BuildException;
 58   
 import org.apache.tools.ant.Project;
 59   
 import org.apache.tools.ant.Task;
 60   
 import org.apache.tools.ant.taskdefs.Execute;
 61   
 import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
 62   
 import org.apache.tools.ant.taskdefs.LogStreamHandler;
 63   
 import org.apache.tools.ant.types.Commandline;
 64   
 
 65   
 
 66   
 /**
 67   
  * A base class for creating tasks for executing commands on Continuus 5.1.
 68   
  * <p>
 69   
  * The class extends the  task as it operates by executing the ccm.exe program
 70   
  * supplied with Continuus/Synergy. By default the task expects the ccm executable to be
 71   
  * in the path,
 72   
  * you can override this be specifying the ccmdir attribute.
 73   
  * </p>
 74   
  *
 75   
  * @author Benoit Moussaud benoit.moussaud@criltelecom.com
 76   
  */
 77   
 public abstract class Continuus extends Task {
 78   
 
 79   
     private String ccmDir = "";
 80   
     private String ccmAction = "";
 81   
 
 82   
     /**
 83   
      * Get the value of ccmAction.
 84   
      * @return value of ccmAction.
 85   
      */
 86  0
     public String getCcmAction() {
 87  0
         return ccmAction;
 88   
     }
 89   
 
 90   
     /**
 91   
      * Set the value of ccmAction.
 92   
      * @param v  Value to assign to ccmAction.
 93   
      * @ant.attribute ignore="true"
 94   
      */
 95  0
     public void setCcmAction(String v) {
 96  0
         this.ccmAction = v;
 97   
     }
 98   
 
 99   
 
 100   
     /**
 101   
      * Set the directory where the ccm executable is located.
 102   
      *
 103   
      * @param dir the directory containing the ccm executable
 104   
      */
 105  0
     public final void setCcmDir(String dir) {
 106  0
         ccmDir = getProject().translatePath(dir);
 107   
     }
 108   
 
 109   
     /**
 110   
      * Builds and returns the command string to execute ccm
 111   
      * @return String containing path to the executable
 112   
      */
 113  0
     protected final String getCcmCommand() {
 114  0
         String toReturn = ccmDir;
 115  0
         if (!toReturn.equals("") && !toReturn.endsWith("/")) {
 116  0
             toReturn += "/";
 117   
         }
 118   
 
 119  0
         toReturn += CCM_EXE;
 120   
 
 121  0
         return toReturn;
 122   
     }
 123   
 
 124   
 
 125  0
     protected int run(Commandline cmd, ExecuteStreamHandler handler) {
 126  0
         try {
 127  0
             Execute exe = new Execute(handler);
 128  0
             exe.setAntRun(getProject());
 129  0
             exe.setWorkingDirectory(getProject().getBaseDir());
 130  0
             exe.setCommandline(cmd.getCommandline());
 131  0
             return exe.execute();
 132   
         } catch (java.io.IOException e) {
 133  0
             throw new BuildException(e, getLocation());
 134   
         }
 135   
     }
 136   
 
 137  0
     protected int run(Commandline cmd) {
 138  0
         return run(cmd, new LogStreamHandler(this, Project.MSG_VERBOSE, Project.MSG_WARN));
 139   
     }
 140   
 
 141   
     /**
 142   
      * Constant for the thing to execute
 143   
      */
 144   
     private static final String CCM_EXE = "ccm";
 145   
 
 146   
     /**
 147   
      * The 'CreateTask' command
 148   
      */
 149   
     public static final String COMMAND_CREATE_TASK = "create_task";
 150   
     /**
 151   
      * The 'Checkout' command
 152   
      */
 153   
     public static final String COMMAND_CHECKOUT = "co";
 154   
     /**
 155   
      * The 'Checkin' command
 156   
      */
 157   
     public static final String COMMAND_CHECKIN = "ci";
 158   
     /**
 159   
      * The 'Reconfigure' command
 160   
      */
 161   
     public static final String COMMAND_RECONFIGURE = "reconfigure";
 162   
 
 163   
     /**
 164   
      * The 'Reconfigure' command
 165   
      */
 166   
     public static final String COMMAND_DEFAULT_TASK = "default_task";
 167   
 
 168   
 
 169   
 }
 170