maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r691200 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/src: main/java/org/apache/maven/scm/provider/clearcase/command/checkout/ main/java/org/apache/maven/scm/provider/clearcase/repository/ test/java/org/apache/maven...
Date Tue, 02 Sep 2008 11:23:32 GMT
Author: vsiveton
Date: Tue Sep  2 04:23:31 2008
New Revision: 691200

URL: http://svn.apache.org/viewvc?rev=691200&view=rev
Log:
SCM-357: UCM config_spec are not managed correctly
Submitted by: Tim Delesio

o patch applied

Modified:
    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/test/java/org/apache/maven/scm/provider/clearcase/repository/ClearCaseScmProviderRepositoryTest.java

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?rev=691200&r1=691199&r2=691200&view=diff
==============================================================================
--- 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
Tue Sep  2 04:23:31 2008
@@ -118,7 +118,15 @@
                 {
 
                     // write config spec to temp file
-                    String configSpec = createConfigSpec( repo.getLoadDirectory(), version
);
+                    String configSpec;
+                    if ( repo.hasElements() )
+                    {
+                        configSpec = createConfigSpec( repo.getLoadDirectory(), version );
+                    }
+                    else
+                    {
+                        configSpec = createConfigSpec( repo.getLoadDirectory(), repo.getElementName(),
version );
+                    }
                     getLogger().info( "Created config spec for view '" + viewName + "':\n"
+ configSpec );
                     configSpecLocation = writeTemporaryConfigSpecFile( configSpec, viewName
);
 
@@ -213,6 +221,25 @@
         {
             configSpec.append( "element * " + version.getName() + "\n" );
             configSpec.append( "element -directory * /main/LATEST\n" );
+            // configSpec.append( "element * /main/QualityControl_INT/RAD7_Migration/LATEST\n"
);
+        }
+        else
+        {
+            configSpec.append( "element * /main/LATEST\n" );
+        }
+        configSpec.append( "load " + loadDirectory + "\n" );
+        return configSpec.toString();
+    }
+
+    protected String createConfigSpec( String loadDirectory, String elementName, ScmVersion
version )
+    {
+        // create config spec
+        StringBuffer configSpec = new StringBuffer();
+        configSpec.append( "element * CHECKEDOUT\n" );
+        if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
+        {
+            configSpec.append( "element * " + version.getName() + "\n" );
+            configSpec.append( "element * " + elementName + "\n" );
         }
         else
         {

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?rev=691200&r1=691199&r2=691200&view=diff
==============================================================================
--- 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
Tue Sep  2 04:23:31 2008
@@ -90,6 +90,11 @@
     private Settings settings;
 
     /**
+     * Describe the Element Name
+     */
+    private String elementName;
+
+    /**
      * Define the flag used in the clearcase-settings.xml when using ClearCaseLT
      */
     public static final String CLEARCASE_LT = "LT";
@@ -193,6 +198,7 @@
         throws UnknownHostException, MalformedURLException
     {
         int tokenNumber = tokenizer.countTokens();
+        String directory;
         if ( tokenNumber <= 2 )
         {
             throw new MalformedURLException( "ClearCaseUCM need more parameters. Expected
url format : "
@@ -208,15 +214,43 @@
             vobName = tokenizer.nextToken();
             streamName = tokenizer.nextToken();
         }
+        else if ( tokenNumber == 4 )
+        {
+            String[] tokens = new String[4];
+            tokens[0] = tokenizer.nextToken();
+            tokens[1] = tokenizer.nextToken();
+            tokens[2] = tokenizer.nextToken();
+            tokens[3] = tokenizer.nextToken();
+
+            if ( tokens[3].startsWith( "/main/" ) )
+            {
+                viewName = getDefaultViewName();
+                configSpecString = tokens[0];
+                vobName = tokens[1];
+                streamName = tokens[2];
+                elementName = tokens[3];
+            }
+            else
+            {
+                viewName = tokens[0];
+                viewNameGivenByUser = true;
+                configSpecString = tokens[1];
+                vobName = tokens[2];
+                streamName = tokens[3];
+            }
+        }
         else
         {
             configSpecString = checkViewName( tokenizer );
             vobName = tokenizer.nextToken();
             streamName = tokenizer.nextToken();
-            checkUnexpectedParameter( tokenizer, tokenNumber, 4 );
+            elementName = tokenizer.nextToken();
+            checkUnexpectedParameter( tokenizer, tokenNumber, 5 );
         }
+
         logger.info( "viewName = '" + viewName + "' ; configSpec = '" + configSpecString
+ "' ; vobName = '"
-            + vobName + "' ; streamName = '" + streamName + "'" );
+            + vobName + "' ; streamName = '" + streamName + "' ; elementName = '" + elementName
+ "'" );
+
         return configSpecString;
     }
 
@@ -232,6 +266,7 @@
         {
             viewName = getDefaultViewName();
         }
+
         return tokenizer.nextToken();
     }
 
@@ -344,4 +379,19 @@
     {
         return vobName;
     }
+
+    public String getElementName()
+    {
+        return elementName;
+    }
+
+    public boolean hasElements()
+    {
+        if ( elementName == null )
+        {
+            return false;
+        }
+
+        return true;
+    }
 }

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?rev=691200&r1=691199&r2=691200&view=diff
==============================================================================
--- 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
Tue Sep  2 04:23:31 2008
@@ -120,8 +120,8 @@
         assertEquals( "/VOB/some/dir", repository.getLoadDirectory() );
         assertNull(repository.getStreamName());
         assertNull(repository.getVobName());
-    }    
-    
+    }
+
     public void testParsingUrlClearCaseUCMWithPipe()
         throws ScmRepositoryException
     {
@@ -140,7 +140,7 @@
         assertEquals(streamName, repository.getStreamName());
         assertEquals(vobName, repository.getVobName());
     }
-    
+
     public void testParsingUrlClearCaseUCMWithoutViewnameWithColon()
         throws ScmRepositoryException
     {
@@ -158,7 +158,28 @@
         assertEquals(streamName, repository.getStreamName());
         assertEquals(vobName, repository.getVobName());
     }
-    
+
+    public void testParsingUrlClearCaseUCMWithoutViewnameWithColonAndElement()
+        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 elementName = "/main/element/LATEST";
+        String url = configSpecPath + delimiter + vobName + delimiter + streamName + delimiter
+ elementName;
+        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() );
+        assertEquals( elementName, repository.getElementName() );
+    }
+
     public void testParsingUrlClearCaseUCMAutoConfig()
         throws ScmRepositoryException
     {
@@ -177,4 +198,26 @@
         assertEquals(streamName, repository.getStreamName());
         assertEquals(vobName, repository.getVobName());
     }
+
+    public void testParsingUrlClearCaseUCMAutoConfigWithElement()
+        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 elementName = "/main/element/LATEST";
+        String url = "load " + loadPath + delimiter + vobName + delimiter + streamName +
delimiter + elementName;
+        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() );
+        assertEquals( elementName, repository.getElementName() );
+    }
 }



Mime
View raw message