The sos.html file is slightly out of synch with the actual attributes - but Jesse will submit updated documentation soon. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271021 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -0,0 +1,531 @@ | |||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |||||
| <html> | |||||
| <head> | |||||
| <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | |||||
| <title>Ant User Manual</title> | |||||
| </head> | |||||
| <body> | |||||
| <div align="center"> | |||||
| <h1>SourceOffSite Tasks User Manual</h1> | |||||
| <div align="left">by<br> | |||||
| <br> | |||||
| <ul> | |||||
| <li><a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> </li> | |||||
| </ul> | |||||
| Version 1.1 2002/01/23<br> | |||||
| <br> | |||||
| <hr width="100%" size="2"> | |||||
| <h2>Contents</h2> | |||||
| <ul> | |||||
| <li><a href="#intro">Introduction</a> </li> | |||||
| <li><a href="#tasks">The Tasks</a> </li> | |||||
| </ul> | |||||
| <br> | |||||
| <h2><a name="intro">Introduction</a> </h2> | |||||
| <p>These tasks provide an interface to the <a href="http://msdn.microsoft.com/ssafe/default.asp" target="_top"> | |||||
| Microsoft Visual SourceSafe</a> SCM via <a href="http://www.sourcegear.com"> | |||||
| SourceGear's</a> <a href="http://sourcegear.com/sos/index.htm">SourceOffSite</a> | |||||
| product. SourceOffSite is an add-on to Microsoft's VSS, that | |||||
| allows remote development teams and tele-commuters that need | |||||
| fast and secure read/write access to a centralized SourceSafe | |||||
| database via any TCP/IP connection . SOS also provides Linux & Solaris | |||||
| clients. The <code> org.apache.tools.ant.taskdefs.optional.sos</code> | |||||
| package consists of a simple framework to support SOS functionality as well | |||||
| as some Ant tasks encapsulating frequently used SOS commands. Although it | |||||
| is possible to use these commands on the desktop, they were primarily intended | |||||
| to be used by automated build systems. These tasks have been tested with | |||||
| SourceOffSite version 3.5.1 connecting to VisualSourceSafe 6.0. The tasks | |||||
| have been tested with Linux, Solaris & Windows2000</p> | |||||
| <h2><a name="tasks">The Tasks</a> </h2> | |||||
| <table border="0" cellspacing="0" cellpadding="3"> | |||||
| <tbody> | |||||
| <tr> | |||||
| <td><a href="#SOSGet">sosget</a> </td> | |||||
| <td>Retrieves a read-only copy of the specified project or file.</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td><a href="#SOSLabel"> soslabel</a> </td> | |||||
| <td>Assigns a label to the specified project.</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td><a href="#SOSCheckIn"> soscheckin</a> </td> | |||||
| <td>Updates VSS with changes made to a checked out file or project, | |||||
| and unlocks the VSS master copy.</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td><a href="#SOSCheckOut"> soscheckout</a> </td> | |||||
| <td>Retrieves a read-write copy of the specified project | |||||
| or file, locking the VSS master copy</td> | |||||
| </tr> | |||||
| </tbody> | |||||
| </table> | |||||
| <br> | |||||
| <hr width="100%" size="2"> | |||||
| <h2>Task Descriptions</h2> | |||||
| <h2><a name="SOSGet"></a> SOSGet<br> | |||||
| </h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform GET commands from Microsoft Visual SourceSafe via SOS<br> | |||||
| <h3>Parameters</h3> | |||||
| </div> | |||||
| </div> | |||||
| <table border="1"> | |||||
| <tbody> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>soscmddir</td> | |||||
| <td>Directory which contains soscmd(.exe) <br> | |||||
| soscmd(.exe) must be in the path if this is not specified</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>vssserverpath</td> | |||||
| <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>sosserverpath</td> | |||||
| <td>address & port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>projectpath</td> | |||||
| <td>SourceSafe project path without the "$"</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>file</td> | |||||
| <td>Filename to act upon<br> | |||||
| If no file is specified then act upon the project</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>username</td> | |||||
| <td>SourceSafe username</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>password</td> | |||||
| <td>SourceSafe password</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>localpath</td> | |||||
| <td>Override the working directory and get to the specified path</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>soshome</td> | |||||
| <td>The path to the SourceOffSite home directory</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>nocompression</td> | |||||
| <td>true or false - disable compression</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>recursive</td> | |||||
| <td>true or false - Only works with the GetProject command</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>version</td> | |||||
| <td>a version number to get - Only works with the GetFile command</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>label</td> | |||||
| <td>a label version to get - Only works with the GetProject command</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>nocache</td> | |||||
| <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>verbose</td> | |||||
| <td>true or false - Status messages are displayed</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </tbody> | |||||
| </table> | |||||
| <h3>Example</h3> | |||||
| <small><sosget </small><small> | |||||
| verbose="true"</small><br> | |||||
| <small> | |||||
| recursive="true"</small><br> | |||||
| <small> | |||||
| login="build"</small><br> | |||||
| <small> | |||||
| pass="build"</small><br> | |||||
| <small> | |||||
| localpath="tmp"</small><br> | |||||
| <small> | |||||
| projectpath="/SourceRoot/project1"</small><small><br> | |||||
| </small><small><small> | |||||
| <big> sosserverpath="192.168.10.6:8888"</big></small></small><br> | |||||
| <small> | |||||
| vssserverpath="d:\vss\srcsafe.ini"/></small><br> | |||||
| <small> <br> | |||||
| Connects to a SourceOffsite server on </small><small>192.168.10.6:8888</small><small> | |||||
| with build,build as the username & password</small><small> . The | |||||
| SourceSafe database resides on the same box as the SOS server & the | |||||
| VSS database is at "d:\vss\srcsafe.ini"</small><br> | |||||
| <small>Does a recursive GetProject on $</small><small>/SourceRoot/project1</small><small> | |||||
| , using tmp as the working directory.</small><br> | |||||
| <br> | |||||
| <hr width="100%" size="2"> | |||||
| <h2><a name="SOSLabel"></a> SOSLabel</h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform Label commands from Microsoft Visual SourceSafe via SOS<br> | |||||
| <h3>Parameters</h3> | |||||
| <table border="1"> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>soscmddir</td> | |||||
| <td>Directory which contains soscmd(.exe) <br> | |||||
| soscmd(.exe) must be in the path if this is not specified</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>vssserverpath</td> | |||||
| <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>sosserverpath</td> | |||||
| <td>address and port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>projectpath</td> | |||||
| <td>SourceSafe project path without the "$"</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>username</td> | |||||
| <td>SourceSafe username</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>password</td> | |||||
| <td>SourceSafe password</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>label</td> | |||||
| <td>The label to apply to a project</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>comment</td> | |||||
| <td>A comment to be applied to all files being labeled</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>verbose</td> | |||||
| <td>true or false - Status messages are displayed</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </tbody> | |||||
| </table> | |||||
| <h3>Example</h3> | |||||
| <small> <soslabel </small><small> | |||||
| login="build"</small><small><br> | |||||
| </small><small> | |||||
| pass="build"</small><small><br> | |||||
| </small><small> | |||||
| label="test | |||||
| label"</small><small><br> | |||||
| </small><small> | |||||
| projectpath="</small><small> | |||||
| /SourceRoot/project1</small><small> "</small><small><br> | |||||
| </small><small> | |||||
| sosserverpath="192.168.10.6:8888"</small><small><br> | |||||
| </small><small> | |||||
| vssserverpath="d:\vss\srcsafe.ini"/></small><small><br> | |||||
| </small><br> | |||||
| <small> Connects to a SourceOffsite server on </small><small>192.168.10.6:8888 | |||||
| </small><small>with build,build as the username & password</small><small> | |||||
| . </small><small> The SourceSafe database resides on the same box | |||||
| as the SOS server & the VSS database is at "d:\vss\srcsafe.ini"</small><br> | |||||
| <small>Labels the $</small><small>/SourceRoot/project1 project with | |||||
| </small><small> "test label".</small><br> | |||||
| <br> | |||||
| <hr width="100%" size="2"><br> | |||||
| <h2><a name="SOSCheckIn"></a> SOSCheckIn</h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform CheckIn commands from a Microsoft Visual Source Safe via SOS<br> | |||||
| <h3>Parameters</h3> | |||||
| <table border="1"> | |||||
| <tbody> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>soscmddir</td> | |||||
| <td>Directory which contains soscmd(.exe) <br> | |||||
| soscmd(.exe) must be in the path if this is not specified</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>vssserverpath</td> | |||||
| <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>sosserverpath</td> | |||||
| <td>address and port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>projectpath</td> | |||||
| <td>SourceSafe project path without the "$"</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>file</td> | |||||
| <td>Filename to act upon<br> If no file is specified then act upon the project</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>username</td> | |||||
| <td>SourceSafe username</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>password</td> | |||||
| <td>SourceSafe password</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>localpath</td> | |||||
| <td>Override the working directory and get to the specified path</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>soshome</td> | |||||
| <td>The path to the SourceOffSite home directory</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>nocompression</td> | |||||
| <td>true or false - disable compression</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>recursive</td> | |||||
| <td>true or false - Only works with the CheckOutProject command</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>nocache</td> | |||||
| <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>verbose</td> | |||||
| <td>true or false - Status messages are displayed</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <td>comment</td> | |||||
| <td>A comment to be applied to all files being checked in</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </tbody> | |||||
| </table> | |||||
| <h3>Example</h3> | |||||
| <small><soscheckin | |||||
| </small><small> login="build"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| pass="build"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| </small><small>file="foobar.txt"<br> | |||||
| | |||||
| verbose="true"</small><br> | |||||
| <small> | |||||
| | |||||
| </small><small>comment="comment abc"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| projectpath="/SourceRoot/project1"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| sosserverpath="server1:8888"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| vssserverpath="\\server2\vss\srcsafe.ini"/></small><small><br> | |||||
| </small><small><br> | |||||
| Connects to a SourceOffsite server on </small><small>server1:8888</small><small> | |||||
| with build,build as the username & password</small><small> . </small><small> | |||||
| The SourceSafe database resides on a different box (server2) | |||||
| & the VSS database is on a share called "vss"</small><br> | |||||
| <small>Checks-in only the "foobar.txt" file adding a comment of "comment | |||||
| abc"</small><small> . Extra status messages will be displayed on screen.</small><br> | |||||
| <br> | |||||
| <hr width="100%" size="2"> | |||||
| <h2><a name="SOSCheckOut"></a> SOSCheckOut</h2> | |||||
| <h3>Description</h3> | |||||
| Task to perform CheckOut commands from a Microsoft Visual Source Safe via SOS<br> | |||||
| <h3>Parameters</h3> | |||||
| <table border="1"> | |||||
| <tbody> | |||||
| <tr> | |||||
| <th>Attribute</th> | |||||
| <th>Values</th> | |||||
| <th>Required</th> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>soscmddir</td> | |||||
| <td>Directory which contains soscmd(.exe) <br> | |||||
| soscmd(.exe) must be in the path if this is not specified</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>vssserverpath</td> | |||||
| <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>sosserverpath</td> | |||||
| <td>address and port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>projectpath</td> | |||||
| <td>SourceSafe project path without the "$"</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>file</td> | |||||
| <td>Filename to act upon<br> If no file is specified then act upon the project</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>username</td> | |||||
| <td>SourceSafe username</td> | |||||
| <td>Yes</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>password</td> | |||||
| <td>SourceSafe password</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>localpath</td> | |||||
| <td>Override the working directory and get to the specified path</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>soshome</td> | |||||
| <td>The path to the SourceOffSite home directory</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>nocompression</td> | |||||
| <td>true or false - disable compression</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>recursive</td> | |||||
| <td>true or false - Only works with the CheckOutProject command</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>nocache</td> | |||||
| <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td>verbose</td> | |||||
| <td>true or false - Status messages are displayed</td> | |||||
| <td>No</td> | |||||
| </tr> | |||||
| </tbody> | |||||
| </table> | |||||
| <br> | |||||
| <h3>Example</h3> | |||||
| <small><soscheckout </small><small> soscmddir="/usr/bin"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| verbose="true"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| login="build"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| pass="build"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| ProjectPath="</small><small> /SourceRoot/project1</small><small>"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| sosserverpath="192.168.10.6:8888"</small><small><br> | |||||
| </small><small> | |||||
| | |||||
| vssserverpath="\\server2\vss\srcsafe.ini"/><small><br> | |||||
| </small></small><br> | |||||
| <small>Connects to a SourceOffsite server on </small><small>server1:8888</small><small> | |||||
| with build,build as the username & password</small><small> . </small><small> | |||||
| The SourceSafe database resides on a different box (server2) | |||||
| & the VSS database is on a share called "vss"</small><br> | |||||
| <small>Checks-out "project1" </small><small>Only the "project1" directory | |||||
| will be locked as the recursive option was not set. Extra status messages | |||||
| will be displayed on screen.</small><small> The soscmd(.exe) file to be | |||||
| used resides in /usr/bin</small><br> | |||||
| <small><br> | |||||
| </small> | |||||
| <hr width="100%" size="2"><small><br> | |||||
| </small><br> | |||||
| <br> | |||||
| <br> | |||||
| <br> | |||||
| <br> | |||||
| </body> | |||||
| </html> | |||||
| @@ -43,6 +43,7 @@ | |||||
| <a href="OptionalTasks/rpm.html">Rpm</a><br> | <a href="OptionalTasks/rpm.html">Rpm</a><br> | ||||
| <a href="OptionalTasks/script.html">Script</a><br> | <a href="OptionalTasks/script.html">Script</a><br> | ||||
| <a href="OptionalTasks/sound.html">Sound</a><br> | <a href="OptionalTasks/sound.html">Sound</a><br> | ||||
| <a href="OptionalTasks/sos.html">SourceOffSite</a><br> | |||||
| <a href="OptionalTasks/starteam.html">Starteam Tasks</a><br> | <a href="OptionalTasks/starteam.html">Starteam Tasks</a><br> | ||||
| <a href="OptionalTasks/stylebook.html">Stylebook</a><br> | <a href="OptionalTasks/stylebook.html">Stylebook</a><br> | ||||
| <a href="OptionalTasks/telnet.html">Telnet</a><br> | <a href="OptionalTasks/telnet.html">Telnet</a><br> | ||||
| @@ -135,6 +135,10 @@ p4add=org.apache.tools.ant.taskdefs.optional.perforce.P4Add | |||||
| jspc=org.apache.tools.ant.taskdefs.optional.jsp.JspC | jspc=org.apache.tools.ant.taskdefs.optional.jsp.JspC | ||||
| replaceregexp=org.apache.tools.ant.taskdefs.optional.ReplaceRegExp | replaceregexp=org.apache.tools.ant.taskdefs.optional.ReplaceRegExp | ||||
| translate=org.apache.tools.ant.taskdefs.optional.i18n.Translate | translate=org.apache.tools.ant.taskdefs.optional.i18n.Translate | ||||
| sosget=org.apache.tools.ant.taskdefs.optional.sos.SOSGet | |||||
| soscheckin=org.apache.tools.ant.taskdefs.optional.sos.SOSCheckin | |||||
| soscheckout=org.apache.tools.ant.taskdefs.optional.sos.SOSCheckout | |||||
| soslabel=org.apache.tools.ant.taskdefs.optional.sos.SOSLabel | |||||
| # deprecated ant tasks (kept for back compatibility) | # deprecated ant tasks (kept for back compatibility) | ||||
| starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut | starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut | ||||
| @@ -0,0 +1,488 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sos; | |||||
| import java.io.File; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.taskdefs.Execute; | |||||
| import org.apache.tools.ant.taskdefs.LogStreamHandler; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| /** | |||||
| * A base class for creating tasks for executing commands on SourceOffSite | |||||
| * <p> | |||||
| * The class extends the 'exec' task as it operates by executing the soscmd(.exe) program | |||||
| * supplied with SOS. By default the task expects soscmd(.exe) to be in the path, | |||||
| * you can override this be specifying the sosdir attribute. | |||||
| * </p> | |||||
| * <p> | |||||
| * This class provides set and get methods for the following attributes | |||||
| * <br> 'vssserverpath' | |||||
| * <br> 'sosserverpath' | |||||
| * <br> 'vsspath' | |||||
| * <br> 'projectpath' | |||||
| * <br> 'username' | |||||
| * <br> 'password' | |||||
| * <br> 'soscmddir' | |||||
| * <br> 'file' | |||||
| * <br> 'soshome' | |||||
| * <br> 'localpath" | |||||
| * <br> 'comment' | |||||
| * <br> 'label' | |||||
| * <br> 'version' | |||||
| * <br> 'recursive' | |||||
| * <br> 'verbose' | |||||
| * <br> 'nocache' | |||||
| * <br> 'nocompression' | |||||
| * <br> | |||||
| * It also contains constants for the flags that can be passed to SOS. | |||||
| * <p> | |||||
| * These tasks were inspired by the VSS tasks | |||||
| * | |||||
| * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> | |||||
| */ | |||||
| public abstract class SOS extends Task { | |||||
| private String sosCmdDir = null; | |||||
| private String sosUsername = null; | |||||
| private String sosPassword = ""; | |||||
| private String projectPath = null; | |||||
| private String vssServerPath = null; | |||||
| private String sosServerPath = null; | |||||
| private String sosHome = null; | |||||
| private String localPath = null; | |||||
| private String version = null; | |||||
| private String label = null; | |||||
| private String comment = null; | |||||
| private String filename = null; | |||||
| private boolean noCompress = false; | |||||
| private boolean noCache = false; | |||||
| private boolean recursive = false; | |||||
| private boolean verbose = false; | |||||
| /** | |||||
| * Disable the cache | |||||
| * | |||||
| * @param nocache The new noCache value | |||||
| */ | |||||
| public void setNoCache(boolean nocache) { | |||||
| noCache = nocache; | |||||
| } | |||||
| /** | |||||
| * Disable compression | |||||
| * | |||||
| * @param nocompress The new noCompress value | |||||
| */ | |||||
| public void setNoCompress(boolean nocompress) { | |||||
| noCompress = nocompress; | |||||
| } | |||||
| /** | |||||
| * Set the directory where soscmd(.exe) is located | |||||
| * | |||||
| * @param dir The new sosCmd value | |||||
| */ | |||||
| public final void setSosCmd(String dir) { | |||||
| sosCmdDir = project.translatePath(dir); | |||||
| } | |||||
| /** | |||||
| * Set the username to use to access SOS. | |||||
| * | |||||
| * @param username The new username value | |||||
| */ | |||||
| public final void setUsername(String username) { | |||||
| sosUsername = username; | |||||
| } | |||||
| /** | |||||
| * Set the password to use to access SOS. | |||||
| * | |||||
| * @param password The new password value | |||||
| */ | |||||
| public final void setPassword(String password) { | |||||
| sosPassword = password; | |||||
| } | |||||
| /** | |||||
| * Set the path to the item in SOS to operate on | |||||
| * <p> | |||||
| * To avoid the "$$" in th build file we add it here | |||||
| * | |||||
| * @param projectpath The new projectPath value | |||||
| */ | |||||
| public final void setProjectPath(String projectpath) { | |||||
| projectPath = SOSCmd.PROJECT_PREFIX + projectpath; | |||||
| } | |||||
| /** | |||||
| * Set the path to the location of the ss.ini | |||||
| * | |||||
| * @param vssServerPath The new vssServerPath value | |||||
| */ | |||||
| public final void setVssServerPath(String vssServerPath) { | |||||
| this.vssServerPath = vssServerPath; | |||||
| } | |||||
| /** | |||||
| * Set the path of soshome | |||||
| * | |||||
| * @param sosHome The new sosHome value | |||||
| */ | |||||
| public final void setSosHome(String sosHome) { | |||||
| this.sosHome = sosHome; | |||||
| } | |||||
| /** | |||||
| * Set the address & port of SourceOffSite Server | |||||
| * | |||||
| * @param sosServerPath The new sosServerPath value | |||||
| */ | |||||
| public final void setSosServerPath(String sosServerPath) { | |||||
| this.sosServerPath = sosServerPath; | |||||
| } | |||||
| /** | |||||
| * Set the local path. | |||||
| * | |||||
| * @param path The new localPath value | |||||
| */ | |||||
| public void setLocalPath(Path path) { | |||||
| localPath = path.toString(); | |||||
| } | |||||
| /** | |||||
| * Set the filename to get from SOS | |||||
| * | |||||
| * @param filename The new file value | |||||
| */ | |||||
| public final void setFile(String filename) { | |||||
| this.filename = filename; | |||||
| } | |||||
| /** | |||||
| * Set behaviour verbose or quiet | |||||
| * | |||||
| * @param verbose The new verbose value | |||||
| */ | |||||
| public void setVerbose(boolean verbose) { | |||||
| this.verbose = verbose; | |||||
| } | |||||
| /** | |||||
| * Set behaviour recursive or non-recursive | |||||
| * | |||||
| * @param recursive The new recursive value | |||||
| */ | |||||
| public void setRecursive(boolean recursive) { | |||||
| this.recursive = recursive; | |||||
| } | |||||
| /** | |||||
| * Set the stored version string | |||||
| * | |||||
| * @param version The new version value | |||||
| */ | |||||
| public void setVersion(String version) { | |||||
| this.version = version; | |||||
| } | |||||
| /** | |||||
| * Set the labeled version to operate on in SourceSafe | |||||
| * | |||||
| * @param label The new label value | |||||
| */ | |||||
| public void setLabel(String label) { | |||||
| this.label = label; | |||||
| } | |||||
| /** | |||||
| * Set the comment to get | |||||
| * | |||||
| * @param comment The new comment value | |||||
| */ | |||||
| public void setComment(String comment) { | |||||
| this.comment = comment; | |||||
| } | |||||
| /** | |||||
| * Get the executable to run. Add the path if it was specifed in the build file | |||||
| * | |||||
| * @return String the executable to run | |||||
| */ | |||||
| public String getSosCommand() { | |||||
| if (sosCmdDir == null) { | |||||
| return SOSCmd.COMMAND_SOS_EXE; | |||||
| } else { | |||||
| return sosCmdDir + File.separator + SOSCmd.COMMAND_SOS_EXE; | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Get the comment | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getComment() { | |||||
| return comment; | |||||
| } | |||||
| /** | |||||
| * Get the version | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getVersion() { | |||||
| return version; | |||||
| } | |||||
| /** | |||||
| * Get the label | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getLabel() { | |||||
| return label; | |||||
| } | |||||
| /** | |||||
| * Get the username | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getUsername() { | |||||
| return sosUsername; | |||||
| } | |||||
| /** | |||||
| * Get the password | |||||
| * @return String empty string if it wans't set | |||||
| */ | |||||
| public String getPassword() { | |||||
| return sosPassword; | |||||
| } | |||||
| /** | |||||
| * Get the project path | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getProjectPath() { | |||||
| return projectPath; | |||||
| } | |||||
| /** | |||||
| * Get the VSS server path | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getVssServerPath() { | |||||
| return vssServerPath; | |||||
| } | |||||
| /** | |||||
| * Get the SOS home directory | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getSosHome() { | |||||
| return sosHome; | |||||
| } | |||||
| /** | |||||
| * Get the SOS serve path | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getSosServerPath() { | |||||
| return sosServerPath; | |||||
| } | |||||
| /** | |||||
| * Get the filename to be acted upon | |||||
| * @return String if it was set, null if not | |||||
| */ | |||||
| public String getFilename() { | |||||
| return filename; | |||||
| } | |||||
| /** | |||||
| * Get the NoCompress flag | |||||
| * | |||||
| * @return String the 'nocompress' Flag if the attribute was 'true', otherwise an empty string | |||||
| */ | |||||
| public String getNoCompress() { | |||||
| if (!noCompress) { | |||||
| return ""; | |||||
| } else { | |||||
| return SOSCmd.FLAG_NO_COMPRESSION; | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Get the NoCache flag | |||||
| * | |||||
| * @return String the 'nocache' Flag if the attribute was 'true', otherwise an empty string | |||||
| */ | |||||
| public String getNoCache() { | |||||
| if (!noCache) { | |||||
| return ""; | |||||
| } else { | |||||
| return SOSCmd.FLAG_NO_CACHE; | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Get the 'verbose' Flag | |||||
| * | |||||
| * @return String the 'verbose' Flag if the attribute was 'true', otherwise an empty string | |||||
| */ | |||||
| public String getVerbose() { | |||||
| if (!verbose) { | |||||
| return ""; | |||||
| } else { | |||||
| return SOSCmd.FLAG_VERBOSE; | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Get the 'recursive' Flag | |||||
| * | |||||
| * @return String the 'recursive' Flag if the attribute was 'true', otherwise an empty string | |||||
| */ | |||||
| public String getRecursive() { | |||||
| if (!recursive) { | |||||
| return ""; | |||||
| } else { | |||||
| return SOSCmd.FLAG_RECURSION; | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Builds and returns the working directory | |||||
| * <p> | |||||
| * The localpath is created if it didn't exist | |||||
| * | |||||
| * @return String the absolute path of the working directory | |||||
| */ | |||||
| public String getLocalPath() { | |||||
| if (localPath == null) { | |||||
| return project.getBaseDir().getAbsolutePath(); | |||||
| } else { | |||||
| // make sure localDir exists, create it if it doesn't | |||||
| File dir = project.resolveFile(localPath); | |||||
| if (!dir.exists()) { | |||||
| boolean done = dir.mkdirs(); | |||||
| if (!done) { | |||||
| String msg = "Directory " + localPath + " creation was not " + | |||||
| "successful for an unknown reason"; | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| project.log("Created dir: " + dir.getAbsolutePath()); | |||||
| } | |||||
| return dir.getAbsolutePath(); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Execute the created command line | |||||
| * | |||||
| * @param cmd Description of Parameter | |||||
| * @return int the exit code | |||||
| * @throws BuildException | |||||
| */ | |||||
| protected int run(Commandline cmd) { | |||||
| try { | |||||
| Execute exe = new Execute(new LogStreamHandler(this, | |||||
| Project.MSG_INFO, | |||||
| Project.MSG_WARN)); | |||||
| exe.setAntRun(project); | |||||
| exe.setWorkingDirectory(project.getBaseDir()); | |||||
| exe.setCommandline(cmd.getCommandline()); | |||||
| return exe.execute(); | |||||
| } catch (java.io.IOException e) { | |||||
| throw new BuildException(e, location); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,257 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sos; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| /** | |||||
| * Task to commit and unlock file(s) in Visual Source Safe via a SourceOffSite server. | |||||
| * <p> | |||||
| * The following attributes are interpretted: | |||||
| * <table border="1"> | |||||
| * <tr> | |||||
| * <th>Attribute</th> | |||||
| * <th>Values</th> | |||||
| * <th>Required</th> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>soscmddir</td> | |||||
| * <td>Directory which contains soscmd(.exe) <br> | |||||
| * soscmd(.exe) must be in the path if this is not specified</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>vssserverpath</td> | |||||
| * <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>sosserverpath</td> | |||||
| * <td>address and port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>projectpath</td> | |||||
| * <td>SourceSafe project path without the "$"</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>file</td> | |||||
| * <td>Filename to act upon<br> If no file is specified then act upon the project</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>username</td> | |||||
| * <td>SourceSafe username</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>password</td> | |||||
| * <td>SourceSafe password</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>localpath</td> | |||||
| * <td>Override the working directory and get to the specified path</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>soshome</td> | |||||
| * <td>The path to the SourceOffSite home directory</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>nocompression</td> | |||||
| * <td>true or false - disable compression</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>recursive</td> | |||||
| * <td>true or false - Only works with the CheckOutProject command</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>nocache</td> | |||||
| * <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>verbose</td> | |||||
| * <td>true or false - Status messages are displayed</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <td>comment</td> | |||||
| * <td>A comment to be applied to all files being checked in</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * </table> | |||||
| * | |||||
| * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> | |||||
| */ | |||||
| public class SOSCheckin extends SOS { | |||||
| Commandline commandLine; | |||||
| /** | |||||
| * Executes the task. | |||||
| * <br> | |||||
| * Builds a command line to execute soscmd and then calls Exec's run method | |||||
| * to execute the command line. | |||||
| * | |||||
| * @exception BuildException Description of Exception | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| int result = 0; | |||||
| buildCmdLine(); | |||||
| result = run(commandLine); | |||||
| if (result == 255) { | |||||
| // This is the exit status | |||||
| String msg = "Failed executing: " + commandLine.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Build the command line <br> | |||||
| * | |||||
| * CheckInFile required parameters: -server -name -password -database -project -file<br> | |||||
| * CheckInFile optional parameters: -workdir -log -verbose -nocache | |||||
| * -nocompression -soshome<br> | |||||
| * | |||||
| * CheckInProject required parameters: -server -name -password -database -project<br> | |||||
| * CheckInProject optional parameters: workdir -recursive -log -verbose -nocache | |||||
| * -nocompression -soshome<br> | |||||
| * | |||||
| * @return Commandline the generated command to be executed | |||||
| */ | |||||
| protected Commandline buildCmdLine() { | |||||
| commandLine = new Commandline(); | |||||
| // Get the path to the soscmd(.exe) | |||||
| commandLine.setExecutable(getSosCommand()); | |||||
| // If we find a "file" attribute then act on a file otherwise act on a project | |||||
| if (getFilename() != null) { | |||||
| // add -command CheckInFile to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); | |||||
| commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_FILE); | |||||
| // add -file xxxxx to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_FILE); | |||||
| commandLine.createArgument().setValue(getFilename()); | |||||
| } else { | |||||
| // add -command CheckInProject to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); | |||||
| commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKIN_PROJECT); | |||||
| // look for a recursive option | |||||
| commandLine.createArgument().setValue(getRecursive()); | |||||
| } | |||||
| // SOS server address is required | |||||
| if (getSosServerPath() == null) { | |||||
| throw new BuildException("sosserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); | |||||
| commandLine.createArgument().setValue(getSosServerPath()); | |||||
| // Login info is required | |||||
| if (getUsername() == null) { | |||||
| throw new BuildException("username attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); | |||||
| commandLine.createArgument().setValue(getUsername()); | |||||
| // The SOS class knows that the SOS server needs the password flag, | |||||
| // even if there is no password ,so we send a " " | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PASSWORD); | |||||
| commandLine.createArgument().setValue(getPassword()); | |||||
| // VSS Info is required | |||||
| if (getVssServerPath() == null) { | |||||
| throw new BuildException("vssserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); | |||||
| commandLine.createArgument().setValue(getVssServerPath()); | |||||
| // VSS project is required | |||||
| if (getProjectPath() == null) { | |||||
| throw new BuildException("projectpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); | |||||
| commandLine.createArgument().setValue(getProjectPath()); | |||||
| // The following options are optional. | |||||
| // -verbose | |||||
| commandLine.createArgument().setValue(getVerbose()); | |||||
| // Disable Compression | |||||
| commandLine.createArgument().setValue(getNoCompress()); | |||||
| // Path to the SourceOffSite home directory /home/user/.sos | |||||
| if (getSosHome() == null) { | |||||
| // If -soshome was not specified then we can look for nocache | |||||
| commandLine.createArgument().setValue(getNoCache()); | |||||
| } else { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_HOME); | |||||
| commandLine.createArgument().setValue(getSosHome()); | |||||
| } | |||||
| // If a working directory was specified then add it to the command line | |||||
| if (getLocalPath() != null) { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_WORKING_DIR); | |||||
| commandLine.createArgument().setValue(getLocalPath()); | |||||
| } | |||||
| // Look for a comment | |||||
| if (getComment() != null) { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMENT); | |||||
| commandLine.createArgument().setValue(getComment()); | |||||
| } | |||||
| return commandLine; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,247 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sos; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.Path; | |||||
| /** | |||||
| * Task to retreive and lock file(s) in Visual Source Safe via a SourceOffSite server. | |||||
| * <p> | |||||
| * The following attributes are interpretted: | |||||
| * <table border="1"> | |||||
| * <tr> | |||||
| * <th>Attribute</th> | |||||
| * <th>Values</th> | |||||
| * <th>Required</th> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>soscmddir</td> | |||||
| * <td>Directory which contains soscmd(.exe) <br> | |||||
| * soscmd(.exe) must be in the path if this is not specified</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>vssserverpath</td> | |||||
| * <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>sosserverpath</td> | |||||
| * <td>address and port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>projectpath</td> | |||||
| * <td>SourceSafe project path without the "$"</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>file</td> | |||||
| * <td>Filename to act upon<br> If no file is specified then act upon the project</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>username</td> | |||||
| * <td>SourceSafe username</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>password</td> | |||||
| * <td>SourceSafe password</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>localpath</td> | |||||
| * <td>Override the working directory and get to the specified path</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>soshome</td> | |||||
| * <td>The path to the SourceOffSite home directory</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>nocompression</td> | |||||
| * <td>true or false - disable compression</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>recursive</td> | |||||
| * <td>true or false - Only works with the CheckOutProject command</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>nocache</td> | |||||
| * <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>verbose</td> | |||||
| * <td>true or false - Status messages are displayed</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * </table> | |||||
| * | |||||
| * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> | |||||
| */ | |||||
| public class SOSCheckout extends SOS { | |||||
| Commandline commandLine; | |||||
| /** | |||||
| * Executes the task. | |||||
| * <br> | |||||
| * Builds a command line to execute soscmd and then calls Exec's run method | |||||
| * to execute the command line. | |||||
| * | |||||
| * @exception BuildException Description of Exception | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| int result = 0; | |||||
| buildCmdLine(); | |||||
| result = run(commandLine); | |||||
| if (result == 255) { | |||||
| // This is the exit status | |||||
| String msg = "Failed executing: " + commandLine.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Build the command line <br> | |||||
| * | |||||
| * CheckOutFile required parameters: -server -name -password -database -project -file<br> | |||||
| * CheckOutFile optional parameters: -workdir -verbose -nocache -nocompression -soshome<br> | |||||
| * | |||||
| * CheckOutProject required parameters: -server -name -password -database -project<br> | |||||
| * CheckOutProject optional parameters:-workdir -recursive -verbose -nocache | |||||
| * -nocompression -soshome<br> | |||||
| * | |||||
| * @return Commandline the generated command to be executed | |||||
| */ | |||||
| protected Commandline buildCmdLine() { | |||||
| commandLine = new Commandline(); | |||||
| // Get the path to the soscmd(.exe) | |||||
| commandLine.setExecutable(getSosCommand()); | |||||
| // If we find a "file" attribute then act on a file otherwise act on a project | |||||
| if (getFilename() != null) { | |||||
| // add -command CheckOutFile to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); | |||||
| commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_FILE); | |||||
| // add -file xxxxx to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_FILE); | |||||
| commandLine.createArgument().setValue(getFilename()); | |||||
| } else { | |||||
| // add -command CheckOutProject to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); | |||||
| commandLine.createArgument().setValue(SOSCmd.COMMAND_CHECKOUT_PROJECT); | |||||
| // look for a recursive option | |||||
| commandLine.createArgument().setValue(getRecursive()); | |||||
| } | |||||
| // SOS server address is required | |||||
| if (getSosServerPath() == null) { | |||||
| throw new BuildException("sosserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); | |||||
| commandLine.createArgument().setValue(getSosServerPath()); | |||||
| // Login info is required | |||||
| if (getUsername() == null) { | |||||
| throw new BuildException("username attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); | |||||
| commandLine.createArgument().setValue(getUsername()); | |||||
| // The SOS class knows that the SOS server needs the password flag, | |||||
| // even if there is no password ,so we send a " " | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PASSWORD); | |||||
| commandLine.createArgument().setValue(getPassword()); | |||||
| // VSS Info is required | |||||
| if (getVssServerPath() == null) { | |||||
| throw new BuildException("vssserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); | |||||
| commandLine.createArgument().setValue(getVssServerPath()); | |||||
| // VSS project is required | |||||
| if (getProjectPath() == null) { | |||||
| throw new BuildException("projectpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); | |||||
| commandLine.createArgument().setValue(getProjectPath()); | |||||
| // The following options are optional. | |||||
| // -verbose | |||||
| commandLine.createArgument().setValue(getVerbose()); | |||||
| // Disable Compression | |||||
| commandLine.createArgument().setValue(getNoCompress()); | |||||
| // Path to the SourceOffSite home directory /home/user/.sos | |||||
| if (getSosHome() == null) { | |||||
| // If -soshome was not specified then we can look for nocache | |||||
| commandLine.createArgument().setValue(getNoCache()); | |||||
| } else { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_HOME); | |||||
| commandLine.createArgument().setValue(getSosHome()); | |||||
| } | |||||
| // If a working directory was specified then add it to the command line | |||||
| if (getLocalPath() != null) { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_WORKING_DIR); | |||||
| commandLine.createArgument().setValue(getLocalPath()); | |||||
| } | |||||
| return commandLine; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,93 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| * | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sos; | |||||
| /** | |||||
| * Interface to hold constants used by the SOS tasks | |||||
| * | |||||
| * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> | |||||
| */ | |||||
| public interface SOSCmd { | |||||
| // soscmd Command options | |||||
| public final static String COMMAND_SOS_EXE = "soscmd"; | |||||
| public final static String COMMAND_GET_FILE = "GetFile"; | |||||
| public final static String COMMAND_GET_PROJECT = "GetProject"; | |||||
| public final static String COMMAND_CHECKOUT_FILE = "CheckOutFile"; | |||||
| public final static String COMMAND_CHECKOUT_PROJECT = "CheckOutProject"; | |||||
| public final static String COMMAND_CHECKIN_FILE = "CheckInFile"; | |||||
| public final static String COMMAND_CHECKIN_PROJECT = "CheckInProject"; | |||||
| public final static String COMMAND_HISTORY = "GetFileHistory"; | |||||
| public final static String COMMAND_LABEL = "AddLabel"; | |||||
| public final static String PROJECT_PREFIX = "$"; | |||||
| // soscmd Option flags | |||||
| public final static String FLAG_COMMAND = "-command"; | |||||
| public final static String FLAG_VSS_SERVER = "-database"; | |||||
| public final static String FLAG_USERNAME = "-name"; | |||||
| public final static String FLAG_PASSWORD = "-password"; | |||||
| public final static String FLAG_COMMENT = "-log"; | |||||
| public final static String FLAG_WORKING_DIR = "-workdir"; | |||||
| public final static String FLAG_RECURSION = "-recursive"; | |||||
| public final static String FLAG_VERSION = "-revision"; | |||||
| public final static String FLAG_LABEL = "-label"; | |||||
| public final static String FLAG_NO_COMPRESSION = "-nocompress"; | |||||
| public final static String FLAG_NO_CACHE = "-nocache"; | |||||
| public final static String FLAG_SOS_SERVER = "-server"; | |||||
| public final static String FLAG_SOS_HOME = "-soshome"; | |||||
| public final static String FLAG_PROJECT = "-project"; | |||||
| public final static String FLAG_FILE = "-file"; | |||||
| public final static String FLAG_VERBOSE = "-verbose"; | |||||
| } | |||||
| @@ -0,0 +1,268 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sos; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| /** | |||||
| * Task to retreive file(s) from Visual Source Safe via a SourceOffSite server. | |||||
| * <p> | |||||
| * The following attributes are interpretted: | |||||
| * <table border="1"> | |||||
| * <tbody> | |||||
| * <tr> | |||||
| * <th>Attribute</th> | |||||
| * <th>Values</th> | |||||
| * <th>Required</th> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>soscmddir</td> | |||||
| * <td>Directory which contains soscmd(.exe) <br> | |||||
| * soscmd(.exe) must be in the path if this is not specified</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>vssserverpath</td> | |||||
| * <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>sosserverpath</td> | |||||
| * <td>address and port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>projectpath</td> | |||||
| * <td>SourceSafe project path without the "$"</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>file</td> | |||||
| * <td>Filename to act upon<br> | |||||
| * If no file is specified then act upon the project</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>username</td> | |||||
| * <td>SourceSafe username</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>password</td> | |||||
| * <td>SourceSafe password</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>localpath</td> | |||||
| * <td>Override the working directory and get to the specified path</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>soshome</td> | |||||
| * <td>The path to the SourceOffSite home directory</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>nocompression</td> | |||||
| * <td>true or false - disable compression</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>recursive</td> | |||||
| * <td>true or false - Only works with the GetProject command</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>version</td> | |||||
| * <td>a version number to get - Only works with the GetFile command</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>label</td> | |||||
| * <td>a label version to get - Only works with the GetProject command</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>nocache</td> | |||||
| * <td>true or false - Only needed if SOSHOME is set as an enviroment variable</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>verbose</td> | |||||
| * <td>true or false - Status messages are displayed</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * | |||||
| * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> | |||||
| */ | |||||
| public class SOSGet extends SOS { | |||||
| Commandline commandLine; | |||||
| /** | |||||
| * Executes the task. | |||||
| * <br> | |||||
| * Builds a command line to execute soscmd and then calls Exec's run method | |||||
| * to execute the command line. | |||||
| * | |||||
| * @exception BuildException Description of Exception | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| int result = 0; | |||||
| buildCmdLine(); | |||||
| result = run(commandLine); | |||||
| if (result == 255) { | |||||
| // This is the exit status | |||||
| String msg = "Failed executing: " + commandLine.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Build the command line <br> | |||||
| * | |||||
| * GetFile required parameters: -server -name -password -database -project -file<br> | |||||
| * GetFile optional parameters: -workdir -revision -verbose -nocache -nocompression -soshome<br> | |||||
| * | |||||
| * GetProject required parameters: -server -name -password -database -project<br> | |||||
| * GetProject optional parameters: -label -workdir -recursive -verbose -nocache | |||||
| * -nocompression -soshome<br> | |||||
| * | |||||
| * @return Commandline the generated command to be executed | |||||
| */ | |||||
| protected Commandline buildCmdLine() { | |||||
| commandLine = new Commandline(); | |||||
| // Get the path to the soscmd(.exe) | |||||
| commandLine.setExecutable(getSosCommand()); | |||||
| // If we find a "file" attribute then act on a file otherwise act on a project | |||||
| if (getFilename() != null) { | |||||
| // add -command GetFile to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); | |||||
| commandLine.createArgument().setValue(SOSCmd.COMMAND_GET_FILE); | |||||
| // add -file xxxxx to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_FILE); | |||||
| commandLine.createArgument().setValue(getFilename()); | |||||
| // look for a version attribute | |||||
| if (getVersion() != null) { | |||||
| //add -revision xxxxx to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_VERSION); | |||||
| commandLine.createArgument().setValue(getVersion()); | |||||
| } | |||||
| } else { | |||||
| // add -command GetProject to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); | |||||
| commandLine.createArgument().setValue(SOSCmd.COMMAND_GET_PROJECT); | |||||
| // look for a recursive option | |||||
| commandLine.createArgument().setValue(getRecursive()); | |||||
| // look for a label option | |||||
| if (getLabel() != null) { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_LABEL); | |||||
| commandLine.createArgument().setValue(getLabel()); | |||||
| } | |||||
| } | |||||
| // SOS server address is required | |||||
| if (getSosServerPath() == null) { | |||||
| throw new BuildException("sosserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); | |||||
| commandLine.createArgument().setValue(getSosServerPath()); | |||||
| // Login info is required | |||||
| if (getUsername() == null) { | |||||
| throw new BuildException("username attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); | |||||
| commandLine.createArgument().setValue(getUsername()); | |||||
| // The SOS class knows that the SOS server needs the password flag, | |||||
| // even if there is no password ,so we send a " " | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PASSWORD); | |||||
| commandLine.createArgument().setValue(getPassword()); | |||||
| // VSS Info is required | |||||
| if (getVssServerPath() == null) { | |||||
| throw new BuildException("vssserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); | |||||
| commandLine.createArgument().setValue(getVssServerPath()); | |||||
| // SS project path is required | |||||
| if (getProjectPath() == null) { | |||||
| throw new BuildException("projectpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); | |||||
| commandLine.createArgument().setValue(getProjectPath()); | |||||
| // The following options are optional. | |||||
| // -verbose | |||||
| commandLine.createArgument().setValue(getVerbose()); | |||||
| // Disable Compression | |||||
| commandLine.createArgument().setValue(getNoCompress()); | |||||
| // Path to the SourceOffSite home directory /home/user/.sos | |||||
| if (getSosHome() == null) { | |||||
| // If -soshome was not specified then we can look for nocache | |||||
| commandLine.createArgument().setValue(getNoCache()); | |||||
| } else { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_HOME); | |||||
| commandLine.createArgument().setValue(getSosHome()); | |||||
| } | |||||
| //If a working directory was specified then add it to the command line | |||||
| if (getLocalPath() != null) { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_WORKING_DIR); | |||||
| commandLine.createArgument().setValue(getLocalPath()); | |||||
| } | |||||
| return commandLine; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,204 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2000 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sos; | |||||
| import org.apache.tools.ant.*; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| /** | |||||
| * Task to label a Visual Source Safe via a SourceOffSite server. | |||||
| * <p> | |||||
| * The following attributes are interpretted: | |||||
| * <table border="1"> | |||||
| * <tr> | |||||
| * <th>Attribute</th> | |||||
| * <th>Values</th> | |||||
| * <th>Required</th> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>soscmddir</td> | |||||
| * <td>Directory which contains soscmd(.exe) <br> | |||||
| * soscmd(.exe) must be in the path if this is not specified</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>vssserverpath</td> | |||||
| * <td>path to the srcsafe.ini - eg. \\server\vss\srcsafe.ini</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>sosserverpath</td> | |||||
| * <td>address and port of the SOS server - eg. 192.168.0.1:8888</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>projectpath</td> | |||||
| * <td>SourceSafe project path without the "$"</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>username</td> | |||||
| * <td>SourceSafe username</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>password</td> | |||||
| * <td>SourceSafe password</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>label</td> | |||||
| * <td>The label to apply to a project</td> | |||||
| * <td>Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>comment</td> | |||||
| * <td>A comment to be applied to all files being labeled</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td>verbose</td> | |||||
| * <td>true or false - Status messages are displayed</td> | |||||
| * <td>No</td> | |||||
| * </tr> | |||||
| * </table> | |||||
| * | |||||
| * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> | |||||
| */ | |||||
| public class SOSLabel extends SOS { | |||||
| Commandline commandLine; | |||||
| /** | |||||
| * Executes the task. <br> | |||||
| * Builds a command line to execute soscmd and then calls Exec's run method | |||||
| * to execute the command line. | |||||
| * | |||||
| * @exception BuildException Description of Exception | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| int result = 0; | |||||
| buildCmdLine(); | |||||
| result = run(commandLine); | |||||
| if (result == 255) { | |||||
| // This is the exit status | |||||
| String msg = "Failed executing: " + commandLine.toString(); | |||||
| throw new BuildException(msg, location); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Build the command line <br> | |||||
| * AddLabel required parameters: -server -name -password -database -project -label<br> | |||||
| * AddLabel optional parameters: -verbose -comment<br> | |||||
| * | |||||
| * @return Commandline the generated command to be executed | |||||
| */ | |||||
| protected Commandline buildCmdLine() { | |||||
| commandLine = new Commandline(); | |||||
| // Get the path to the soscmd(.exe) | |||||
| commandLine.setExecutable(getSosCommand()); | |||||
| // add -command AddLabel to the commandline | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMAND); | |||||
| commandLine.createArgument().setValue(SOSCmd.COMMAND_LABEL); | |||||
| // SOS server address is required | |||||
| if (getSosServerPath() == null) { | |||||
| throw new BuildException("sosserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_SOS_SERVER); | |||||
| commandLine.createArgument().setValue(getSosServerPath()); | |||||
| // Login info is required | |||||
| if (getUsername() == null) { | |||||
| throw new BuildException("username attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_USERNAME); | |||||
| commandLine.createArgument().setValue(getUsername()); | |||||
| // The SOS class knows that the SOS server needs the password flag, | |||||
| // even if there is no password ,so we send a " " | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PASSWORD); | |||||
| commandLine.createArgument().setValue(getPassword()); | |||||
| // VSS Info is required | |||||
| if (getVssServerPath() == null) { | |||||
| throw new BuildException("vssserverpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_VSS_SERVER); | |||||
| commandLine.createArgument().setValue(getVssServerPath()); | |||||
| // SS project path is required | |||||
| if (getProjectPath() == null) { | |||||
| throw new BuildException("projectpath attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_PROJECT); | |||||
| commandLine.createArgument().setValue(getProjectPath()); | |||||
| // a label is required | |||||
| if (getLabel() == null) { | |||||
| throw new BuildException("label attribute must be set!", location); | |||||
| } | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_LABEL); | |||||
| commandLine.createArgument().setValue(getLabel()); | |||||
| // The following options are optional. | |||||
| // -verbose | |||||
| commandLine.createArgument().setValue(getVerbose()); | |||||
| // Look for a comment | |||||
| if (getComment() != null) { | |||||
| commandLine.createArgument().setValue(SOSCmd.FLAG_COMMENT); | |||||
| commandLine.createArgument().setValue(getComment()); | |||||
| } | |||||
| return commandLine; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,13 @@ | |||||
| <html> | |||||
| <body> | |||||
| <p> | |||||
| Ant tasks for working with a SourceOffSite source control system | |||||
| </p> | |||||
| <p> | |||||
| The <SOSGet> Retreives file(s) from a SOS database<br> | |||||
| The <SOSCheckin> Commits and unlocks file(s) in a SOS database<br> | |||||
| The <SOSCheckout> Retreives and lock file(s) in a SOS database<br> | |||||
| The <SOSLabel> Label a SOS database<br> | |||||
| </p> | |||||
| </body> | |||||
| </html> | |||||
| @@ -0,0 +1,690 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sos; | |||||
| import junit.framework.TestCase; | |||||
| import junit.framework.AssertionFailedError; | |||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| 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.*; | |||||
| /** | |||||
| * Basic testcase to ensure that command line generation is ok | |||||
| * @author <a href="mailto:jesse@cryptocard.com">Jesse Stockall</a> | |||||
| */ | |||||
| public class SOSTest extends TestCase { | |||||
| 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 SOS_SERVER_PATH = "192.168.0.1:8888"; | |||||
| private static final String SOS_USERNAME = "ant"; | |||||
| private static final String SOS_PASSWORD = "rocks"; | |||||
| private static final String LOCAL_PATH = "/home/jesse/source/dir"; | |||||
| private static final String SRC_FILE = "Class1.java"; | |||||
| private static final String SRC_LABEL = "label1"; | |||||
| private static final String SRC_COMMENT = "I fixed a bug"; | |||||
| private static final String SOS_HOME = "/home/user/.sos"; | |||||
| private static final String VERSION = "007"; | |||||
| public SOSTest(String s) { | |||||
| super(s); | |||||
| } | |||||
| protected void setUp() throws Exception { | |||||
| sosGet = new SOSGet(); | |||||
| sosCheckin = new SOSCheckin(); | |||||
| sosCheckout = new SOSCheckout(); | |||||
| sosLabel = new SOSLabel(); | |||||
| project = new Project(); | |||||
| project.setBasedir("."); | |||||
| fileUtils = FileUtils.newFileUtils(); | |||||
| } | |||||
| /** | |||||
| * 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", fileUtils.normalize(LOCAL_PATH).getAbsolutePath() }; | |||||
| Path path = new Path(project, LOCAL_PATH); | |||||
| // Set up a SOSGet task | |||||
| sosGet.setProject(project); | |||||
| sosGet.setVssServerPath(VSS_SERVER_PATH); | |||||
| sosGet.setSosServerPath(SOS_SERVER_PATH); | |||||
| sosGet.setProjectPath(VSS_PROJECT_PATH); | |||||
| sosGet.setFile(SRC_FILE); | |||||
| sosGet.setUsername(SOS_USERNAME); | |||||
| sosGet.setPassword(SOS_PASSWORD); | |||||
| sosGet.setVersion(VERSION); | |||||
| sosGet.setLocalPath(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"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 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() }; | |||||
| // Set up a SOSGet task | |||||
| sosGet.setProject(project); | |||||
| sosGet.setVssServerPath(VSS_SERVER_PATH); | |||||
| sosGet.setSosServerPath(SOS_SERVER_PATH); | |||||
| sosGet.setProjectPath(VSS_PROJECT_PATH); | |||||
| sosGet.setLabel(SRC_LABEL); | |||||
| sosGet.setUsername(SOS_USERNAME); | |||||
| sosGet.setSosHome(SOS_HOME); | |||||
| sosGet.setNoCache(true); | |||||
| sosGet.setNoCompress(false); | |||||
| sosGet.setVerbose(false); | |||||
| 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"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Test SOSGet required attributes 1 by 1 | |||||
| */ | |||||
| 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); | |||||
| } | |||||
| /** | |||||
| * 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", fileUtils.normalize(LOCAL_PATH).getAbsolutePath(), "-log", SRC_COMMENT }; | |||||
| Path path = new Path(project, LOCAL_PATH); | |||||
| // Set up a SOSCheckin task | |||||
| sosCheckin.setProject(project); | |||||
| sosCheckin.setVssServerPath(VSS_SERVER_PATH); | |||||
| sosCheckin.setSosServerPath(SOS_SERVER_PATH); | |||||
| sosCheckin.setProjectPath(VSS_PROJECT_PATH); | |||||
| sosCheckin.setFile(SRC_FILE); | |||||
| sosCheckin.setComment(SRC_COMMENT); | |||||
| sosCheckin.setUsername(SOS_USERNAME); | |||||
| sosCheckin.setPassword(SOS_PASSWORD); | |||||
| sosCheckin.setLocalPath(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"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 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, }; | |||||
| // Set up a SOSCheckin task | |||||
| sosCheckin.setProject(project); | |||||
| sosCheckin.setVssServerPath(VSS_SERVER_PATH); | |||||
| sosCheckin.setSosServerPath(SOS_SERVER_PATH); | |||||
| sosCheckin.setProjectPath(VSS_PROJECT_PATH); | |||||
| sosCheckin.setComment(SRC_COMMENT); | |||||
| sosCheckin.setUsername(SOS_USERNAME); | |||||
| sosCheckin.setSosHome(SOS_HOME); | |||||
| sosCheckin.setNoCache(true); | |||||
| sosCheckin.setNoCompress(false); | |||||
| sosCheckin.setVerbose(false); | |||||
| 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"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Test SOSCheckIn required attributes 1 by 1 | |||||
| */ | |||||
| 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); | |||||
| } | |||||
| /** | |||||
| * 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", fileUtils.normalize(LOCAL_PATH).getAbsolutePath() }; | |||||
| Path path = new Path(project, LOCAL_PATH); | |||||
| // Set up a SOSCheckout task | |||||
| sosCheckout.setProject(project); | |||||
| sosCheckout.setVssServerPath(VSS_SERVER_PATH); | |||||
| sosCheckout.setSosServerPath(SOS_SERVER_PATH); | |||||
| sosCheckout.setProjectPath(VSS_PROJECT_PATH); | |||||
| sosCheckout.setFile(SRC_FILE); | |||||
| sosCheckout.setUsername(SOS_USERNAME); | |||||
| sosCheckout.setPassword(SOS_PASSWORD); | |||||
| sosCheckout.setLocalPath(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"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 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() }; | |||||
| // Set up a sosCheckout task | |||||
| sosCheckout.setProject(project); | |||||
| sosCheckout.setVssServerPath(VSS_SERVER_PATH); | |||||
| sosCheckout.setSosServerPath(SOS_SERVER_PATH); | |||||
| sosCheckout.setProjectPath(VSS_PROJECT_PATH); | |||||
| sosCheckout.setUsername(SOS_USERNAME); | |||||
| sosCheckout.setSosHome(SOS_HOME); | |||||
| sosCheckout.setNoCache(true); | |||||
| sosCheckout.setNoCompress(false); | |||||
| sosCheckout.setVerbose(false); | |||||
| 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"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Test SOSCheckout required attributes 1 by 1 | |||||
| */ | |||||
| 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); | |||||
| } | |||||
| /** | |||||
| * 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 }; | |||||
| // Set up a sosCheckout task | |||||
| sosLabel.setVssServerPath(VSS_SERVER_PATH); | |||||
| sosLabel.setSosServerPath(SOS_SERVER_PATH); | |||||
| sosLabel.setProjectPath(VSS_PROJECT_PATH); | |||||
| sosLabel.setUsername(SOS_USERNAME); | |||||
| sosLabel.setSosHome(SOS_HOME); | |||||
| sosLabel.setComment(SRC_COMMENT); | |||||
| sosLabel.setLabel(SRC_LABEL); | |||||
| sosLabel.setNoCache(true); | |||||
| sosLabel.setNoCompress(false); | |||||
| 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"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Test SOSLabel required attributes 1 by 1 | |||||
| */ | |||||
| 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); | |||||
| // 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; | |||||
| } | |||||
| } | |||||
| 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; | |||||
| } | |||||
| assertTrue("LabelException All required options set", buildEx); | |||||
| } | |||||
| } | |||||