maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r354867 - in /maven/scm/trunk: maven-scm-api/src/main/java/org/apache/maven/scm/provider/ maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provide...
Date Wed, 07 Dec 2005 21:35:32 GMT
Author: evenisse
Date: Wed Dec  7 13:34:56 2005
New Revision: 354867

URL: http://svn.apache.org/viewcvs?rev=354867&view=rev
Log:
PR: SCM-102
Submitted by: Dan Tran

Add scm:edit/unedit to plugin and starteam provider

Added:
    maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/EditMojo.java
  (with props)
    maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UnEditMojo.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumer.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumer.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumerTest.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumerTest.java
  (with props)
Modified:
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/StarteamScmProvider.java

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java?rev=354867&r1=354866&r2=354867&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
Wed Dec  7 13:34:56 2005
@@ -330,7 +330,8 @@
 
     protected EditScmResult edit( ScmRepository repository, ScmFileSet fileSet, CommandParameters
parameters ) throws ScmException
     {
-        System.out.println( "AbstractScmProvider.edit" );
+        this.getLogger().warn( "Provider " + repository.getProvider()+ " does not support
edit operation." ) ;
+        
         return new EditScmResult( "", null, null, true );
     }
 
@@ -345,6 +346,8 @@
 
     protected UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet, CommandParameters
parameters ) throws ScmException
     {
+        this.getLogger().warn( "Provider " + repository.getProvider()+ " does not support
unedit operation." ) ;
+        
         return new UnEditScmResult( "", null, null, true );
     }
 

Added: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/EditMojo.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/EditMojo.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/EditMojo.java
(added)
+++ maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/EditMojo.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,58 @@
+package org.apache.maven.scm.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.plugin.MojoExecutionException;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.command.edit.EditScmResult;
+import org.apache.maven.scm.repository.ScmRepository;
+
+import java.io.IOException;
+
+/**
+ * Edit/lock a set of files
+ * @goal edit
+ *
+ * @author <a href="dantran@apache.org">Dan Tran</a>
+ * @version $Id$
+ */
+public class EditMojo
+    extends AbstractScmMojo
+{
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        try
+        {
+            ScmRepository repository = getScmRepository();
+
+            EditScmResult result = getScmManager().getProviderByRepository( repository ).edit(
repository, getFileSet() );
+                                                                                        
             
+            checkResult( result );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Cannot run edit command : ", e );
+        }
+        catch ( ScmException e )
+        {
+            throw new MojoExecutionException( "Cannot run edit command : ", e );
+        }
+    }
+    
+}

Propchange: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/EditMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/EditMojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UnEditMojo.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UnEditMojo.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UnEditMojo.java
(added)
+++ maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UnEditMojo.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,58 @@
+package org.apache.maven.scm.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.plugin.MojoExecutionException;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.command.unedit.UnEditScmResult;
+import org.apache.maven.scm.repository.ScmRepository;
+
+import java.io.IOException;
+
+/**
+ * Unedit/unlock a set of files
+ * @goal unedit
+ *
+ * @author <a href="dantran@apache.org">Dan Tran</a>
+ * @version $Id$
+ */
+public class UnEditMojo
+    extends AbstractScmMojo
+{
+    
+    public void execute()
+        throws MojoExecutionException
+    {
+        try
+        {
+            ScmRepository repository = getScmRepository();
+
+            UnEditScmResult result = getScmManager().getProviderByRepository( repository
).unedit( repository,
+                                                                                        
        getFileSet() );
+
+            checkResult( result );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Cannot run unedit command : ", e );
+        }
+        catch ( ScmException e )
+        {
+            throw new MojoExecutionException( "Cannot run unedit command : ", e );
+        }
+    }
+}

Propchange: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UnEditMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UnEditMojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/StarteamScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/StarteamScmProvider.java?rev=354867&r1=354866&r2=354867&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/StarteamScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/StarteamScmProvider.java
Wed Dec  7 13:34:56 2005
@@ -24,8 +24,10 @@
 import org.apache.maven.scm.command.checkin.CheckInScmResult;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
 import org.apache.maven.scm.command.diff.DiffScmResult;
+import org.apache.maven.scm.command.edit.EditScmResult;
 import org.apache.maven.scm.command.status.StatusScmResult;
 import org.apache.maven.scm.command.tag.TagScmResult;
