maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r527408 - in /maven/scm/trunk: maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/ maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/co...
Date Wed, 11 Apr 2007 08:16:44 GMT
Author: evenisse
Date: Wed Apr 11 01:16:43 2007
New Revision: 527408

URL: http://svn.apache.org/viewvc?view=rev&rev=527408
Log:
[SCM-296] Add ClearCase UCM support
Submitted by: Antoine Veret

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/ClearCaseScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/changelog/ClearCaseChangeLogCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepository.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/mdo/clearcase-settings.mdo
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommandTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepositoryTest.java
    maven/scm/trunk/maven-scm-site/src/site/apt/clearcase.apt

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/ClearCaseScmProvider.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/ClearCaseScmProvider.java?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/ClearCaseScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/ClearCaseScmProvider.java
Wed Apr 11 01:16:43 2007
@@ -39,7 +39,8 @@
 import org.apache.maven.scm.provider.clearcase.command.tag.ClearCaseTagCommand;
 import org.apache.maven.scm.provider.clearcase.command.update.ClearCaseUpdateCommand;
 import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
-import org.apache.maven.scm.repository.ScmRepository;
+import org.apache.maven.scm.provider.clearcase.util.ClearCaseUtil;
+import org.apache.maven.scm.providers.clearcase.settings.Settings;
 import org.apache.maven.scm.repository.ScmRepositoryException;
 
 /**
@@ -56,10 +57,16 @@
     // ScmProvider Implementation
     // ----------------------------------------------------------------------
 
+    /**
+     * Contains parameters loaded from clearcase-settings.xml
+     */
+    private Settings settings;
+
     public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter
)
         throws ScmRepositoryException
     {
-        return new ClearCaseScmProviderRepository( getLogger(), scmSpecificUrl );
+        settings = ClearCaseUtil.getSettings();
+        return new ClearCaseScmProviderRepository( getLogger(), scmSpecificUrl, settings);
     }
 
     public String getScmType()
@@ -107,6 +114,7 @@
         ClearCaseCheckOutCommand command = new ClearCaseCheckOutCommand();
 
         command.setLogger( getLogger() );
+        command.setSettings(settings);
 
         return (CheckOutScmResult) command.execute( repository, fileSet, parameters );
     }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/changelog/ClearCaseChangeLogCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/changelog/ClearCaseChangeLogCommand.java?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/changelog/ClearCaseChangeLogCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/changelog/ClearCaseChangeLogCommand.java
