maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1067549 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src: main/java/org/apache/maven/scm/provider/synergy/ main/java/org/apache/maven/scm/provider/synergy/command/add/ main/java/org/apache/maven/scm/provider/synergy...
Date Sat, 05 Feb 2011 23:13:10 GMT
Author: olamy
Date: Sat Feb  5 23:13:10 2011
New Revision: 1067549

URL: http://svn.apache.org/viewvc?rev=1067549&view=rev
Log:
[SCM-553] release:prepare not working with synergy scm-provider
Submitted by Jan Malcomess

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumer.java
      - copied, changed from r1067545, maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyTaskManager.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumerTest.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskNotSet.txt
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskSet.txt
  (with props)
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/SynergyScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/add/SynergyAddCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/changelog/SynergyChangeLogCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkin/SynergyCheckInCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkout/SynergyCheckOutCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/edit/SynergyEditCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/remove/SynergyRemoveCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/tag/SynergyTagCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/unedit/SynergyUnEditCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyCCM.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyUtil.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/util/SynergyCCMTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/SynergyScmProvider.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/SynergyScmProvider.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/SynergyScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/SynergyScmProvider.java
Sat Feb  5 23:13:10 2011
@@ -58,6 +58,10 @@ public class SynergyScmProvider
     public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter
)
         throws ScmRepositoryException
     {
+    	if (getLogger().isDebugEnabled())
+    	{
+    		getLogger().debug("Creating SynergyScmProviderRepository...");
+    	}
         return new SynergyScmProviderRepository( scmSpecificUrl );
     }
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/add/SynergyAddCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/add/SynergyAddCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/add/SynergyAddCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/add/SynergyAddCommand.java
Sat Feb  5 23:13:10 2011
@@ -76,7 +76,7 @@ public class SynergyAddCommand
                 SynergyUtil.getWorkingProject( getLogger(), repo.getProjectSpec(), repo.getUser(),
ccmAddr );
             if ( projectSpec == null )
             {
-                throw new ScmException( "You should checkout project first" );
+                throw new ScmException( "You should checkout a working project first" );
             }
             File waPath = SynergyUtil.getWorkArea( getLogger(), projectSpec, ccmAddr );
             File destPath = new File( waPath, repo.getProjectName() );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/changelog/SynergyChangeLogCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/changelog/SynergyChangeLogCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/changelog/SynergyChangeLogCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/changelog/SynergyChangeLogCommand.java
Sat Feb  5 23:13:10 2011
@@ -74,7 +74,7 @@ public class SynergyChangeLogCommand
                 SynergyUtil.getWorkingProject( getLogger(), repo.getProjectSpec(), repo.getUser(),
ccmAddr );
             if ( projectSpec == null )
             {
-                throw new ScmException( "You should checkout project first" );
+                throw new ScmException( "You should checkout a working project first" );
             }
             List<SynergyTask> tasks = SynergyUtil.getCompletedTasks( getLogger(), projectSpec,
startDate, endDate, ccmAddr );
             for (SynergyTask t : tasks )

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkin/SynergyCheckInCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkin/SynergyCheckInCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkin/SynergyCheckInCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkin/SynergyCheckInCommand.java
Sat Feb  5 23:13:10 2011
@@ -33,6 +33,7 @@ import org.apache.maven.scm.command.chec
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.synergy.command.SynergyCommand;
 import org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository;