+import org.apache.maven.scm.command.unedit.UnEditScmResult;
 import org.apache.maven.scm.command.update.UpdateScmResult;
 import org.apache.maven.scm.provider.AbstractScmProvider;
 import org.apache.maven.scm.provider.ScmProviderRepository;
@@ -34,8 +36,10 @@
 import org.apache.maven.scm.provider.starteam.command.checkin.StarteamCheckInCommand;
 import org.apache.maven.scm.provider.starteam.command.checkout.StarteamCheckOutCommand;
 import org.apache.maven.scm.provider.starteam.command.diff.StarteamDiffCommand;
+import org.apache.maven.scm.provider.starteam.command.edit.StarteamEditCommand;
 import org.apache.maven.scm.provider.starteam.command.status.StarteamStatusCommand;
 import org.apache.maven.scm.provider.starteam.command.tag.StarteamTagCommand;
+import org.apache.maven.scm.provider.starteam.command.unedit.StarteamUnEditCommand;
 import org.apache.maven.scm.provider.starteam.command.update.StarteamUpdateCommand;
 import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
 import org.apache.maven.scm.repository.ScmRepository;
@@ -243,4 +247,25 @@
 
         return (UpdateScmResult) command.execute( repository.getProviderRepository(), fileSet,
parameters );
     }