Wed Apr 11 01:16:43 2007
@@ -50,8 +50,6 @@
     extends AbstractChangeLogCommand
     implements ClearCaseCommand
 {
-    private static Settings settings = ClearCaseUtil.getSettings();
-
     // ----------------------------------------------------------------------
     // AbstractChangeLogCommand Implementation
     // ----------------------------------------------------------------------

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommand.java?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommand.java
Wed Apr 11 01:16:43 2007
@@ -19,6 +19,12 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmVersion;
@@ -27,7 +33,6 @@
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.clearcase.command.ClearCaseCommand;
 import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
-import org.apache.maven.scm.provider.clearcase.util.ClearCaseUtil;
 import org.apache.maven.scm.providers.clearcase.settings.Settings;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.StringUtils;
@@ -35,12 +40,6 @@
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
 /**
  * @author <a href="mailto:wim.deblauwe@gmail.com">Wim Deblauwe</a>
  * @author <a href="mailto:frederic.mura@laposte.net">Frederic Mura</a>
@@ -49,8 +48,7 @@
     extends AbstractCheckOutCommand
     implements ClearCaseCommand
 {
-
-    private static Settings settings = ClearCaseUtil.getSettings();
+    private Settings settings = null;
 
     // ----------------------------------------------------------------------
     // AbstractCheckOutCommand Implementation
@@ -66,15 +64,7 @@
 
         getLogger().debug( version.getType() + ": " + version.getName() );
 
-        if ( isClearCaseLT() )
-        {
-            getLogger().debug( "Running with CLEARCASE LT" );
-        }
-        else
-        {
-            getLogger().debug( "Running with CLEARCASE" );
-        }
-        // Commandline cl = createCommandLine( fileSet.getBasedir(), tag );
+        getLogger().debug( "Running with CLEARCASE " + settings.getClearcaseType() );
 
         ClearCaseCheckOutConsumer consumer = new ClearCaseCheckOutConsumer( getLogger() );
 
@@ -91,7 +81,8 @@
             FileUtils.deleteDirectory( workingDirectory );
             // First create the view
             String viewName = getUniqueViewName( repo, workingDirectory.getAbsolutePath()
);
-            cl = createCreateViewCommandLine( workingDirectory, viewName );
+            String streamIdentifier = getStreamIdentifier(repo.getStreamName(), repo.getVobName());
+            cl = createCreateViewCommandLine( workingDirectory, viewName, streamIdentifier
);
             getLogger().info( "Executing: " + cl.getWorkingDirectory().getAbsolutePath()
+ ">>" + cl.toString() );
             exitCode = CommandLineUtils.executeCommandLine( cl, new CommandLineUtils.StringStreamConsumer(),
stderr );
 
@@ -172,7 +163,7 @@
      * @param viewName           The name of the view; used to determine an appropriate file
      *                           name
      */
-    protected static File writeTemporaryConfigSpecFile( String configSpecContents, String
viewName )
+    protected File writeTemporaryConfigSpecFile( String configSpecContents, String viewName
)
         throws IOException
     {
         File configSpecLocation = File.createTempFile( "configspec-" + viewName, ".txt" );
@@ -205,7 +196,7 @@
      *                      supported
      * @return Config Spec as String
      */
-    protected static String createConfigSpec( String loadDirectory, ScmVersion version )
+    protected String createConfigSpec( String loadDirectory, ScmVersion version )
     {
         // create config spec
         StringBuffer configSpec = new StringBuffer();
@@ -247,7 +238,7 @@
 //        return command;
 //    }
 
-    protected static Commandline createCreateViewCommandLine( File workingDirectory, String
viewName )
+    protected Commandline createCreateViewCommandLine( File workingDirectory, String viewName,
String streamIdentifier)
         throws IOException
     {
         Commandline command = new Commandline();
@@ -261,7 +252,13 @@
         command.createArgument().setValue( "-snapshot" );
         command.createArgument().setValue( "-tag" );
         command.createArgument().setValue( viewName );
-
+        
+        if (isClearCaseUCM())
+        {
+            command.createArgument().setValue( "-stream" );
+            command.createArgument().setValue( streamIdentifier );
+        }
+        
         if ( !isClearCaseLT() )
         {
             if ( useVWS() )
@@ -276,7 +273,20 @@
         return command;
     }
 
-    protected static Commandline createUpdateConfigSpecCommandLine( File workingDirectory,
File configSpecLocation,
+    /**
+     * Format the stream identifier for ClearCaseUCM
+     * @param streamName
+     * @param vobName
+     * @return the formatted stream identifier if the two parameter are not null
+     */
+    protected String getStreamIdentifier(String streamName, String vobName)
+    {
+        if (streamName == null || vobName == null)
+            return null;
+        return "stream:" + streamName + "@" + vobName;
+    }
+
+    protected Commandline createUpdateConfigSpecCommandLine( File workingDirectory, File
configSpecLocation,
                                                                     String viewName )
     {
         Commandline command = new Commandline();
@@ -294,7 +304,7 @@
 
     }
 
-    private static String getUniqueViewName( ClearCaseScmProviderRepository repository, String
absolutePath )
+    private String getUniqueViewName( ClearCaseScmProviderRepository repository, String absolutePath
)
     {
         String uniqueId;
         int lastIndexBack = absolutePath.lastIndexOf( '\\' );
@@ -310,7 +320,7 @@
         return repository.getViewName( uniqueId );
     }
 
-    protected static String getViewStore()
+    protected String getViewStore()
     {
         String result = null;
 
@@ -335,45 +345,25 @@
         return result;
     }
 
-    /**
-     * @return the value of the setting property 'clearcaseLT'
-     */
-    protected static boolean isClearCaseLT()
+    protected boolean isClearCaseLT()
     {
-        return settings.isClearcaseLT();
+        return ClearCaseScmProviderRepository.CLEARCASE_LT.equals(settings.getClearcaseType());
     }
 
-    /**
-     * Only use for test case
-     *
-     * @param isClearCaseLT
-     * @deprecated
-     */
-    protected static void setIsClearCaseLT( boolean isClearCaseLT )
+    protected boolean isClearCaseUCM()
     {
-        settings.setClearcaseLT( isClearCaseLT );
+        return ClearCaseScmProviderRepository.CLEARCASE_UCM.equals(settings.getClearcaseType());
     }
-
+    
     /**
      * @return the value of the setting property 'useVWS'
      */
-    protected static boolean useVWS()
+    protected boolean useVWS()
     {
         return settings.isUseVWSParameter();
     }
 
-    /**
-     * Only use for test case
-     *
-     * @param useVWS
-     * @deprecated
-     */
-    protected static void setUseVWS( boolean useVWS )
-    {
-        settings.setUseVWSParameter( useVWS );
-    }
-
-    private static String getHostName()
+    private String getHostName()
     {
         String hostname;
         try
@@ -388,10 +378,14 @@
         return hostname;
     }
 
-    private static String getUserName()
+    private String getUserName()
     {
         String username;
         username = System.getProperty( "user.name" );
         return username;
+    }
+
+    public void setSettings(Settings settings) {
+        this.settings = settings;
     }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepository.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepository.java?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepository.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepository.java
Wed Apr 11 01:16:43 2007
@@ -21,6 +21,7 @@
 
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.providers.clearcase.settings.Settings;
 import org.apache.maven.scm.repository.ScmRepositoryException;
 
 import java.io.File;
@@ -33,10 +34,14 @@
 import java.util.StringTokenizer;
 
 /**
- * Provider Repository
- * <p/>
- * Url format is [view_name]:[configspec|] or [view_name]|[configspec]
- * <p/>
+ * Provider Repository for ClearCase (standard, LT, UCM)
+ * <p />
+ * Url format for ClearCase and ClearCaseLT : <br />
+ * [view_name]:[configspec] or [view_name]|[configspec] 
+ * <p />
+ * Url format for ClearCaseUCM : <br />
+ * [view_name]|[configspec]|[vob_name]|[stream_name] or [view_name]:[configspec]:[vob_name]:[stream_name]
 
+ * <p />
  * [configspec] can be used in two different ways:
  * <ul>
  * <li>Path to a config spec file that is
@@ -69,10 +74,41 @@
      */
     private String loadDirectory;
 
-    public ClearCaseScmProviderRepository( ScmLogger logger, String url )
+    /**
+     * Describe the stream linked to the view. Only used with ClearCaseUCM
+     */
+    private String streamName;
+
+    /**
+     * Describe the vob containing the stream. Only used with ClearCaseUCM
+     */
+    private String vobName;
+    
+    /**
+     * Provider configuration settings
+     */
+    private Settings settings;
+    
+    /**
+     * Define the flag used in the clearcase-settings.xml when using ClearCaseLT
+     */
+    public static final String CLEARCASE_LT = "LT";
+
+    /**
+     * Define the flag used in the clearcase-settings.xml when using ClearCaseUCM
+     */
+    public static final String CLEARCASE_UCM = "UCM";
+
+    /**
+     * Define the default value from the clearcase-settings.xml when using ClearCase
+     */
+    public static final String CLEARCASE_DEFAULT = null;
+    
+    public ClearCaseScmProviderRepository( ScmLogger logger, String url, Settings settings
)
         throws ScmRepositoryException
     {
         this.logger = logger;
+        this.settings = settings;
         try
         {
             parseUrl( url );
@@ -109,9 +145,31 @@
     private void fillInProperties( StringTokenizer tokenizer )
         throws UnknownHostException, URISyntaxException, MalformedURLException
     {
+        String configSpecString = null;
+        
+        if (CLEARCASE_UCM.equals(settings.getClearcaseType()))
+            configSpecString = fillUCMProperties(tokenizer);
+        else
+            configSpecString = fillDefaultProperties(tokenizer);
+        
+        if ( !configSpecString.startsWith( "load " ) )
+        {
+            configSpec = createConfigSpecFile( configSpecString );
+            loadDirectory = null;
+        }
+        else
+        {
+            configSpec = null;
+            loadDirectory = configSpecString.substring( 5 );
 
+        }
+    }
+
+    private String fillDefaultProperties(StringTokenizer tokenizer) throws UnknownHostException

+    {
+        int tokenNumber = tokenizer.countTokens();  
         String configSpecString;
-        if ( tokenizer.countTokens() == 1 )
+        if ( tokenNumber == 1 )
         {
             //No view name was given
             viewName = getDefaultViewName();
@@ -119,31 +177,62 @@
         }
         else
         {
-            viewName = tokenizer.nextToken();
-            if ( viewName.length() > 0 )
-            {
-                viewNameGivenByUser = true;
-            }
-            else
-            {
-                viewName = getDefaultViewName();
-            }
-            configSpecString = tokenizer.nextToken();
+            configSpecString = checkViewName(tokenizer);
+            checkUnexpectedParameter(tokenizer, tokenNumber, 2);
         }
         logger.debug( "viewName = '" + viewName + "' ; configSpec = '" + configSpecString
+ "'" );
-        if ( !configSpecString.startsWith( "load " ) )
+        return configSpecString;
+    }
+
+    private String fillUCMProperties(StringTokenizer tokenizer) throws UnknownHostException,
MalformedURLException 
+    {
+        int tokenNumber = tokenizer.countTokens();
+        if ( tokenNumber <= 2 )
+            throw new MalformedURLException("ClearCaseUCM need more parameters. Expected
url format : [view_name]|[configspec]|[vob_name]|[stream_name]");
+        
+        String configSpecString;
+        if ( tokenNumber == 3 )
         {
-            configSpec = createConfigSpecFile( configSpecString );
-            loadDirectory = null;
+            //No view name was given
+            viewName = getDefaultViewName();
+            configSpecString = tokenizer.nextToken();
+            vobName = tokenizer.nextToken();
+            streamName = tokenizer.nextToken();
         }
         else
         {
-            configSpec = null;
-            loadDirectory = configSpecString.substring( 5 );
+            configSpecString = checkViewName(tokenizer);
+            vobName = tokenizer.nextToken();
+            streamName = tokenizer.nextToken();       
+            checkUnexpectedParameter(tokenizer, tokenNumber, 4);
+        }
+        logger.info( "viewName = '" + viewName + "' ; configSpec = '" + configSpecString
+ "' ; vobName = '" + vobName + "' ; streamName = '" + streamName + "'" );
+        return configSpecString;
+    }
 
+    private String checkViewName(StringTokenizer tokenizer) throws UnknownHostException 
+    {
+        viewName = tokenizer.nextToken();
+        if ( viewName.length() > 0 )
+        {
+            viewNameGivenByUser = true;
         }
+        else
+        {
+            viewName = getDefaultViewName();
+        }
+        return tokenizer.nextToken();
     }
 
+    private void checkUnexpectedParameter(StringTokenizer tokenizer, int tokenNumber, int
maxTokenNumber) 
+    {
+        if (tokenNumber > maxTokenNumber)
+        {
+            String unexpectedToken = tokenizer.nextToken();
+            logger.info("The SCM URL contains unused parameter : " + unexpectedToken);
+        }
+    }
+    
     private File createConfigSpecFile( String spec )
         throws URISyntaxException, MalformedURLException
     {
@@ -233,5 +322,13 @@
     public String getLoadDirectory()
     {
         return loadDirectory;
+    }
+
+    public String getStreamName() {
+        return streamName;
+    }
+
+    public String getVobName() {
+        return vobName;
     }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/mdo/clearcase-settings.mdo
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/mdo/clearcase-settings.mdo?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/mdo/clearcase-settings.mdo
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/main/mdo/clearcase-settings.mdo
Wed Apr 11 01:16:43 2007
@@ -28,10 +28,10 @@
           <description>Do you want to use vws parameter when clearcase provider run
mkview?</description>
         </field>
         <field>
-          <name>clearcaseLT</name>
+          <name>clearcaseType</name>
           <version>1.0.0+</version>
-          <type>boolean</type>
-          <description>Are you using ClearCase LT version ?</description>
+          <type>String</type>
+          <description>Are you using ClearCase LT or UCM version ?</description>
         </field>
       </fields>
     </class>

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommandTest.java?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/command/checkout/ClearCaseCheckOutCommandTest.java
Wed Apr 11 01:16:43 2007
@@ -19,13 +19,16 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.maven.scm.ScmBranch;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
+import org.apache.maven.scm.providers.clearcase.settings.Settings;
 import org.codehaus.plexus.util.cli.Commandline;
 
-import java.io.File;
-import java.io.IOException;
-
 /**
  * @author <a href="mailto:wim.deblauwe@gmail.com">Wim Deblauwe</a>
  * @author <a href="mailto:frederic.mura@laposte.net">Frederic Mura</a>
@@ -33,33 +36,61 @@
 public class ClearCaseCheckOutCommandTest
     extends ScmTestCase
 {
+    private Settings settings = null;
+    private ClearCaseCheckOutCommand checkOutCommand = null;
+    
+    public void setUp() throws Exception 
+    {
+        super.setUp();
+        checkOutCommand = new ClearCaseCheckOutCommand();
+        checkOutCommand.setLogger(new DefaultLog());
+        settings = new Settings();
+        checkOutCommand.setSettings(settings);
+    }
+    
     public void testCreateViewCommandLine()
         throws IOException
     {
-        ClearCaseCheckOutCommand.setIsClearCaseLT( false );
+        String viewName = "testView";
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_DEFAULT);
+        
         Commandline commandLine =
-            ClearCaseCheckOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
"testView" );
-        System.out.println( "==>cleartool mkview -snapshot -tag testView -vws " +
-            ClearCaseCheckOutCommand.getViewStore() + "testView.vws " + getWorkingDirectory()
);
-        System.out.println( "==>" + commandLine.toString() );
-        assertEquals( "cleartool mkview -snapshot -tag testView -vws " + ClearCaseCheckOutCommand.getViewStore()
+
+            checkOutCommand.createCreateViewCommandLine( getWorkingDirectory(), viewName,
null );
+        assertEquals( "cleartool mkview -snapshot -tag testView -vws " + checkOutCommand.getViewStore()
+
             "testView.vws " + getWorkingDirectory().getCanonicalPath(), commandLine.toString()
);
 
-        ClearCaseCheckOutCommand.setUseVWS( false );
-        commandLine = ClearCaseCheckOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
"testView" );
+        settings.setUseVWSParameter(false);
+        commandLine = checkOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
viewName, null );
         assertEquals( "cleartool mkview -snapshot -tag testView " + getWorkingDirectory().getCanonicalPath(),
                       commandLine.toString() );
 
-        ClearCaseCheckOutCommand.setIsClearCaseLT( true );
-        ClearCaseCheckOutCommand.setUseVWS( true );
-        commandLine = ClearCaseCheckOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
"testView" );
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_LT);
+        settings.setUseVWSParameter(true);
+        commandLine = checkOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
viewName, null );
+        assertEquals( "cleartool mkview -snapshot -tag testView " + getWorkingDirectory().getCanonicalPath(),
+                      commandLine.toString() );
+        
+        settings.setUseVWSParameter(false);
+        commandLine = checkOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
viewName, null );
         assertEquals( "cleartool mkview -snapshot -tag testView " + getWorkingDirectory().getCanonicalPath(),
                       commandLine.toString() );
+        
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_UCM);
+        String streamId = "streamIdentifier";
+        commandLine = checkOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
viewName, streamId );
+        assertEquals( "cleartool mkview -snapshot -tag testView -stream " + streamId + "
" + 
+            getWorkingDirectory().getCanonicalPath(), commandLine.toString() );
+        
+        settings.setUseVWSParameter(true);
+        commandLine = checkOutCommand.createCreateViewCommandLine( getWorkingDirectory(),
viewName, streamId );
+        assertEquals( "cleartool mkview -snapshot -tag testView -stream " + streamId + "
-vws " + checkOutCommand.getViewStore() +
+            "testView.vws " + getWorkingDirectory().getCanonicalPath(), commandLine.toString()
);
     }
 
     public void testUpdateConfigSpec()
     {
-        ClearCaseCheckOutCommand.setIsClearCaseLT( false );
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_DEFAULT);
+
         File configSpecLocation;
         if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "windows" ) >= 0 )
         {
@@ -70,13 +101,13 @@
             configSpecLocation = new File( "/clearcase/configspecs/testconfigspec.txt" );
         }
 
-        Commandline commandLine = ClearCaseCheckOutCommand.createUpdateConfigSpecCommandLine(
getWorkingDirectory(),
+        Commandline commandLine = checkOutCommand.createUpdateConfigSpecCommandLine( getWorkingDirectory(),
                                                                                         
     configSpecLocation,
                                                                                         
     "testView" );
         assertEquals( "cleartool setcs -tag testView " + configSpecLocation, commandLine.toString()
);
 
-        ClearCaseCheckOutCommand.setIsClearCaseLT( true );
-        commandLine = ClearCaseCheckOutCommand.createUpdateConfigSpecCommandLine( getWorkingDirectory(),
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_LT);
+        commandLine = checkOutCommand.createUpdateConfigSpecCommandLine( getWorkingDirectory(),
                                                                                   configSpecLocation,
"testView" );
         assertEquals( "cleartool setcs -tag testView " + configSpecLocation, commandLine.toString()
);
     }
@@ -84,10 +115,23 @@
     public void testCreateConfigSpec()
     {
         assertEquals( "element * CHECKEDOUT\n" + "element * /main/LATEST\n" + "load MYVOB/my/dir\n",
-                      ClearCaseCheckOutCommand
-                          .createConfigSpec( "MYVOB/my/dir", null ) );
+                checkOutCommand.createConfigSpec( "MYVOB/my/dir", null ) );
         assertEquals( "element * CHECKEDOUT\n" + "element * MYTAG\n" + "element -directory
* /main/LATEST\n" +
-            "load MYVOB/my/dir\n", ClearCaseCheckOutCommand
+            "load MYVOB/my/dir\n", checkOutCommand
             .createConfigSpec( "MYVOB/my/dir", new ScmBranch( "MYTAG" ) ) );
+    }
+    
+    public void testGetStreamIdentifier()
+    {
+        String streamName = "stream35_v1.0";
+        String vobName = "pVob_35";
+        String streamIdentifier = checkOutCommand.getStreamIdentifier(streamName, vobName);
+        assertEquals("stream:" + streamName + "@" + vobName, streamIdentifier);
+        
+        streamIdentifier = checkOutCommand.getStreamIdentifier(streamName, null);
+        assertNull(streamIdentifier);
+        
+        streamIdentifier = checkOutCommand.getStreamIdentifier(null, vobName);
+        assertNull(streamIdentifier);
     }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepositoryTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepositoryTest.java?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepositoryTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src/test/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepositoryTest.java
Wed Apr 11 01:16:43 2007
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.providers.clearcase.settings.Settings;
 import org.apache.maven.scm.repository.ScmRepositoryException;
 
 import java.io.File;
@@ -28,81 +29,152 @@
 
 /**
  * @author <a href="mailto:wim.deblauwe@gmail.com">Wim Deblauwe</a>
+ * @author <a href="mailto:antoine.veret@gmail.com">Antoine Veret</a>
  */
 public class ClearCaseScmProviderRepositoryTest
     extends TestCase
 {
-    public ClearCaseScmProviderRepositoryTest()
-    {
-    }
-
     public void testParsingUrlWithPipe()
         throws ScmRepositoryException, IOException
     {
+        Settings settings = new Settings();
         String viewName = "my_module_view";
         String configSpecPath = "//myserver/ClearCase/ConfigSpecs/mymodule.txt";
         String url = viewName + "|" + configSpecPath;
-        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url );
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings);
         assertEquals( new File( configSpecPath ).getPath(), repository.getConfigSpec().getPath()
);
         assertEquals( viewName, repository.getViewName( "bla" ) );
         assertNull( repository.getLoadDirectory() );
+        assertNull(repository.getStreamName());
+        assertNull(repository.getVobName());
     }
 
     public void testParsingUrlWithColon()
         throws ScmRepositoryException
     {
+        Settings settings = new Settings();
         String viewName = "my_module_view";
         String configSpecPath = "//myserver/ClearCase/ConfigSpecs/mymodule.txt";
         String url = viewName + ":" + configSpecPath;
-        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url );
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
         assertEquals( new File( configSpecPath ).getPath(), repository.getConfigSpec().getPath()
);
         assertEquals( viewName, repository.getViewName( "bla" ) );
         assertNull( repository.getLoadDirectory() );
+        assertNull(repository.getStreamName());
+        assertNull(repository.getVobName());
     }
 
     public void testParsingUrlWithoutViewName()
         throws ScmRepositoryException
     {
+        Settings settings = new Settings();
         String configSpecPath = "//myserver/ClearCase/ConfigSpecs/mymodule.txt";
         String url = configSpecPath;
-        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url );
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
         assertEquals( new File( configSpecPath ).getPath(), repository.getConfigSpec().getPath()
);
         assertNotNull( repository.getViewName( "15" ) );
         assertTrue( repository.getViewName( "15" ).indexOf( "15" ) != -1 );
         assertNull( repository.getLoadDirectory() );
+        assertNull(repository.getStreamName());
+        assertNull(repository.getVobName());
     }
 
     public void testAutoConfigSpecWithColon()
         throws Exception
     {
+        Settings settings = new Settings();
         String url = "my_view_name:load /VOB/some/dir";
-        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url );
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
         assertNull( repository.getConfigSpec() );
         assertTrue( repository.isAutoConfigSpec() );
         assertEquals( "my_view_name", repository.getViewName( "bla" ) );
         assertEquals( "/VOB/some/dir", repository.getLoadDirectory() );
+        assertNull(repository.getStreamName());
+        assertNull(repository.getVobName());
     }
 
     public void testAutoConfigSpecWithPipe()
         throws Exception
     {
+        Settings settings = new Settings();
         String url = "my_view_name|load /VOB/some/dir";
-        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url );
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
         assertNull( repository.getConfigSpec() );
         assertTrue( repository.isAutoConfigSpec() );
         assertEquals( "my_view_name", repository.getViewName( "bla" ) );
         assertEquals( "/VOB/some/dir", repository.getLoadDirectory() );
+        assertNull(repository.getStreamName());
+        assertNull(repository.getVobName());
     }
 
     public void testAutoConfigSpecWithoutViewName()
         throws Exception
     {
+        Settings settings = new Settings();
         String url = "load /VOB/some/dir";
-        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url );
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
         assertNull( repository.getConfigSpec() );
         assertTrue( repository.isAutoConfigSpec() );
         assertNotNull( repository.getViewName( "15" ) );
         assertTrue( repository.getViewName( "15" ).indexOf( "15" ) != -1 );
         assertEquals( "/VOB/some/dir", repository.getLoadDirectory() );
+        assertNull(repository.getStreamName());
+        assertNull(repository.getVobName());
+    }    
+    
+    public void testParsingUrlClearCaseUCMWithPipe()
+        throws ScmRepositoryException
+    {
+        Settings settings = new Settings();
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_UCM);
+        String delimiter = "|";
+        String viewName = "my_module_view";
+        String configSpecPath = "//myserver/ClearCase/ConfigSpecs/mymodule.txt";
+        String vobName = "pvob_alliance";
+        String streamName = "INT_COMMUN_V1.0";
+        String url = viewName + delimiter + configSpecPath + delimiter + vobName + delimiter
+ streamName;
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
+        assertEquals( new File( configSpecPath ).getPath(), repository.getConfigSpec().getPath()
);
+        assertEquals( viewName, repository.getViewName( "bla" ) );
+        assertNull( repository.getLoadDirectory() );
+        assertEquals(streamName, repository.getStreamName());
+        assertEquals(vobName, repository.getVobName());
+    }
+    
+    public void testParsingUrlClearCaseUCMWithoutViewnameWithColon()
+        throws ScmRepositoryException
+    {
+        Settings settings = new Settings();
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_UCM);
+        String delimiter = ":";
+        String configSpecPath = "//myserver/ClearCase/ConfigSpecs/mymodule.txt";
+        String vobName = "pvob_alliance";
+        String streamName = "INT_COMMUN_V1.0";
+        String url = configSpecPath + delimiter + vobName + delimiter + streamName;
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
+        assertEquals( new File( configSpecPath ).getPath(), repository.getConfigSpec().getPath()
);
+        assertNotNull( repository.getViewName( "bla" ) );
+        assertNull( repository.getLoadDirectory() );
+        assertEquals(streamName, repository.getStreamName());
+        assertEquals(vobName, repository.getVobName());
+    }
+    
+    public void testParsingUrlClearCaseUCMAutoConfig()
+        throws ScmRepositoryException
+    {
+        Settings settings = new Settings();
+        settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_UCM);
+        String delimiter = "|";
+        String loadPath = "/ua/sub/project";
+        String vobName = "pvob_alliance";
+        String streamName = "INT_COMMUN_V1.0";
+        String url = "load " + loadPath + delimiter + vobName + delimiter + streamName;
+        ClearCaseScmProviderRepository repository = new ClearCaseScmProviderRepository( new
DefaultLog(), url, settings );
+        assertNull( repository.getConfigSpec() );
+        assertTrue( repository.isAutoConfigSpec() );
+        assertNotNull( repository.getViewName( "bla" ) );
+        assertEquals( loadPath, repository.getLoadDirectory() );
+        assertEquals(streamName, repository.getStreamName());
+        assertEquals(vobName, repository.getVobName());
     }
 }