+import org.apache.maven.scm.provider.synergy.util.SynergyTaskManager;
 import org.apache.maven.scm.provider.synergy.util.SynergyUtil;
 
 /**
@@ -52,21 +53,21 @@ public class SynergyCheckInCommand
     {
         if ( getLogger().isDebugEnabled() )
         {
-            getLogger().debug( "executing update command..." );
+            getLogger().debug( "executing checkin command..." );
         }
 
         SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
 
         if ( getLogger().isDebugEnabled() )
         {
-            getLogger().debug( "basedir: " + fileSet.getBasedir() );
+            getLogger().debug( fileSet.toString() );
         }
 
         String ccmAddr = SynergyUtil.start( getLogger(), repo.getUser(), repo.getPassword(),
null );
 
         try
         {
-            SynergyUtil.checkinDefaultTask( getLogger(), message, ccmAddr );
+            SynergyTaskManager.getInstance().checkinDefaultTask( getLogger(), message, ccmAddr
);
         }
         finally
         {

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkout/SynergyCheckOutCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkout/SynergyCheckOutCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkout/SynergyCheckOutCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/checkout/SynergyCheckOutCommand.java
Sat Feb  5 23:13:10 2011
@@ -66,7 +66,7 @@ public class SynergyCheckOutCommand
 
         if ( getLogger().isDebugEnabled() )
         {
-            getLogger().debug( "basedir: " + fileSet.getBasedir() );
+            getLogger().debug( fileSet.toString() );
         }
 
         String ccmAddr = SynergyUtil.start( getLogger(), repo.getUser(), repo.getPassword(),
null );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/edit/SynergyEditCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/edit/SynergyEditCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/edit/SynergyEditCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/edit/SynergyEditCommand.java
Sat Feb  5 23:13:10 2011
@@ -36,6 +36,7 @@ import org.apache.maven.scm.command.edit
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.synergy.command.SynergyCommand;
 import org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository;
+import org.apache.maven.scm.provider.synergy.util.SynergyTaskManager;
 import org.apache.maven.scm.provider.synergy.util.SynergyUtil;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -60,7 +61,7 @@ public class SynergyEditCommand
 
         if ( getLogger().isDebugEnabled() )
         {
-            getLogger().debug( "basedir: " + fileSet.getBasedir() );
+            getLogger().debug( fileSet.toString() );
         }
 
         String ccmAddr = SynergyUtil.start( getLogger(), repo.getUser(), repo.getPassword(),
null );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/remove/SynergyRemoveCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/remove/SynergyRemoveCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/remove/SynergyRemoveCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/remove/SynergyRemoveCommand.java
Sat Feb  5 23:13:10 2011
@@ -67,7 +67,7 @@ public class SynergyRemoveCommand
                 SynergyUtil.getWorkingProject( getLogger(), repo.getProjectSpec(), repo.getUser(),
ccmAddr );
             if ( projectSpec == null )
             {
-                throw new ScmException( "You should checkout project first" );
+                throw new ScmException( "You should checkout a working project first" );
             }
             File waPath = SynergyUtil.getWorkArea( getLogger(), projectSpec, ccmAddr );
             File destPath = new File( waPath, repo.getProjectName() );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/tag/SynergyTagCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/tag/SynergyTagCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/tag/SynergyTagCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/tag/SynergyTagCommand.java
Sat Feb  5 23:13:10 2011
@@ -75,6 +75,11 @@ public class SynergyTagCommand
 
         try
         {
+        	// Make sure, that all changes made until now are reflected in the prep project
+        	// this is especially true for all changes made by maven (ie versions in the poms).
+        	SynergyUtil.reconfigureProperties( getLogger(), repo.getProjectSpec(), ccmAddr );
+        	SynergyUtil.reconfigure( getLogger(), repo.getProjectSpec(), ccmAddr);
+        	
             SynergyUtil.createBaseline( getLogger(), repo.getProjectSpec(), tag, repo.getProjectRelease(),
repo
                 .getProjectPurpose(), ccmAddr );
         }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/unedit/SynergyUnEditCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/unedit/SynergyUnEditCommand.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/unedit/SynergyUnEditCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/command/unedit/SynergyUnEditCommand.java
Sat Feb  5 23:13:10 2011
@@ -70,7 +70,7 @@ public class SynergyUnEditCommand
                 SynergyUtil.getWorkingProject( getLogger(), repo.getProjectSpec(), repo.getUser(),
ccmAddr );
             if ( projectSpec == null )
             {
-                throw new ScmException( "You should checkout project first" );
+                throw new ScmException( "You should checkout a working project first" );
             }
             File waPath = SynergyUtil.getWorkArea( getLogger(), projectSpec, ccmAddr );
             File destPath = new File( waPath, repo.getProjectName() );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java
Sat Feb  5 23:13:10 2011
@@ -49,7 +49,7 @@ public class SynergyGetWorkingProjectCon
     {
         if ( logger.isDebugEnabled() )
         {
-            logger.debug( line );
+            logger.debug( "Consume: " + line );
         }
         if ( !line.trim().equals( "" ) )
         {

Copied: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumer.java
(from r1067545, maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java)
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumer.java?p2=maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumer.java&p1=maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java&r1=1067545&r2=1067549&rev=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyGetWorkingProjectConsumer.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumer.java
Sat Feb  5 23:13:10 2011
@@ -20,45 +20,50 @@ package org.apache.maven.scm.provider.sy
  */
 
 import org.apache.maven.scm.log.ScmLogger;
