ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/sos SOSTest.java
Date Thu, 26 Sep 2002 13:28:41 GMT
bodewig     2002/09/26 06:28:41

  Modified:    .        WHATSNEW
               docs/manual/OptionalTasks sos.html vss.html
               src/main/org/apache/tools/ant/taskdefs/optional/sos SOS.java
               src/main/org/apache/tools/ant/taskdefs/optional/vss
                        MSVSS.java
               src/testcases/org/apache/tools/ant/taskdefs/optional/sos
                        SOSTest.java
  Added:       src/etc/testcases/taskdefs/optional/sos sos.xml
  Log:
  Remove magic that prepends a $ to vsspath and projectpath in VSS and
  SOS tasks.
  
  PR: 10201
  Submitted by:	Jesse Stockall <jesse at cryptocard.com>
  
  Revision  Changes    Path
  1.291     +3 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.290
  retrieving revision 1.291
  diff -u -r1.290 -r1.291
  --- WHATSNEW	26 Sep 2002 12:34:27 -0000	1.290
  +++ WHATSNEW	26 Sep 2002 13:28:41 -0000	1.291
  @@ -78,6 +78,9 @@
   
   * new rmdir action for <ftp> that removes directories from a fileset.
   
  +* The SOS and VSS tasks will no longer unconditionally prepend a $ to
  +  vsspath or projectpath.
  +
   Changes from Ant 1.5beta3 to Ant 1.5
   ====================================
   
  
  
  
  1.7       +49 -46    jakarta-ant/docs/manual/OptionalTasks/sos.html
  
  Index: sos.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/sos.html,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sos.html	4 Sep 2002 11:05:18 -0000	1.6
  +++ sos.html	26 Sep 2002 13:28:41 -0000	1.7
  @@ -6,7 +6,7 @@
     <title>SOS Tasks</title>
   
   </head>
  -  <body>
  +<body>
   
   <div align="center">
   <h1>SourceOffSite Tasks User Manual</h1>
  @@ -109,7 +109,7 @@
           </tr>
           <tr>
              <td>projectpath</td>
  -           <td>SourceSafe project path without the "$"</td>
  +           <td>SourceSafe project path - eg. $/SourceRoot/Project1</td>
              <td>Yes</td>
           </tr>
           <tr>
  @@ -174,20 +174,21 @@
   <h3>Example</h3>
   
   <pre>
  -&lt;sosget verbose="true"
  -        recursive="true"
  -        username="build"
  -        password="build"
  -        localpath="tmp"
  -        projectpath="/SourceRoot/project1"
  -        sosserverpath="192.168.10.6:8888"
  -        vssserverpath="d:\vss\srcsafe.ini"/&gt;
  +&lt;sosget verbose=&quot;true&quot;
  +        recursive=&quot;true&quot;
  +        username=&quot;build&quot;
  +        password=&quot;build&quot;
  +        localpath=&quot;tmp&quot;
  +        projectpath=&quot;$/SourceRoot/project1&quot;
  +        sosserverpath=&quot;192.168.10.6:8888&quot;
  +        vssserverpath=&quot;d:\vss\srcsafe.ini&quot;/&gt;
   </pre>
   <small>Connects to a SourceOffsite server on 192.168.10.6:8888 with
   build,build as the username &amp; password. The SourceSafe  database resides
   on the same box as the SOS server  &amp; the VSS database  is at
  -"d:\vss\srcsafe.ini" Does a recursive GetProject on $/SourceRoot/project1,
  -using tmp as the working directory. </small><br>
  +&quot;d:\vss\srcsafe.ini&quot; Does a recursive GetProject on
  +$/SourceRoot/project1, using tmp as the working
  +directory. </small><br>
   <br>
   
   <hr width="100%" size="2">
  @@ -198,7 +199,7 @@
   <h3>Parameters</h3>
   
   <table border="1">
  -    <tr>
  +    <tbody><tr>
         <th>Attribute</th>
         <th>Values</th>
         <th>Required</th>
  @@ -221,7 +222,7 @@
       </tr>
       <tr>
          <td>projectpath</td>
  -       <td>SourceSafe project path without the "$"</td>
  +       <td>SourceSafe project path - eg. $/SourceRoot/Project1</td>
          <td>Yes</td>
       </tr>
       <tr>
  @@ -254,19 +255,19 @@
   
   <h3>Example</h3>
   <pre>
  -&lt;soslabel username="build"
  -          password="build"
  -          label="test label"
  -          projectpath="/SourceRoot/project1
  -          sosserverpath="192.168.10.6:8888"
  -          vssserverpath="d:\vss\srcsafe.ini"/&gt;
  +&lt;soslabel username=&quot;build&quot;
  +          password=&quot;build&quot;
  +          label=&quot;test label&quot;
  +          projectpath=&quot;$/SourceRoot/project1&quot;
  +          sosserverpath=&quot;192.168.10.6:8888&quot;
  +          vssserverpath=&quot;d:\vss\srcsafe.ini&quot;/&gt;
   </pre>
   
   <small>Connects to a SourceOffsite server on 192.168.10.6:8888 with
   build,build as the username &amp; password. The SourceSafe database resides
   on the same box as  the  SOS server  &amp; the VSS database is at
  -"d:\vss\srcsafe.ini". Labels the $/SourceRoot/project1 project with
  -"test label".</small><br>
  +&quot;d:\vss\srcsafe.ini&quot;. Labels the $/SourceRoot/project1
  +project with &quot;test label&quot;.</small><br>
   <br>
   
   <hr width="100%" size="2"><br>
  @@ -301,7 +302,7 @@
       </tr>
       <tr>
          <td>projectpath</td>
  -       <td>SourceSafe project path without the "$"</td>
  +       <td>SourceSafe project path - eg. $/SourceRoot/Project1</td>
          <td>Yes</td>
       </tr>
       <tr>
  @@ -349,7 +350,7 @@
          <td>true or false - Status messages are displayed</td>
          <td>No</td>
       </tr>
  -    <td>comment</td>
  +    <tr><td>comment</td>
          <td>A comment to be applied to all files being checked in</td>
          <td>No</td>
       </tr>
  @@ -358,21 +359,22 @@
   
   <h3>Example</h3>
   <pre>
  -&lt;soscheckin username="build"
  -            password="build"
  -            file="foobar.txt"
  -            verbose="true"
  -            comment="comment abc"
  -            projectpath="/SourceRoot/project1"
  -            sosserverpath="server1:8888"
  -            vssserverpath="\\server2\vss\srcsafe.ini"/&gt;
  +&lt;soscheckin username=&quot;build&quot;
  +            password=&quot;build&quot;
  +            file=&quot;foobar.txt&quot;
  +            verbose=&quot;true&quot;
  +            comment=&quot;comment abc&quot;
  +            projectpath=&quot;$/SourceRoot/project1&quot;
  +            sosserverpath=&quot;server1:8888&quot;
  +            vssserverpath=&quot;\\server2\vss\srcsafe.ini&quot;/&gt;
   </pre>
   
   <small>Connects to a SourceOffsite server on server1:8888 with build,build as
   the username &amp; password. The SourceSafe database resides on a different
  -box (server2) &amp; the VSS database is on a share called "vss". Checks-in
  -only the "foobar.txt" file adding a comment of "comment abc". Extra status
  -messages will be displayed on screen.</small><br>
  +box (server2) &amp; the VSS database is on a share called
  +&quot;vss&quot;. Checks-in only the &quot;foobar.txt&quot; file adding
  +a comment of &quot;comment abc&quot;. Extra status messages will be
  +displayed on screen.</small><br>
   <br>
   
   <hr width="100%" size="2">
  @@ -408,7 +410,7 @@
       </tr>
       <tr>
          <td>projectpath</td>
  -       <td>SourceSafe project path without the "$"</td>
  +       <td>SourceSafe project path - eg. $/SourceRoot/Project1</td>
          <td>Yes</td>
       </tr>
       <tr>
  @@ -462,20 +464,21 @@
   
   <h3>Example</h3>
   <pre>
  -&lt;soscheckout soscmd="/usr/local/bin"
  -             verbose="true"
  -             username="build"
  -             password="build"
  -             projectpath="/SourceRoot/project1"
  -             sosserverpath="192.168.10.6:8888"
  -             vssserverpath="\\server2\vss\srcsafe.ini"/&gt;
  +&lt;soscheckout soscmd=&quot;/usr/local/bin&quot;
  +             verbose=&quot;true&quot;
  +             username=&quot;build&quot;
  +             password=&quot;build&quot;
  +             projectpath=&quot;$/SourceRoot/project1&quot;
  +             sosserverpath=&quot;192.168.10.6:8888&quot;
  +             vssserverpath=&quot;\\server2\vss\srcsafe.ini&quot;/&gt;
   </pre>
   
   <small>Connects to a SourceOffsite server on server1:8888 with build,build as
   the username &amp; password. The SourceSafe database resides on a different
  -box (server2) &amp; the VSS database is on a share called "vss". Checks-out
  -"project1", Only the "project1" directory will be locked as the recursive
  -option was not set. Extra status messages will be displayed on screen. The
  +box (server2) &amp; the VSS database is on a share called
  +&quot;vss&quot;. Checks-out &quot;project1&quot;, Only the
  +&quot;project1&quot; directory will be locked as the recursive option
  +was not set. Extra status messages will be displayed on screen. The
   soscmd(.exe) file to be used resides in /usr/local/bin.</small><br>
   <br>
   <hr>
  
  
  
  1.11      +19 -25    jakarta-ant/docs/manual/OptionalTasks/vss.html
  
  Index: vss.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/vss.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- vss.html	9 Jul 2002 21:05:52 -0000	1.10
  +++ vss.html	26 Sep 2002 13:28:41 -0000	1.11
  @@ -93,8 +93,7 @@
     <tr>
        <td>vsspath</td>
        <td>SourceSafe path which specifies the project/file(s) you wish to
  -         perform the action on. You should not specify the leading dollar-sign -
  -         it is prepended by Ant automatically.</td>
  +         perform the action on.</td>
        <td>Yes</td>
     </tr>
     <tr>
  @@ -164,7 +163,7 @@
           recursive=&quot;true&quot;
           label=&quot;Release1&quot;
           login=&quot;me,mypassword&quot;
  -        vsspath=&quot;/source/aProject&quot;
  +        vsspath=&quot;$/source/aProject&quot;
           writable=&quot;true&quot;/&gt;
   </pre>
   </blockquote>
  @@ -191,8 +190,7 @@
     <tr>
        <td>vsspath</td>
        <td>SourceSafe path which specifies the project/file(s) you wish to
  -         perform the action on. You should not specify the leading dollar-sign -
  -         it is prepended by Ant automatically.</td>
  +         perform the action on.</td>
        <td>Yes</td>
     </tr>
     <tr>
  @@ -240,7 +238,7 @@
   <h3>Examples</h3>
   <blockquote>
   <pre>
  -&lt;vsslabel vsspath=&quot;/source/aProject&quot;
  +&lt;vsslabel vsspath=&quot;$/source/aProject&quot;
             login=&quot;me,mypassword&quot;
             label=&quot;Release1&quot;/&gt;
   </pre>
  @@ -251,7 +249,7 @@
   </p>
   <blockquote>
   <pre>
  -&lt;vsslabel vsspath=&quot;/source/aProject/myfile.txt&quot;
  +&lt;vsslabel vsspath=&quot;$/source/aProject/myfile.txt&quot;
             version=&quot;4&quot;
             label=&quot;1.03.004&quot;/&gt;
   </pre>
  @@ -277,8 +275,7 @@
     <tr>
        <td>vsspath</td>
        <td>SourceSafe path which specifies the project/file(s) you wish to
  -         perform the action on. You should not specify the leading dollar-sign -
  -         it is prepended by Ant automatically.</td>
  +         perform the action on.</td>
        <td>Yes</td>
     </tr>
     <tr>
  @@ -368,7 +365,7 @@
   <h3>Examples</h3>
   <blockquote>
     <pre>
  -&lt;vsshistory vsspath=&quot;/myProject&quot; recursive=&quot;true&quot;
  +&lt;vsshistory vsspath=&quot;$/myProject&quot; recursive=&quot;true&quot;
               fromLabel=&quot;Release1&quot;
               toLabel=&quot;Release2&quot;/&gt;
   </pre>
  @@ -377,7 +374,7 @@
   
   <blockquote>
     <pre>
  -&lt;vsshistory vsspath=&quot;/myProject&quot; recursive=&quot;true&quot;
  +&lt;vsshistory vsspath=&quot;$/myProject&quot; recursive=&quot;true&quot;
               fromDate=&quot;01.01.2001&quot;
               toDate=&quot;31.03.2001&quot;/&gt;
   </pre>
  @@ -390,7 +387,7 @@
     &lt;format property=&quot;to.tstamp&quot; pattern=&quot;M-d-yy;h:mma&quot; /&gt;
   &lt;/tstamp&gt;
   
  -&lt;vsshistory vsspath=&quot;/myProject&quot; recursive=&quot;true&quot;
  +&lt;vsshistory vsspath=&quot;$/myProject&quot; recursive=&quot;true&quot;
               numDays=&quot;-14&quot;
               dateFormat=&quot;M-d-yy;h:mma&quot;
               toDate=&quot;${to.tstamp}&quot;/&gt;
  @@ -414,8 +411,7 @@
     <tr>
        <td>vsspath</td>
        <td>SourceSafe path which specifies the project/file(s) you wish to
  -         perform the action on. You should not specify the leading dollar-sign -
  -         it is prepended by Ant automatically.</td>
  +         perform the action on.</td>
        <td>Yes</td>
     </tr>
     <tr>
  @@ -467,12 +463,12 @@
   <h3>Examples</h3>
   <blockquote>
   <pre>
  -&lt;vsscheckin vsspath=&quot;/test/test*&quot;
  +&lt;vsscheckin vsspath=&quot;$/test/test*&quot;
               localpath=&quot;D:\build\&quot;
               comment=&quot;Modified by automatic build&quot;/&gt;
   </pre>
   </blockquote>
  -<p>Checks in the file(s) named <i>test*</i> in the project <i>test</i> using
  +<p>Checks in the file(s) named <i>test*</i> in the project <i>$/test</i> using
   the local directory <i>D:\build</i>.</p>
   <hr>
   
  @@ -493,8 +489,7 @@
     <tr>
        <td>vsspath</td>
        <td>SourceSafe path which specifies the project/file(s) you wish to
  -         perform the action on. You should not specify the leading dollar-sign -
  -         it is prepended by Ant automatically.</td>
  +         perform the action on.</td>
        <td>Yes</td>
     </tr>
     <tr>
  @@ -549,13 +544,13 @@
   <h3>Examples</h3>
   <blockquote>
   <pre>
  -&lt;vsscheckout vsspath=&quot;/test&quot;
  +&lt;vsscheckout vsspath=&quot;$/test&quot;
                localpath=&quot;D:\build&quot;
                recursive=&quot;true&quot;
                login=&quot;me,mypass&quot;/&gt;
   </pre>
   </blockquote>
  -<p>Does a recursive checkout of the project test to the directory D:\build.
  +<p>Does a recursive checkout of the project <i>$/test</i> to the directory D:\build.
   </p>
   <hr>
   
  @@ -644,8 +639,7 @@
     <tr>
        <td>vsspath</td>
        <td>SourceSafe path which specifies the project you wish to
  -         make the current project. You should not specify the leading dollar-sign -
  -         it is prepended by Ant automatically.</td>
  +         make the current project.</td>
        <td>Yes</td>
     </tr>
     <tr>
  @@ -672,7 +666,7 @@
   <h3>Examples</h3>
   <blockquote>
   <pre>
  -&lt;vsscp vsspath=&quot;/Projects/ant&quot;/&gt;
  +&lt;vsscp vsspath=&quot;$/Projects/ant&quot;/&gt;
   </pre>
   </blockquote>
   <p>Sets the current VSS project to <i>$/Projects/ant</i>.</p>
  @@ -730,7 +724,7 @@
   <h3>Examples</h3>
   <blockquote>
   <pre>
  -&lt;vsscreate vsspath=&quot;/existingProject/newProject&quot;/&gt;
  +&lt;vsscreate vsspath=&quot;$/existingProject/newProject&quot;/&gt;
   </pre>
   </blockquote>
   <p>Creates the VSS-Project <i>$/existingProject/newProject</i>.</p>
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/sos/sos.xml
  
  Index: sos.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project name="sos-test" basedir="." default="sosget.1">
  
      <!--
      ===========================================================================
       Test SOSGet missing attributes
      ===========================================================================
      -->
      <target name="sosget.1">
          <sosget/>
      </target>
  
      <target name="sosget.2">
          <sosget sosserverpath="192.168.0.1:8888"/>
      </target>
  
      <target name="sosget.3">
          <sosget sosserverpath="192.168.0.1:8888"
              username="ant"/>
      </target>
  
      <target name="sosget.4">
          <sosget sosserverpath="192.168.0.1:8888"
              username="ant"
              vssserverpath="\\server\vss\srcsafe.ini"/>
      </target>
  
      <!--
      ===========================================================================
       Test SOSCheckin missing attributes
      ===========================================================================
      -->
      <target name="soscheckin.1">
          <soscheckin/>
      </target>
  
      <target name="soscheckin.2">
          <soscheckin sosserverpath="192.168.0.1:8888"/>
      </target>
  
      <target name="soscheckin.3">
          <soscheckin sosserverpath="192.168.0.1:8888"
              username="ant"/>
      </target>
  
      <target name="soscheckin.4">
          <soscheckin sosserverpath="192.168.0.1:8888"
              username="ant"
              vssserverpath="\\server\vss\srcsafe.ini"/>
      </target>
  
      <!--
      ===========================================================================
       Test SOSCheckout missing attributes
      ===========================================================================
      -->
      <target name="soscheckout.1">
          <soscheckout/>
      </target>
  
      <target name="soscheckout.2">
          <soscheckout sosserverpath="192.168.0.1:8888"/>
      </target>
  
      <target name="soscheckout.3">
          <soscheckout sosserverpath="192.168.0.1:8888"
              username="ant"/>
      </target>
  
      <target name="soscheckout.4">
          <soscheckout sosserverpath="192.168.0.1:8888"
              username="ant"
              vssserverpath="\\server\vss\srcsafe.ini"/>
      </target>
  
      <!--
      ===========================================================================
       Test SOSLabel missing attributes
      ===========================================================================
      -->
      <target name="soslabel.1">
          <soslabel/>
      </target>
  
      <target name="soslabel.2">
          <soslabel sosserverpath="192.168.0.1:8888"/>
      </target>
  
      <target name="soslabel.3">
          <soslabel sosserverpath="192.168.0.1:8888"
              username="ant"/>
      </target>
  
      <target name="soslabel.4">
          <soslabel sosserverpath="192.168.0.1:8888"
              username="ant"
              vssserverpath="\\server\vss\srcsafe.ini"/>
      </target>
  
      <target name="soslabel.5">
          <soslabel sosserverpath="192.168.0.1:8888"
              username="ant"
              vssserverpath="\\server\vss\srcsafe.ini"
              projectpath="/SourceRoot/Project"/>
      </target>
  
  </project>
  
  
  
  1.11      +5 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
  
  Index: SOS.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SOS.java	25 Jul 2002 15:21:20 -0000	1.10
  +++ SOS.java	26 Sep 2002 13:28:41 -0000	1.11
  @@ -175,7 +175,11 @@
        * @param  projectpath  The new projectPath value
        */
       public final void setProjectPath(String projectpath) {
  -        projectPath = SOSCmd.PROJECT_PREFIX + projectpath;
  +        if (projectpath.startsWith(SOSCmd.PROJECT_PREFIX)) {
  +            projectPath = projectpath;
  +        } else {
  +            projectPath = SOSCmd.PROJECT_PREFIX + projectpath;
  +        }
       }
   
   
  
  
  
  1.24      +9 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  
  Index: MSVSS.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- MSVSS.java	25 Jul 2002 15:21:20 -0000	1.23
  +++ MSVSS.java	26 Sep 2002 13:28:41 -0000	1.24
  @@ -143,10 +143,17 @@
        * @param vssPath
        */
       public final void setVsspath(String vssPath) {
  +        String projectPath;
           if (vssPath.startsWith("vss://")) {
  -            m_vssPath = PROJECT_PREFIX + vssPath.substring(5);
  +            projectPath = vssPath.substring(5);
           } else {
  -            m_vssPath = PROJECT_PREFIX + vssPath;
  +            projectPath = vssPath;
  +        }
  +
  +        if (projectPath.charAt(0) == '$') {
  +            m_vssPath = projectPath;
  +        } else {
  +            m_vssPath = PROJECT_PREFIX + projectPath;
           }
       }
   
  
  
  
  1.4       +141 -466  jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
  
  Index: SOSTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SOSTest.java	4 Feb 2002 11:03:04 -0000	1.3
  +++ SOSTest.java	26 Sep 2002 13:28:41 -0000	1.4
  @@ -53,32 +53,29 @@
    */
   package org.apache.tools.ant.taskdefs.optional.sos;
   
  -import junit.framework.TestCase;
  -import junit.framework.AssertionFailedError;
  -import org.apache.tools.ant.Project;
  +import java.io.File;
  +
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.BuildFileTest;
  +import org.apache.tools.ant.Project;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.Path;
   import org.apache.tools.ant.util.FileUtils;
  -import org.apache.tools.ant.taskdefs.optional.sos.*;
  -import java.io.File;
   
   /**
  - * Basic testcase to ensure that command line generation is ok
  - * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a>
  + *  Testcase to ensure that command line generation and required attributes are
  + *  correct.
  + *
  + * @author    <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a>
    */
  -public class SOSTest extends TestCase {
  +public class SOSTest extends BuildFileTest {
   
  -    private SOSGet sosGet;
  -    private SOSCheckin sosCheckin;
  -    private SOSCheckout sosCheckout;
  -    private SOSLabel sosLabel;
       private Project project;
       private Commandline commandline;
  -    private FileUtils fileUtils;
   
       private static final String VSS_SERVER_PATH = "\\\\server\\vss\\srcsafe.ini";
       private static final String VSS_PROJECT_PATH = "/SourceRoot/Project";
  +    private static final String DS_VSS_PROJECT_PATH = "$/SourceRoot/Project";
       private static final String SOS_SERVER_PATH = "192.168.0.1:8888";
       private static final String SOS_USERNAME = "ant";
       private static final String SOS_PASSWORD = "rocks";
  @@ -89,41 +86,50 @@
       private static final String SOS_HOME = "/home/user/.sos";
       private static final String VERSION = "007";
   
  +    /**
  +     *  Constructor for the SOSTest object
  +     *
  +     * @param  s  Test name
  +     */
       public SOSTest(String s) {
           super(s);
       }
   
  -    protected void setUp() throws Exception {
  -        sosGet = new SOSGet();
  -        sosCheckin = new SOSCheckin();
  -        sosCheckout = new SOSCheckout();
  -        sosLabel = new SOSLabel();
  +    /**
  +     *  The JUnit setup method
  +     *
  +     * @throws  Exception
  +     */
  +    protected void setUp()
  +        throws Exception {
           project = new Project();
           project.setBasedir(".");
  -        fileUtils = FileUtils.newFileUtils();
       }
   
  -    protected void tearDown() throws Exception {
  +    /**
  +     *  The teardown method for JUnit
  +     *
  +     * @throws  Exception
  +     */
  +    protected void tearDown()
  +        throws Exception {
           File file = new File(project.getBaseDir(), LOCAL_PATH);
           if (file.exists()) {
               file.delete();
           }
  -	}
  +    }
   
  -    /**
  -     * Test SOSGetFile flags & commandline generation
  -     */
  +    /**  Test SOSGetFile flags & commandline generation  */
       public void testGetFileFlags() {
  -        String[] sTestCmdLine = { "soscmd", "-command", "GetFile", "-file",
  -            SRC_FILE, "-revision", "007", "-server", SOS_SERVER_PATH, "-name",
  -            SOS_USERNAME, "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH,
  -            "-project", "$"+VSS_PROJECT_PATH, "-verbose", "-nocompress",
  -            "-nocache", "-workdir", project.getBaseDir().getAbsolutePath()
  -			+ File.separator + LOCAL_PATH };
  -
  -        Path path = new Path(project, LOCAL_PATH);
  +        String[] sTestCmdLine = {"soscmd", "-command", "GetFile", "-file",
  +                SRC_FILE, "-revision", "007", "-server", SOS_SERVER_PATH, "-name",
  +                SOS_USERNAME, "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH,
  +                "-project", DS_VSS_PROJECT_PATH, "-verbose", "-nocompress",
  +                "-nocache", "-workdir", project.getBaseDir().getAbsolutePath()
  +                 + File.separator + LOCAL_PATH};
   
           // Set up a SOSGet task
  +        SOSGet sosGet = new SOSGet();
           sosGet.setProject(project);
           sosGet.setVssServerPath(VSS_SERVER_PATH);
           sosGet.setSosServerPath(SOS_SERVER_PATH);
  @@ -132,46 +138,31 @@
           sosGet.setUsername(SOS_USERNAME);
           sosGet.setPassword(SOS_PASSWORD);
           sosGet.setVersion(VERSION);
  -        sosGet.setLocalPath(path);
  +        sosGet.setLocalPath(new Path(project, LOCAL_PATH));
           sosGet.setNoCache(true);
           sosGet.setNoCompress(true);
           sosGet.setVerbose(true);
           sosGet.setRecursive(true);
   
           commandline = sosGet.buildCmdLine();
  -        String[] sGeneratedCmdLine = commandline.getCommandline();
  -        int i = 0;
  -        while (i < sTestCmdLine.length) {
  -            try {
  -                assertEquals("GetFile arg # " + String.valueOf(i),
  -                                sTestCmdLine[i],
  -                                sGeneratedCmdLine[i]);
  -                i++;
  -            } catch (ArrayIndexOutOfBoundsException aioob) {
  -               fail("GetFile missing arg");
  -            }
   
  -        }
  -        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  -            // We have extra elements
  -            fail("GetFile extra args");
  -        }
  +        checkCommandLines(sTestCmdLine, commandline.getCommandline());
       }
   
  -    /**
  -     * Test SOSGetProject flags & commandline generation
  -     */
  +    /**  Test SOSGetProject flags & commandline generation  */
       public void testGetProjectFlags() {
  -        String[] sTestCmdLine = { "soscmd", "-command", "GetProject", "-recursive",
  -            "-label", SRC_LABEL, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  -            "-password", "", "-database", VSS_SERVER_PATH , "-project",
  -            "$"+VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
  -            project.getBaseDir().getAbsolutePath() };
  +        String[] sTestCmdLine = {"soscmd", "-command", "GetProject", "-recursive",
  +                "-label", SRC_LABEL, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  +                "-password", "", "-database", VSS_SERVER_PATH, "-project",
  +                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
  +                project.getBaseDir().getAbsolutePath()};
  +
           // Set up a SOSGet task
  +        SOSGet sosGet = new SOSGet();
           sosGet.setProject(project);
           sosGet.setVssServerPath(VSS_SERVER_PATH);
           sosGet.setSosServerPath(SOS_SERVER_PATH);
  -        sosGet.setProjectPath(VSS_PROJECT_PATH);
  +        sosGet.setProjectPath(DS_VSS_PROJECT_PATH);
           sosGet.setLabel(SRC_LABEL);
           sosGet.setUsername(SOS_USERNAME);
           sosGet.setSosHome(SOS_HOME);
  @@ -181,105 +172,30 @@
           sosGet.setRecursive(true);
   
           commandline = sosGet.buildCmdLine();
  -        String[] sGeneratedCmdLine = commandline.getCommandline();
   
  -        int i = 0;
  -        while (i < sTestCmdLine.length) {
  -            try {
  -                assertEquals("GetProject arg # " + String.valueOf(i),
  -                                sTestCmdLine[i],
  -                                sGeneratedCmdLine[i]);
  -                i++;
  -            } catch (ArrayIndexOutOfBoundsException aioob) {
  -                fail("GetProject missing arg");
  -            }
  -
  -        }
  -        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  -            // We have extra elements
  -            fail("GetProject extra args");
  -        }
  +        checkCommandLines(sTestCmdLine, commandline.getCommandline());
       }
   
  -    /**
  -     * Test SOSGet required attributes 1 by 1
  -     */
  +    /**  Tests SOSGet required attributes.  */
       public void testGetExceptions() {
  -        boolean buildEx = false;
  -
  -        // Set up a SOSGet task
  -        sosGet.setProject(project);
  -        // No options set - SosServerPath should fail
  -        try {
  -            commandline = sosGet.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("sosserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("GetException SosServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set SosServerPath - Username should fail
  -        sosGet.setSosServerPath(SOS_SERVER_PATH);
  -        try {
  -            commandline = sosGet.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("username attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("GetException Username", buildEx);
  -        buildEx = false;
  -
  -        // Set Username - VssServerPath should fail
  -        sosGet.setUsername(SOS_USERNAME);
  -        try {
  -            commandline = sosGet.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("vssserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("GetException VssServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set VssServerPath - ProjectPath should fail
  -        sosGet.setVssServerPath(VSS_SERVER_PATH);
  -        try {
  -            commandline = sosGet.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("projectpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("GetException ProjectPath", buildEx);
  -
  -        // Set ProjectPath - All required options set
  -        sosGet.setProjectPath(VSS_PROJECT_PATH);
  -        try {
  -            commandline = sosGet.buildCmdLine();
  -            buildEx = true;
  -        } catch (BuildException be) {
  -            buildEx = false;
  -        }
  -        assertTrue("GetException All required options set", buildEx);
  +        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
  +        expectSpecificBuildException("sosget.1", "some cause", "sosserverpath attribute must be set!");
  +        expectSpecificBuildException("sosget.2", "some cause", "username attribute must be set!");
  +        expectSpecificBuildException("sosget.3", "some cause", "vssserverpath attribute must be set!");
  +        expectSpecificBuildException("sosget.4", "some cause", "projectpath attribute must be set!");
       }
   
  -    /**
  -     * Test CheckInFile option flags
  -     */
  +    /**  Test CheckInFile option flags  */
       public void testCheckinFileFlags() {
  -        String[] sTestCmdLine = { "soscmd", "-command", "CheckInFile", "-file",
  -            SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  -            "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
  -            "$"+VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
  -            "-workdir", project.getBaseDir().getAbsolutePath() + File.separator
  -			+ LOCAL_PATH, "-log", SRC_COMMENT };
  -
  -        Path path = new Path(project, LOCAL_PATH);
  +        String[] sTestCmdLine = {"soscmd", "-command", "CheckInFile", "-file",
  +                SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  +                "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
  +                DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
  +                "-workdir", project.getBaseDir().getAbsolutePath() + File.separator
  +                 + LOCAL_PATH, "-log", SRC_COMMENT};
   
           // Set up a SOSCheckin task
  +        SOSCheckin sosCheckin = new SOSCheckin();
           sosCheckin.setProject(project);
           sosCheckin.setVssServerPath(VSS_SERVER_PATH);
           sosCheckin.setSosServerPath(SOS_SERVER_PATH);
  @@ -288,48 +204,31 @@
           sosCheckin.setComment(SRC_COMMENT);
           sosCheckin.setUsername(SOS_USERNAME);
           sosCheckin.setPassword(SOS_PASSWORD);
  -        sosCheckin.setLocalPath(path);
  +        sosCheckin.setLocalPath(new Path(project, LOCAL_PATH));
           sosCheckin.setNoCache(true);
           sosCheckin.setNoCompress(true);
           sosCheckin.setVerbose(true);
           sosCheckin.setRecursive(true);
   
           commandline = sosCheckin.buildCmdLine();
  -        String[] sGeneratedCmdLine = commandline.getCommandline();
  -
  -        int i = 0;
  -        while (i < sTestCmdLine.length) {
  -            try {
  -                assertEquals("CheckInFile arg # " + String.valueOf(i),
  -                                sTestCmdLine[i],
  -                                sGeneratedCmdLine[i]);
  -                i++;
  -            } catch (ArrayIndexOutOfBoundsException aioob) {
  -                fail("CheckInFile missing arg");
  -            }
   
  -        }
  -        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  -            // We have extra elements
  -            fail("CheckInFile extra args");
  -        }
  +        checkCommandLines(sTestCmdLine, commandline.getCommandline());
       }
   
  -    /**
  -     * Test CheckInProject option flags
  -     */
  +    /**  Test CheckInProject option flags  */
       public void testCheckinProjectFlags() {
  -        String[] sTestCmdLine = { "soscmd", "-command", "CheckInProject",
  -            "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  -            "-password", "", "-database", VSS_SERVER_PATH , "-project",
  -            "$"+VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
  -            project.getBaseDir().getAbsolutePath(), "-log", SRC_COMMENT,  };
  +        String[] sTestCmdLine = {"soscmd", "-command", "CheckInProject",
  +                "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  +                "-password", "", "-database", VSS_SERVER_PATH, "-project",
  +                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
  +                project.getBaseDir().getAbsolutePath(), "-log", SRC_COMMENT,};
   
           // Set up a SOSCheckin task
  +        SOSCheckin sosCheckin = new SOSCheckin();
           sosCheckin.setProject(project);
           sosCheckin.setVssServerPath(VSS_SERVER_PATH);
           sosCheckin.setSosServerPath(SOS_SERVER_PATH);
  -        sosCheckin.setProjectPath(VSS_PROJECT_PATH);
  +        sosCheckin.setProjectPath(DS_VSS_PROJECT_PATH);
           sosCheckin.setComment(SRC_COMMENT);
           sosCheckin.setUsername(SOS_USERNAME);
           sosCheckin.setSosHome(SOS_HOME);
  @@ -339,150 +238,58 @@
           sosCheckin.setRecursive(true);
   
           commandline = sosCheckin.buildCmdLine();
  -        String[] sGeneratedCmdLine = commandline.getCommandline();
  -
  -        int i = 0;
  -        while (i < sTestCmdLine.length) {
  -            try {
  -                assertEquals("CheckInProject arg # " + String.valueOf(i),
  -                                sTestCmdLine[i],
  -                                sGeneratedCmdLine[i]);
  -                i++;
  -            } catch (ArrayIndexOutOfBoundsException aioob) {
  -                fail("CheckInProject missing arg");
  -            }
   
  -        }
  -        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  -            // We have extra elements
  -            fail("CheckInProject extra args");
  -        }
  +        checkCommandLines(sTestCmdLine, commandline.getCommandline());
       }
   
  -    /**
  -     * Test SOSCheckIn required attributes 1 by 1
  -     */
  +    /**  Test SOSCheckIn required attributes.  */
       public void testCheckinExceptions() {
  -        boolean buildEx = false;
  -
  -        // Set up a sosCheckin task
  -        sosCheckin.setProject(project);
  -        // No options set - SosServerPath should fail
  -        try {
  -            commandline = sosCheckin.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("sosserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckinException SosServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set SosServerPath - Username should fail
  -        sosCheckin.setSosServerPath(SOS_SERVER_PATH);
  -        try {
  -            commandline = sosCheckin.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("username attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckinException Username", buildEx);
  -        buildEx = false;
  -
  -        // Set Username - VssServerPath should fail
  -        sosCheckin.setUsername(SOS_USERNAME);
  -        try {
  -            commandline = sosCheckin.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("vssserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckinException VssServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set VssServerPath - ProjectPath should fail
  -        sosCheckin.setVssServerPath(VSS_SERVER_PATH);
  -        try {
  -            commandline = sosCheckin.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("projectpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckinException ProjectPath", buildEx);
  -
  -        // Set ProjectPath - All required options set
  -        sosCheckin.setProjectPath(VSS_PROJECT_PATH);
  -        try {
  -            commandline = sosCheckin.buildCmdLine();
  -            buildEx = true;
  -        } catch (BuildException be) {
  -            buildEx = false;
  -        }
  -        assertTrue("CheckinException All required options set", buildEx);
  +        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
  +        expectSpecificBuildException("soscheckin.1", "some cause", "sosserverpath attribute must be set!");
  +        expectSpecificBuildException("soscheckin.2", "some cause", "username attribute must be set!");
  +        expectSpecificBuildException("soscheckin.3", "some cause", "vssserverpath attribute must be set!");
  +        expectSpecificBuildException("soscheckin.4", "some cause", "projectpath attribute must be set!");
       }
   
  -    /**
  -     * Test CheckOutFile option flags
  -     */
  +    /**  Test CheckOutFile option flags  */
       public void testCheckoutFileFlags() {
  -        String[] sTestCmdLine = { "soscmd", "-command", "CheckOutFile", "-file",
  -            SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  -            "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
  -            "$"+VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
  -            "-workdir", project.getBaseDir().getAbsolutePath()
  -			+ File.separator + LOCAL_PATH };
  -
  -        Path path = new Path(project, LOCAL_PATH);
  +        String[] sTestCmdLine = {"soscmd", "-command", "CheckOutFile", "-file",
  +                SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  +                "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
  +                DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
  +                "-workdir", project.getBaseDir().getAbsolutePath()
  +                 + File.separator + LOCAL_PATH};
   
           // Set up a SOSCheckout task
  +        SOSCheckout sosCheckout = new SOSCheckout();
           sosCheckout.setProject(project);
           sosCheckout.setVssServerPath(VSS_SERVER_PATH);
           sosCheckout.setSosServerPath(SOS_SERVER_PATH);
  -        sosCheckout.setProjectPath(VSS_PROJECT_PATH);
  +        sosCheckout.setProjectPath(DS_VSS_PROJECT_PATH);
           sosCheckout.setFile(SRC_FILE);
           sosCheckout.setUsername(SOS_USERNAME);
           sosCheckout.setPassword(SOS_PASSWORD);
  -        sosCheckout.setLocalPath(path);
  +        sosCheckout.setLocalPath(new Path(project, LOCAL_PATH));
           sosCheckout.setNoCache(true);
           sosCheckout.setNoCompress(true);
           sosCheckout.setVerbose(true);
           sosCheckout.setRecursive(true);
   
           commandline = sosCheckout.buildCmdLine();
  -        String[] sGeneratedCmdLine = commandline.getCommandline();
  -
  -        int i = 0;
  -        while (i < sTestCmdLine.length) {
  -            try {
  -                assertEquals("CheckOutFile arg # " + String.valueOf(i),
  -                                sTestCmdLine[i],
  -                                sGeneratedCmdLine[i]);
  -                i++;
  -            } catch (ArrayIndexOutOfBoundsException aioob) {
  -                fail("CheckOutFile missing arg");
  -            }
   
  -        }
  -        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  -            // We have extra elements
  -            fail("CheckOutFile extra args");
  -        }
  +        checkCommandLines(sTestCmdLine, commandline.getCommandline());
       }
   
  -    /**
  -     * Test CheckOutProject option flags
  -     */
  +    /**  Test CheckOutProject option flags  */
       public void testCheckoutProjectFlags() {
  -        String[] sTestCmdLine = { "soscmd", "-command", "CheckOutProject",
  -            "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  -            "-password", "", "-database", VSS_SERVER_PATH , "-project",
  -            "$"+VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
  -            project.getBaseDir().getAbsolutePath() };
  +        String[] sTestCmdLine = {"soscmd", "-command", "CheckOutProject",
  +                "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
  +                "-password", "", "-database", VSS_SERVER_PATH, "-project",
  +                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
  +                project.getBaseDir().getAbsolutePath()};
   
           // Set up a sosCheckout task
  +        SOSCheckout sosCheckout = new SOSCheckout();
           sosCheckout.setProject(project);
           sosCheckout.setVssServerPath(VSS_SERVER_PATH);
           sosCheckout.setSosServerPath(SOS_SERVER_PATH);
  @@ -495,104 +302,31 @@
           sosCheckout.setRecursive(true);
   
           commandline = sosCheckout.buildCmdLine();
  -        String[] sGeneratedCmdLine = commandline.getCommandline();
   
  -        int i = 0;
  -        while (i < sTestCmdLine.length) {
  -            try {
  -                assertEquals("CheckOutProject arg # " + String.valueOf(i),
  -                                sTestCmdLine[i],
  -                                sGeneratedCmdLine[i]);
  -                i++;
  -            } catch (ArrayIndexOutOfBoundsException aioob) {
  -                fail("CheckOutProject missing arg");
  -            }
  -
  -        }
  -        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  -            // We have extra elements
  -            fail("CheckOutProject extra args");
  -        }
  +        checkCommandLines(sTestCmdLine, commandline.getCommandline());
       }
   
  -    /**
  -     * Test SOSCheckout required attributes 1 by 1
  -     */
  +    /**  Test SOSCheckout required attributes.  */
       public void testCheckoutExceptions() {
  -        boolean buildEx = false;
  -
  -        // Set up a sosCheckout task
  -        sosCheckout.setProject(project);
  -        // No options set - SosServerPath should fail
  -        try {
  -            commandline = sosCheckout.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("sosserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckoutException SosServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set SosServerPath - Username should fail
  -        sosCheckout.setSosServerPath(SOS_SERVER_PATH);
  -        try {
  -            commandline = sosCheckout.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("username attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckoutException Username", buildEx);
  -        buildEx = false;
  -
  -        // Set Username - VssServerPath should fail
  -        sosCheckout.setUsername(SOS_USERNAME);
  -        try {
  -            commandline = sosCheckout.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("vssserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckoutException VssServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set VssServerPath - ProjectPath should fail
  -        sosCheckout.setVssServerPath(VSS_SERVER_PATH);
  -        try {
  -            commandline = sosCheckout.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("projectpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("CheckoutException ProjectPath", buildEx);
  -
  -        // Set ProjectPath - All required options set
  -        sosCheckout.setProjectPath(VSS_PROJECT_PATH);
  -        try {
  -            commandline = sosCheckout.buildCmdLine();
  -            buildEx = true;
  -        } catch (BuildException be) {
  -            buildEx = false;
  -        }
  -        assertTrue("CheckoutException All required options set", buildEx);
  +        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
  +        expectSpecificBuildException("soscheckout.1", "some cause", "sosserverpath attribute must be set!");
  +        expectSpecificBuildException("soscheckout.2", "some cause", "username attribute must be set!");
  +        expectSpecificBuildException("soscheckout.3", "some cause", "vssserverpath attribute must be set!");
  +        expectSpecificBuildException("soscheckout.4", "some cause", "projectpath attribute must be set!");
       }
   
  -    /**
  -     * Test Label option flags
  -     */
  +    /**  Test Label option flags  */
       public void testLabelFlags() {
  -        String[] sTestCmdLine = { "soscmd", "-command", "AddLabel", "-server",
  -            SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", "", "-database",
  -            VSS_SERVER_PATH , "-project", "$"+VSS_PROJECT_PATH, "-label",
  -            SRC_LABEL, "-verbose", "-log", SRC_COMMENT };
  +        String[] sTestCmdLine = {"soscmd", "-command", "AddLabel", "-server",
  +                SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", "", "-database",
  +                VSS_SERVER_PATH, "-project", DS_VSS_PROJECT_PATH, "-label",
  +                SRC_LABEL, "-verbose", "-log", SRC_COMMENT};
   
           // Set up a sosCheckout task
  +        SOSLabel sosLabel = new SOSLabel();
           sosLabel.setVssServerPath(VSS_SERVER_PATH);
           sosLabel.setSosServerPath(SOS_SERVER_PATH);
  -        sosLabel.setProjectPath(VSS_PROJECT_PATH);
  +        sosLabel.setProjectPath(DS_VSS_PROJECT_PATH);
           sosLabel.setUsername(SOS_USERNAME);
           sosLabel.setSosHome(SOS_HOME);
           sosLabel.setComment(SRC_COMMENT);
  @@ -602,100 +336,41 @@
           sosLabel.setVerbose(true);
   
           commandline = sosLabel.buildCmdLine();
  -        String[] sGeneratedCmdLine = commandline.getCommandline();
  -
  -        int i = 0;
  -        while (i < sTestCmdLine.length) {
  -            try {
  -                assertEquals("AddLabel arg # " + String.valueOf(i),
  -                                sTestCmdLine[i],
  -                                sGeneratedCmdLine[i]);
  -                i++;
  -            } catch (ArrayIndexOutOfBoundsException aioob) {
  -                fail("AddLabel missing arg");
  -            }
   
  -        }
  -        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  -            // We have extra elements
  -            fail("AddLabel extra args");
  -        }
  +        checkCommandLines(sTestCmdLine, commandline.getCommandline());
       }
   
  -    /**
  -     * Test SOSLabel required attributes 1 by 1
  -     */
  +    /**  Test SOSLabel required attributes.  */
       public void testLabelExceptions() {
  -        boolean buildEx = false;
  -
  -        // Set up a sosLabel task
  -        sosLabel.setProject(project);
  -        // No options set - SosServerPath should fail
  -        try {
  -            commandline = sosLabel.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("sosserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("LabelException SosServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set SosServerPath - Username should fail
  -        sosLabel.setSosServerPath(SOS_SERVER_PATH);
  -        try {
  -            commandline = sosLabel.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("username attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("LabelException Username", buildEx);
  -        buildEx = false;
  -
  -        // Set Username - VssServerPath should fail
  -        sosLabel.setUsername(SOS_USERNAME);
  -        try {
  -            commandline = sosLabel.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("vssserverpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("LabelException VssServerPath", buildEx);
  -        buildEx = false;
  -
  -        // Set VssServerPath - ProjectPath should fail
  -        sosLabel.setVssServerPath(VSS_SERVER_PATH);
  -        try {
  -            commandline = sosLabel.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("projectpath attribute must be set!") == 0) {
  -                buildEx = true;
  -            }
  -        }
  -        assertTrue("LabelException ProjectPath", buildEx);
  +        configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
  +        expectSpecificBuildException("soslabel.1", "some cause", "sosserverpath attribute must be set!");
  +        expectSpecificBuildException("soslabel.2", "some cause", "username attribute must be set!");
  +        expectSpecificBuildException("soslabel.3", "some cause", "vssserverpath attribute must be set!");
  +        expectSpecificBuildException("soslabel.4", "some cause", "projectpath attribute must be set!");
  +        expectSpecificBuildException("soslabel.5", "some cause", "label attribute must be set!");
  +    }
   
  -        // Set ProjectPath - Label should fail
  -        sosLabel.setProjectPath(VSS_PROJECT_PATH);
  -        try {
  -            commandline = sosLabel.buildCmdLine();
  -        } catch (BuildException be) {
  -            if (be.getMessage().compareTo("label attribute must be set!") == 0) {
  -                buildEx = true;
  +    /**
  +     *  Iterate through the generated command line comparing it to reference
  +     *  one.
  +     *
  +     * @param  sTestCmdLine       The reference command line;
  +     * @param  sGeneratedCmdLine  The generated command line;
  +     */
  +    private void checkCommandLines(String[] sTestCmdLine, String[] sGeneratedCmdLine) {
  +        int length = sTestCmdLine.length;
  +        for (int i = 0; i < length; i++) {
  +            try {
  +                assertEquals("arg # " + String.valueOf(i),
  +                        sTestCmdLine[i],
  +                        sGeneratedCmdLine[i]);
  +            } catch (ArrayIndexOutOfBoundsException aioob) {
  +                fail("missing arg " + sTestCmdLine[i]);
               }
           }
  -        assertTrue("LabelException Label", buildEx);
  -
  -        // Set Label - All required options set
  -        sosLabel.setLabel(SRC_LABEL);
  -        try {
  -            commandline = sosLabel.buildCmdLine();
  -            buildEx = true;
  -        } catch (BuildException be) {
  -            buildEx = false;
  +        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
  +            // We have extra elements
  +            fail("extra args");
           }
  -        assertTrue("LabelException All required options set", buildEx);
       }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message