+    
+    protected EditScmResult edit( ScmRepository repository, ScmFileSet fileSet, CommandParameters
parameters )
+        throws ScmException
+    {
+        StarteamEditCommand command = new StarteamEditCommand();
+
+        command.setLogger( getLogger() );
+
+        return (EditScmResult) command.execute( repository.getProviderRepository(), fileSet,
parameters );
+    }
+
+    protected UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet, CommandParameters
parameters )
+        throws ScmException
+    {
+        StarteamUnEditCommand command = new StarteamUnEditCommand();
+
+        command.setLogger( getLogger() );
+
+        return (UnEditScmResult) command.execute( repository.getProviderRepository(), fileSet,
parameters );
+    }
+    
 }

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,109 @@
+package org.apache.maven.scm.provider.starteam.command.edit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+
+import org.apache.maven.scm.command.edit.AbstractEditCommand;
+import org.apache.maven.scm.command.edit.EditScmResult;
+
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.starteam.command.StarteamCommand;
+import org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils;
+import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
+
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version $Id$
+ */
+public class StarteamEditCommand
+    extends AbstractEditCommand
+    implements StarteamCommand
+{
+    // ----------------------------------------------------------------------
+    // AbstractEditCommand Implementation
+    // ----------------------------------------------------------------------
+
+    protected ScmResult executeEditCommand( ScmProviderRepository repo, ScmFileSet fileSet
)
+        throws ScmException
+    {
+        getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath()
);
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
+
+        StarteamEditConsumer consumer = new StarteamEditConsumer( getLogger(), fileSet.getBasedir()
);
+
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+        File[] editFiles = fileSet.getFiles();
+
+        if ( editFiles.length == 0 )
+        {
+            Commandline cl = createCommandLine( repository, fileSet.getBasedir() );
+
+            int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr,
getLogger() );
+
+            if ( exitCode != 0 )
+            {
+                return new EditScmResult( cl.toString(), "The starteam command failed.",
stderr.getOutput(), false );
+            }
+        }
+        else
+        {
+            //edit only interested files already on the local disk
+            for ( int i = 0; i < editFiles.length; ++i )
+            {
+                Commandline cl = createCommandLine( repository, editFiles[i] );
+
+                int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer,
stderr, getLogger() );
+
+                if ( exitCode != 0 )
+                {
+                    return new EditScmResult( cl.toString(), "The starteam command failed.",
stderr.getOutput(), false );
+                }
+            }
+        }
+
+        return new EditScmResult( null , consumer.getEditedFiles() );
+
+    }
+
+    public static Commandline createCommandLine( StarteamScmProviderRepository repo, File
dirOrFile )
+    {
+        Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "lck", dirOrFile,
repo );
+
+        cl.createArgument().setValue( "-l" );
+
+        if ( dirOrFile.isDirectory() )
+        {
+            cl.createArgument().setValue( "-is" );
+        }
+        else
+        {
+            cl.createArgument().setValue( dirOrFile.getName() );
+        }
+
+        return cl;
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumer.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumer.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumer.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumer.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,113 @@
+package org.apache.maven.scm.provider.starteam.command.edit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ScmFile;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.log.ScmLogger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:dantran@apache.org">Dan T. Tran</a>
+ * @version $Id$
+ */
+public class StarteamEditConsumer
+    implements StreamConsumer
+{
+    private String workingDirectory;
+
+    private ScmLogger logger;
+
+    private List files = new ArrayList();
+
+    /**
+     * the current directory entry being processed by the parser
+     */
+    private String currentDir = "";
+
+    /**
+     * Marks current directory data
+     */
+    private static final String DIR_MARKER = "(working dir: ";
+
+    /**
+     * Marks current file data
+     */
+    private static final String LOCKED_MARKER = ": locked";
+
+
+    public StarteamEditConsumer( ScmLogger logger, File basedir )
+    {
+        this.logger = logger;
+        this.workingDirectory = basedir.getPath().replace( '\\', '/' );
+    }
+
+    public void consumeLine( String line )
+    {
+        logger.debug( line );
+        int pos = 0;
+
+        if ( ( pos = line.indexOf( DIR_MARKER ) ) != -1 )
+        {
+            processDirectory( line, pos );
+        }
+        else if ( ( pos = line.indexOf( LOCKED_MARKER ) ) != -1 )
+        {
+            processLockedFile( line, pos );
+        }
+        else
+        {
+            this.logger.warn( "Unknown edit ouput: " + line );
+        }
+    }
+
+    public List getEditedFiles()
+    {
+        return files;
+    }
+
+    private void processDirectory( String line, int pos )
+    {
+        String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace(
'\\', '/' );
+
+        if ( !dirPath.startsWith( workingDirectory ) )
+        {
+            logger.info( "Working directory: " + workingDirectory );
+
+            logger.info( "Edit directory: " + dirPath );
+
+            throw new IllegalStateException( "Working and edit directories are not on the
same tree" );
+        }
+
+        this.currentDir = "." + dirPath.substring( workingDirectory.length() );
+    }
+
+    private void processLockedFile( String line, int pos )
+    {
+        String lockedFilePath = this.currentDir + "/" + line.substring( 0, pos );
+
+        this.files.add( new ScmFile( lockedFilePath, ScmFileStatus.UNKNOWN ) );
+
+        this.logger.info( "Locked: " + lockedFilePath );
+    }
+
+
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,109 @@
+package org.apache.maven.scm.provider.starteam.command.unedit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+
+import org.apache.maven.scm.command.unedit.AbstractUnEditCommand;
+import org.apache.maven.scm.command.unedit.UnEditScmResult;
+
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.starteam.command.StarteamCommand;
+import org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils;
+import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
+
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version $Id$
+ */
+public class StarteamUnEditCommand
+    extends AbstractUnEditCommand
+    implements StarteamCommand
+{
+    // ----------------------------------------------------------------------
+    // AbstractEditCommand Implementation
+    // ----------------------------------------------------------------------
+
+    protected ScmResult executeUnEditCommand( ScmProviderRepository repo, ScmFileSet fileSet
)
+        throws ScmException
+    {
+        getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath()
);
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
+
+        StarteamUnEditConsumer consumer = new StarteamUnEditConsumer( getLogger(), fileSet.getBasedir()
);
+
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+        File[] editFiles = fileSet.getFiles();
+
+        if ( editFiles.length == 0 )
+        {
+            Commandline cl = createCommandLine( repository, fileSet.getBasedir() );
+
+            int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr,
getLogger() );
+
+            if ( exitCode != 0 )
+            {
+                return new UnEditScmResult( cl.toString(), "The starteam command failed.",
stderr.getOutput(), false );
+            }
+        }
+        else
+        {
+            //edit only interested files already on the local disk
+            for ( int i = 0; i < editFiles.length; ++i )
+            {
+                Commandline cl = createCommandLine( repository, editFiles[i] );
+
+                int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer,
stderr, getLogger() );
+
+                if ( exitCode != 0 )
+                {
+                    return new UnEditScmResult( cl.toString(), "The starteam command failed.",
stderr.getOutput(), false );
+                }
+            }
+        }
+
+        return new UnEditScmResult( null, consumer.getUnEditFiles() );
+
+    }
+
+    public static Commandline createCommandLine( StarteamScmProviderRepository repo, File
dirOrFile )
+    {
+        Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "lck", dirOrFile,
repo );
+
+        cl.createArgument().setValue( "-u" );
+
+        if ( dirOrFile.isDirectory() )
+        {
+            cl.createArgument().setValue( "-is" );
+        }
+        else
+        {
+            cl.createArgument().setValue( dirOrFile.getName() );
+        }
+
+        return cl;
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumer.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumer.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumer.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumer.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,114 @@
+package org.apache.maven.scm.provider.starteam.command.unedit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ScmFile;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.log.ScmLogger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:dantran@apache.org">Dan T. Tran</a>
+ * @version $Id$
+ */
+public class StarteamUnEditConsumer
+    implements StreamConsumer
+{
+    private String workingDirectory;
+
+    private ScmLogger logger;
+
+    private List files = new ArrayList();
+
+    /**
+     * the current directory entry being processed by the parser
+     */
+    private String currentDir = "";
+
+    /**
+     * Marks current directory data
+     */
+    private static final String DIR_MARKER = "(working dir: ";
+
+    /**
+     * Marks current file data
+     */
+    private static final String UNLOCKED_MARKER = ": unlocked";
+
+
+    public StarteamUnEditConsumer( ScmLogger logger, File basedir )
+    {
+        this.logger = logger;
+        this.workingDirectory = basedir.getPath().replace( '\\', '/' );
+    }
+
+    public void consumeLine( String line )
+    {
+        logger.debug( line );
+        
+        int pos = 0;
+
+        if ( ( pos = line.indexOf( DIR_MARKER ) ) != -1 )
+        {
+            processDirectory( line, pos );
+        }
+        else if ( ( pos = line.indexOf( UNLOCKED_MARKER ) ) != -1 )
+        {
+            processUnLockedFile( line, pos );
+        }
+        else
+        {
+            this.logger.warn( "Unknown unedit ouput: " + line );
+        }
+    }
+
+    public List getUnEditFiles()
+    {
+        return files;
+    }
+
+    private void processDirectory( String line, int pos )
+    {
+        String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace(
'\\', '/' );
+
+        if ( !dirPath.startsWith( workingDirectory ) )
+        {
+            logger.info( "Working directory: " + workingDirectory );
+
+            logger.info( "unedit directory: " + dirPath );
+
+            throw new IllegalStateException( "Working and unedit directories are not on the
same tree" );
+        }
+
+        this.currentDir = "." + dirPath.substring( workingDirectory.length() );
+    }
+
+    private void processUnLockedFile( String line, int pos )
+    {
+        String lockedFilePath = this.currentDir + "/" + line.substring( 0, pos );
+
+        this.files.add( new ScmFile( lockedFilePath, ScmFileStatus.UNKNOWN) );
+
+        this.logger.info( "Locked: " + lockedFilePath );
+    }
+
+
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,91 @@
+package org.apache.maven.scm.provider.starteam.command.edit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils;
+import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+
+import org.codehaus.plexus.util.cli.Commandline;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version
+ */
+public class StarteamEditCommandTest
+    extends ScmTestCase
+{
+    
+    public void testGetCommandLineWithFileOnRoot()
+        throws Exception
+    {
+
+	    File testFile = new File( "testfile" );
+
+		File testFileDir= testFile.getAbsoluteFile().getParentFile();
+
+		String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath()
);
+		
+	    String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl"
+
+                          " -fp " + testFileDirAbsolutePath + " -l testfile" ;
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     testFile,
+                     expectedCmd );
+    }
+
+
+    public void testGetCommandLineWithFileInSubDir()
+        throws Exception
+    {
+
+	    File testFile = new File( "target/testfile" );
+
+		File testFileDir= testFile.getAbsoluteFile().getParentFile();
+
+		String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath()
);
+		
+	    String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/target"
+
+                          " -fp " + testFileDirAbsolutePath +
+                          " -l" +
+                          " testfile" ;
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     testFile,
+                     expectedCmd );
+
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File fileName, String commandLine )
+        throws Exception
+    {
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamEditCommand.createCommandLine( repository, fileName );
+
+        assertEquals( commandLine, cl.toString() );
+    }
+ }

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumerTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumerTest.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumerTest.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumerTest.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,65 @@
+package org.apache.maven.scm.provider.starteam.command.edit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+import java.util.Collection;
+
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.log.DefaultLog;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version
+ */
+public class StarteamEditConsumerTest
+    extends ScmTestCase
+{
+    private static String [] TEST_OUTPUT =
+    {
+        "Folder: driver  (working dir: /usr/scm-starteam/driver)",
+  		"maven.xml: locked",
+        "Folder: driver  (working dir: /usr/scm-starteam/driver/target/checkout)",
+		"maven.xml: locked",
+		"project.properties: locked",
+		"project.xml: locked",
+        "Folder: bootstrap  (working dir: /usr/scm-starteam/driver/target/checkout/bootstrap)",
+		"maven.xml: locked",
+		"project.properties: locked",
+		"project.xml: locked"
+    };
+
+    public void testParse()
+        throws Exception
+    {
+        
+		File basedir = new File( "/usr/scm-starteam/driver" );
+        
+        StarteamEditConsumer consumer = new StarteamEditConsumer( new DefaultLog(), basedir
);
+
+        for ( int i = 0; i < TEST_OUTPUT.length; ++ i )
+        {
+            consumer.consumeLine( TEST_OUTPUT[i] );
+        }
+
+        Collection entries = consumer.getEditedFiles();
+
+        assertEquals( "Wrong number of entries returned", 7, entries.size() );
+        
+    }
+    
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,91 @@
+package org.apache.maven.scm.provider.starteam.command.unedit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils;
+import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+
+import org.codehaus.plexus.util.cli.Commandline;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version
+ */
+public class StarteamUnEditCommandTest
+    extends ScmTestCase
+{
+    
+    public void testGetCommandLineWithFileOnRoot()
+        throws Exception
+    {
+
+	    File testFile = new File( "testfile" );
+
+		File testFileDir= testFile.getAbsoluteFile().getParentFile();
+
+		String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath()
);
+		
+	    String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl"
+
+                          " -fp " + testFileDirAbsolutePath + " -u testfile" ;
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     testFile,
+                     expectedCmd );
+    }
+
+
+    public void testGetCommandLineWithFileInSubDir()
+        throws Exception
+    {
+
+	    File testFile = new File( "target/testfile" );
+
+		File testFileDir= testFile.getAbsoluteFile().getParentFile();
+
+		String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath()
);
+		
+	    String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/target"
+
+                          " -fp " + testFileDirAbsolutePath +
+                          " -u" +
+                          " testfile" ;
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     testFile,
+                     expectedCmd );
+
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File fileName, String commandLine )
+        throws Exception
+    {
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamUnEditCommand.createCommandLine( repository, fileName );
+
+        assertEquals( commandLine, cl.toString() );
+    }
+ }

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumerTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumerTest.java?rev=354867&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumerTest.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumerTest.java
Wed Dec  7 13:34:56 2005
@@ -0,0 +1,65 @@
+package org.apache.maven.scm.provider.starteam.command.unedit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 java.io.File;
+import java.util.Collection;
+
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.log.DefaultLog;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version
+ */
+public class StarteamUnEditConsumerTest
+    extends ScmTestCase
+{
+    private static String [] TEST_OUTPUT =
+    {
+        "Folder: driver  (working dir: /usr/scm-starteam/driver)",
+  		"maven.xml: unlocked",
+        "Folder: driver  (working dir: /usr/scm-starteam/driver/target/checkout)",
+		"maven.xml: unlocked",
+		"project.properties: unlocked",
+		"project.xml: unlocked",
+        "Folder: bootstrap  (working dir: /usr/scm-starteam/driver/target/checkout/bootstrap)",
+		"maven.xml: unlocked",
+		"project.properties: unlocked",
+		"project.xml: unlocked"
+    };
+
+    public void testParse()
+        throws Exception
+    {
+        
+		File basedir = new File( "/usr/scm-starteam/driver" );
+        
+        StarteamUnEditConsumer consumer = new StarteamUnEditConsumer( new DefaultLog(), basedir
);
+
+        for ( int i = 0; i < TEST_OUTPUT.length; ++ i )
+        {
+            consumer.consumeLine( TEST_OUTPUT[i] );
+        }
+
+        Collection entries = consumer.getUnEditFiles();
+
+        assertEquals( "Wrong number of entries returned", 7, entries.size() );
+        
+    }
+    
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message