-import org.codehaus.plexus.util.cli.StreamConsumer;
+import org.apache.maven.scm.util.AbstractConsumer;
 
 /**
- * Parse output of
- * <p/>
- * <pre>
- *  ccm wa -show -p &lt;project_spec&gt;
- * </pre>
- *
- * @author <a href="mailto:julien.henry@capgemini.com">Julien Henry</a>
- * @version $Id$
+ * @author <a href="jan.malcomess@steria-mummert.de">Jan Malcomess</a>
+ * @since 1.5
  */
-public class SynergyGetWorkingProjectConsumer
-    implements StreamConsumer
+public class SynergyShowDefaultTaskConsumer
+    extends AbstractConsumer
 {
-    private ScmLogger logger;
 
-    private String projectSpec;
+    private int task;
 
-    public SynergyGetWorkingProjectConsumer( ScmLogger logger )
+    /**
+     * @return the number of the current (ie default) task. 0 if current task 
+     * 		   is not set.
+     */
+    public int getTask()
     {
-        this.logger = logger;
+        return task;
     }
 
-    /** {@inheritDoc} */
+    public SynergyShowDefaultTaskConsumer( ScmLogger logger )
+    {
+        super( logger );
+    }
+
+    /**
+     * Either <br>
+     * <code>taskNumber: taskSynopsis</code><br>
+     * or <br>
+     * <code>The current task is not set.</code><br>
+     *
+     * {@inheritDoc}
+     */
     public void consumeLine( String line )
     {
-        if ( logger.isDebugEnabled() )
+        if ( getLogger().isDebugEnabled() )
         {
-            logger.debug( line );
+            getLogger().debug( "Consume: " + line );
         }
-        if ( !line.trim().equals( "" ) )
+        if ( !line.contains( "not set" ) )
         {
-            projectSpec = line.trim();
+        	task = Integer.parseInt( line.substring( 0, line.indexOf( ':' ) ) );
         }
     }
 
-    public String getProjectSpec()
-    {
-        return projectSpec;
-    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyCCM.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyCCM.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyCCM.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyCCM.java
Sat Feb  5 23:13:10 2011
@@ -852,5 +852,45 @@ public class SynergyCCM
 
         return cl;
     }
+    
+    /**
+     * Create commandline to get current (i.e. default) task
+     * 
+     * @param ccmAddr current Synergy session ID
+     * @return 
+     * @throws ScmException
+     */
+    public static Commandline showDefaultTask( String ccmAddr ) 
+    	throws ScmException
+    {
+    	Commandline cl = new Commandline();
 
+        configureEnvironment( cl, ccmAddr );
+        cl.setExecutable( CCM );
+        cl.createArg().setValue( TASK );
+        cl.createArg().setValue( "-default" );
+        
+        return cl;
+    }
+    
+    /**
+     * Create commandline to set current (i.e. default) task
+     * 
+     * @param task	  the number of the task to set as current task
+     * @param ccmAddr current Synergy session ID
+     * @return 
+     * @throws ScmException
+     */
+    public static Commandline setDefaultTask( int task, String ccmAddr ) 
+    	throws ScmException
+    {
+    	Commandline cl = new Commandline();
+
+        configureEnvironment( cl, ccmAddr );
+        cl.setExecutable( CCM );
+        cl.createArg().setValue( TASK );
+        cl.createArg().setValue( "-default" );
+        cl.createArg().setValue( String.valueOf( task ) );
+        return cl;
+    }
 }

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyTaskManager.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyTaskManager.java?rev=1067549&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyTaskManager.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyTaskManager.java
Sat Feb  5 23:13:10 2011
@@ -0,0 +1,182 @@
+package org.apache.maven.scm.provider.synergy.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.log.ScmLogger;
+
+/**
+ * In some Synergy versions (ie. 6.5) closing a session results in de-selecting
+ * the current (default) task. Therefore, the maven release-plugin fails, as the
+ * Synergy commands, as implemented in the Synergy-SCM-Provider, always close
+ * their session after being executed.<br>
+ * This manager circumvents this problem by storing the last created task which
+ * causes all check outs to be associated with it. Then, when this task gets
+ * checked in, all associated files get checked in as well.
+ * 
+ * @author <a href="jan.malcomess@steria-mummert.de">Jan Malcomess</a>
+ * @since 1.5
+ */
+public class SynergyTaskManager
+{
+    /**
+     * No Synergy-Task was created yet.
+     */
+    private final static short TASK_STATE_NONE = 0;
+
+    /**
+     * The current Synergy-Task is created but not yet completed.
+     */
+    private final static short TASK_STATE_CREATED = 1;
+
+    /**
+     * The current Synergy-Task is completed.
+     */
+    private final static short TASK_STATE_COMPLETED = 2;
+
+    /**
+     * singleton instance.
+     */
+    private final static SynergyTaskManager INSTANCE = new SynergyTaskManager();
+
+    /**
+     * The number of the current Synergy-Task.
+     */
+    private int currentTaskNumber;
+
+    /**
+     * The state of the current Synergy-Task.
+     */
+    private short currentTaskState = TASK_STATE_NONE;
+
+    /**
+     * @return singleton instance.
+     */
+    public static SynergyTaskManager getInstance()
+    {
+        return INSTANCE;
+    }
+
+    /**
+     * If necessary create a new task. Otherwise return the current task.
+     * 
+     * @param logger a logger.
+     * @param synopsis short description of task.
+     * @param release release.
+     * @param defaultTask should this task become the default task?
+     * @param ccmAddr current Synergy session ID. Used to run in multi-session.
+     * @return Task number
+     * @throws ScmException
+     */
+    public int createTask( ScmLogger logger, String synopsis, String release, boolean defaultTask,
String ccmAddr )
+        throws ScmException
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "Synergy : Entering createTask method of SynergyTaskManager" );
+        }
+        switch ( currentTaskState )
+        {
+            case TASK_STATE_CREATED:
+                if ( defaultTask )
+                {
+                    // make sure the current task is the default task
+                    if ( SynergyUtil.getDefaultTask( logger, ccmAddr ) != currentTaskNumber
)
+                    {
+                        SynergyUtil.setDefaultTask( logger, currentTaskNumber, ccmAddr );
+                    }
+                }
+                break;
+            case TASK_STATE_NONE: // fall through
+            case TASK_STATE_COMPLETED:
+                currentTaskNumber = SynergyUtil.createTask( logger, synopsis, release, defaultTask,
ccmAddr );
+                currentTaskState = TASK_STATE_CREATED;
+                break;
+            default:
+                throw new IllegalStateException( "Programming error: SynergyTaskManager is
in unkown state." );
+        }
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "createTask returns " + currentTaskNumber );
+        }
+        return currentTaskNumber;
+    }
+
+    /**
+     * Check in (that is: complete) the default task. This is either the current task managed
by
+     * <code>SynergyTaskManager</code> or, if none is managed, the default task.<br>
+     * In case no task has yet been created by <code>SynergyTaskManager</code>
AND no default task is set, then this is
+     * an error.<br>
+     * However, if the task that was created by <code>SynergyTaskManager</code>
has already been checked in AND no
+     * default task is set, then it is assumed that all files that were checked out are already
checked in because
+     * checking in a task checks in all files associated with it.
+     * 
+     * @param logger a logger.
+     * @param comment a comment for checkin.
+     * @param ccmAddr current Synergy session ID. Used to run in multi-session.
+     * @throws ScmException
+     */
+    public void checkinDefaultTask( ScmLogger logger, String comment, String ccmAddr )
+        throws ScmException
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "Synergy : Entering checkinDefaultTask method of SynergyTaskManager"
);
+        }
+        switch ( currentTaskState )
+        {
+            case TASK_STATE_NONE:
+                // if a default task is set, then check in that
+                // otherwise we have an error
+                if ( SynergyUtil.getDefaultTask( logger, ccmAddr ) != 0 )
+                {
+                    SynergyUtil.checkinDefaultTask( logger, comment, ccmAddr );
+                }
+                else
+                {
+                    throw new ScmException(
+                                            "Check in not possible: no default task is set
and no task has been created with SynergyTaskManager." );
+                }
+                break;
+            case TASK_STATE_CREATED:
+                SynergyUtil.checkinTask( logger, currentTaskNumber, comment, ccmAddr );
+                currentTaskState = TASK_STATE_COMPLETED;
+                break;
+            case TASK_STATE_COMPLETED:
+                // if a default task is set, then check in that
+                // otherwise do nothing, as all tasks and all files with them have
+                // been checked in
+                if ( SynergyUtil.getDefaultTask( logger, ccmAddr ) != 0 )
+                {
+                    SynergyUtil.checkinDefaultTask( logger, comment, ccmAddr );
+                }
+                else
+                {
+                    if ( logger.isDebugEnabled() )
+                    {
+                        logger.debug( "Synergy : No check in necessary as default task and
all tasks created with SynergyTaskManager have already been checked in." );
+                    }
+                }
+                break;
+            default:
+                throw new IllegalStateException( "Programming error: SynergyTaskManager is
in unkown state." );
+        }
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyTaskManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyTaskManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyUtil.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyUtil.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyUtil.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/main/java/org/apache/maven/scm/provider/synergy/util/SynergyUtil.java
Sat Feb  5 23:13:10 2011
@@ -36,6 +36,7 @@ import org.apache.maven.scm.provider.syn
 import org.apache.maven.scm.provider.synergy.consumer.SynergyGetTaskObjectsConsumer;
 import org.apache.maven.scm.provider.synergy.consumer.SynergyGetWorkingFilesConsumer;
 import org.apache.maven.scm.provider.synergy.consumer.SynergyGetWorkingProjectConsumer;
+import org.apache.maven.scm.provider.synergy.consumer.SynergyShowDefaultTaskConsumer;
 import org.apache.maven.scm.provider.synergy.consumer.SynergyWorkareaConsumer;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
@@ -315,7 +316,7 @@ public class SynergyUtil
     {
         if ( logger.isDebugEnabled() )
         {
-            logger.debug( "Synergy : Entering createTask method" );
+            logger.debug( "Synergy : Entering createTask method of SynergyUtil" );
         }
 
         if ( synopsis == null || synopsis.equals( "" ) )
@@ -609,6 +610,62 @@ public class SynergyUtil
         executeSynergyCommand( logger, cl, stderr, stdout, true );
 
     }
+    
+    /**
+     * Get the number of the current (ie default) task.
+     * 
+     * @param logger  a logger.
+     * @param ccmAddr current Synergy session id.
+     * @return the number of the current (ie default) task. 0 if current task 
+     * 		   is not set.
+     * @throws ScmException
+     */
+    public static int getDefaultTask( ScmLogger logger, String ccmAddr )
+    	throws ScmException
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "Synergy : Entering getDefaultTask method" );
+        }
+
+        Commandline cl = SynergyCCM.showDefaultTask( ccmAddr );
+
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+        SynergyShowDefaultTaskConsumer stdout = new SynergyShowDefaultTaskConsumer(logger);
+
+        int errorCode = executeSynergyCommand( logger, cl, stderr, stdout, false );
+
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "getDefaultTask returns " + stdout.getTask() + " with error code
" + errorCode );
+        }
+
+        return stdout.getTask();
+    }
+    
+    /**
+     * Set the current (ie default) task.
+     * 
+     * @param logger  a logger.
+     * @param task	  the number of the task to set as current task. 
+     * @param ccmAddr current Synergy session id.
+     * @throws ScmException
+     */
+    public static void setDefaultTask( ScmLogger logger, int task, String ccmAddr )
+    	throws ScmException
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "Synergy : Entering setDefaultTask method" );
+        }
+
+        Commandline cl = SynergyCCM.setDefaultTask( task, ccmAddr );
+
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
+
+        executeSynergyCommand( logger, cl, stderr, stdout, true );
+    }
 
     /**
      * Synchronize a given project.

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumerTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumerTest.java?rev=1067549&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumerTest.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumerTest.java
Sat Feb  5 23:13:10 2011
@@ -0,0 +1,89 @@
+package org.apache.maven.scm.provider.synergy.consumer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.log.DefaultLog;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * @author <a href="mailto:jan.malcomess@steria-mummert.de">Jan Malcomess</a>
+ */
+public class SynergyShowDefaultTaskConsumerTest
+    extends ScmTestCase
+{
+    public void testShowDefaultTaskSet()
+        throws IOException
+    {
+        InputStream inputStream = getResourceAsStream( "/synergy/consumer/showDefaultTaskSet.txt"
);
+
+        try
+        {
+            BufferedReader in = new BufferedReader( new InputStreamReader( inputStream )
);
+
+            String s = in.readLine();
+
+            SynergyShowDefaultTaskConsumer consumer = new SynergyShowDefaultTaskConsumer(
new DefaultLog() );
+
+            while ( s != null )
+            {
+                consumer.consumeLine( s );
+
+                s = in.readLine();
+            }
+            assertEquals( 52885, consumer.getTask() );
+        }
+        finally
+        {
+            inputStream.close();
+        }
+    }
+
+    public void testShowDefaultTaskNotSet()
+        throws IOException
+    {
+        InputStream inputStream = getResourceAsStream( "/synergy/consumer/showDefaultTaskNotSet.txt"
);
+
+        try
+        {
+            BufferedReader in = new BufferedReader( new InputStreamReader( inputStream )
);
+
+            String s = in.readLine();
+
+            SynergyShowDefaultTaskConsumer consumer = new SynergyShowDefaultTaskConsumer(
new DefaultLog() );
+
+            while ( s != null )
+            {
+                consumer.consumeLine( s );
+
+                s = in.readLine();
+            }
+            assertEquals( 0, consumer.getTask() );
+        }
+        finally
+        {
+            inputStream.close();
+        }
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/consumer/SynergyShowDefaultTaskConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/util/SynergyCCMTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/util/SynergyCCMTest.java?rev=1067549&r1=1067548&r2=1067549&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/util/SynergyCCMTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/java/org/apache/maven/scm/provider/synergy/util/SynergyCCMTest.java
Sat Feb  5 23:13:10 2011
@@ -416,6 +416,23 @@ public class SynergyCCMTest
         assertTrue( "CCM_ADDR is not set.", assertContains( cl.getEnvironmentVariables(),
"CCM_ADDR=CCM_ADDR" ) );
         assertCommandLine( "ccm delimiter", null, cl );
     }
+    
+    public void testShowDefaultTask()
+    	throws Exception
+    {
+    	Commandline cl = SynergyCCM.showDefaultTask( "CCM_ADDR" );
+    	assertTrue( "CCM_ADDR is not set.", assertContains( cl.getEnvironmentVariables(), "CCM_ADDR=CCM_ADDR"
) );
+    	assertCommandLine( "ccm task -default", null, cl );
+    }
+    
+    public void testSetDefaultTask()
+		throws Exception
+	{
+    	Commandline cl = SynergyCCM.setDefaultTask( 4711, "CCM_ADDR" );
+    	assertTrue( "CCM_ADDR is not set.", assertContains( cl.getEnvironmentVariables(), "CCM_ADDR=CCM_ADDR"
) );
+    	assertCommandLine( "ccm task -default 4711", null, cl );
+	}
+    
 
     public boolean assertContains( String[] array, String value )
     {

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskNotSet.txt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskNotSet.txt?rev=1067549&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskNotSet.txt
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskNotSet.txt
Sat Feb  5 23:13:10 2011
@@ -0,0 +1 @@
+The current task is not set.
\ No newline at end of file

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskNotSet.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskNotSet.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskSet.txt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskSet.txt?rev=1067549&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskSet.txt
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskSet.txt
Sat Feb  5 23:13:10 2011
@@ -0,0 +1 @@
+52885: New Task for dummy
\ No newline at end of file

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskSet.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-synergy/src/test/resources/synergy/consumer/showDefaultTaskSet.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message