Modified: maven/scm/trunk/maven-scm-site/src/site/apt/clearcase.apt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-site/src/site/apt/clearcase.apt?view=diff&rev=527408&r1=527407&r2=527408
==============================================================================
--- maven/scm/trunk/maven-scm-site/src/site/apt/clearcase.apt (original)
+++ maven/scm/trunk/maven-scm-site/src/site/apt/clearcase.apt Wed Apr 11 01:16:43 2007
@@ -31,6 +31,18 @@
     
     * one load rule that is used by the ClearCase SCM provider to automatically generate
a config spec when creating a view.
 
+** ClearCase UCM
+
+		If you are using ClearCase UCM, the URL format is the following
+		
+-------
+scm:clearcase<delimiter>[view_name]<delimiter>config_spec<delimiter>vob_name<delimiter>stream_name
+-------
+
+    <vob_name>: Identifier of the ClearCase VOB
+
+    <stream_name>: Name of the project's Stream
+
 ** User-supplied config spec
 
    If you specify the location of an user-supplied config spec file in the SCM URL, this
config spec is used each time
@@ -146,16 +158,23 @@
 </clearcase-settings>
 -------
 
-** ClearCase LT
+** ClearCase Type
+
+    By default, the ClearCase SCM provider uses commands appropriate for the full ClearCase
version. If you are using ClearCase LT or 
+    ClearCase UCM instead, you must specify this fact in the clearcase-settings.xml file.
+
+-------
+<clearcase-settings>
+    <clearcaseType>UCM</clearcaseType>
+</clearcase-settings>
+-------
 
-    By default, the ClearCase SCM provider uses commands appropriate for the full ClearCase
version. If you are using ClearCase LT instead,
-    you must specify this fact in the clearcase-settings.xml file.
     As ClearCase LT uses a predefined and unchangeable folder as the viewstore directory,
you should also specify the viewstore
     root location in the clearcase-settings.xml file:
     
 -------
 <clearcase-settings>
-    <clearcaseLT>true</clearcaseLT>
+    <clearcaseType>LT</clearcaseType>
     <viewstore>\\mymachine\myvwstore</viewstore>
 </clearcase-settings>
 -------



Mime
View raw message