maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r225178 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src: main/java/org/apache/maven/scm/provider/starteam/ main/java/org/apache/maven/scm/provider/starteam/command/remove/ main/resources/META-INF/plexus/ test/java/...
Date Mon, 25 Jul 2005 20:42:14 GMT
Author: evenisse
Date: Mon Jul 25 13:41:57 2005
New Revision: 225178

URL: http://svn.apache.org/viewcvs?rev=225178&view=rev
Log:
o [SCM-51] Add Remove command 
o Clean log in tests

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommand.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumer.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommandTest.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumerTest.java
  (with props)
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/StarteamScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/resources/META-INF/plexus/components.xml
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddConsumerTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInConsumerTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutConsumerTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/tag/StarteamTagCommandTest.java

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=225178&r1=225177&r2=225178&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
Mon Jul 25 13:41:57 2005
@@ -16,10 +16,27 @@
  * limitations under the License.
  */
 
-import java.util.Map;
-
+import org.apache.maven.scm.CommandParameters;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.command.add.AddScmResult;
+import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
+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.status.StatusScmResult;
+import org.apache.maven.scm.command.tag.TagScmResult;
+import org.apache.maven.scm.command.update.UpdateScmResult;
 import org.apache.maven.scm.provider.AbstractScmProvider;
 import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.starteam.command.add.StarteamAddCommand;
+import org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogCommand;
+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.status.StarteamStatusCommand;
+import org.apache.maven.scm.provider.starteam.command.tag.StarteamTagCommand;
+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.ScmRepositoryException;
 import org.codehaus.plexus.util.StringUtils;
@@ -33,11 +50,6 @@
 {
     public static final String STARTEAM_URL_FORMAT = "[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]";
 
-    /**
-     * @requirement org.apache.maven.scm.StarteamCommand
-     */
-    private Map commands;
-
     // ----------------------------------------------------------------------
     // ScmProvider Implementation
     // ----------------------------------------------------------------------
@@ -122,17 +134,81 @@
         }
     }
 
-    // ----------------------------------------------------------------------
-    // AbstractScmProvider Implementation
-    // ----------------------------------------------------------------------
+    public String getScmType()
+    {
+        return "starteam";
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#add(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public AddScmResult add( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters
parameters )
+        throws ScmException
+    {
+        return (AddScmResult) new StarteamAddCommand().execute( repository, fileSet, parameters
);
+    }
 
-    protected Map getCommands()
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#changelog(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public ChangeLogScmResult changelog( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
+        throws ScmException
     {
-        return commands;
+        return (ChangeLogScmResult) new StarteamChangeLogCommand().execute( repository, fileSet,
parameters );
     }
 
-    public String getScmType()
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#checkin(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public CheckInScmResult checkin( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
+        throws ScmException
     {
-        return "starteam";
+        return (CheckInScmResult) new StarteamCheckInCommand().execute( repository, fileSet,
parameters );
     }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#checkout(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
+        throws ScmException
+    {
+        return (CheckOutScmResult) new StarteamCheckOutCommand().execute( repository, fileSet,
parameters );
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#diff(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public DiffScmResult diff( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters
parameters )
+        throws ScmException
+    {
+        return (DiffScmResult) new StarteamDiffCommand().execute( repository, fileSet, parameters
);
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#status(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
+        throws ScmException
+    {
+        return (StatusScmResult) new StarteamStatusCommand().execute( repository, fileSet,
parameters );
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#tag(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters
parameters )
+        throws ScmException
+    {
+        return (TagScmResult) new StarteamTagCommand().execute( repository, fileSet, parameters
);
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#update(org.apache.maven.scm.provider.ScmProviderRepository,
org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.CommandParameters)
+     */
+    public UpdateScmResult update( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
+        throws ScmException
+    {
+        return (UpdateScmResult) new StarteamUpdateCommand().execute( repository, fileSet,
parameters );
+    }
+
 }

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommand.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/remove/StarteamRemoveCommand.java?rev=225178&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommand.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommand.java
Mon Jul 25 13:41:57 2005
@@ -0,0 +1,107 @@
+package org.apache.maven.scm.provider.starteam.command.remove;
+
+/*
+ * 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.remove.RemoveScmResult;
+import org.apache.maven.scm.command.remove.AbstractRemoveCommand;
+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.command.checkin.StarteamCheckInConsumer;
+import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version $Id$
+ */
+public class StarteamRemoveCommand
+    extends AbstractRemoveCommand
+    implements StarteamCommand
+{
+    protected ScmResult executeRemoveCommand( ScmProviderRepository repo, ScmFileSet fileSet,
String message )
+       throws ScmException
+    {
+
+        getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath()
);
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
+
+        StarteamCheckInConsumer consumer = new StarteamCheckInConsumer( getLogger(), fileSet.getBasedir()
);
+
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+        File[] checkInFiles = fileSet.getFiles();
+
+        if ( checkInFiles.length == 0 )
+        {
+            Commandline cl = createCommandLine( repository, fileSet.getBasedir() );
+
+            int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr,
getLogger() );
+
+            if ( exitCode != 0 )
+            {
+            	return new RemoveScmResult( "The starteam command failed.", stderr.getOutput(),
false );
+            }
+        }
+        else
+        {
+        	//update only interested files already on the local disk
+        	for ( int i = 0; i < checkInFiles.length; ++i )
+        	{
+        		Commandline cl = createCommandLine( repository, checkInFiles[i] );
+
+        		int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr,
getLogger() );
+
+        		if ( exitCode != 0 )
+        		{	
+        			return new RemoveScmResult( "The starteam command failed.", stderr.getOutput(),
false );
+        		}
+        	}
+        }
+
+        return new RemoveScmResult( consumer.getCheckedInFiles() );
+
+    }
+
+    public static Commandline createCommandLine( StarteamScmProviderRepository repo, File
dirOrFile )
+    {
+    	Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "remove", dirOrFile,
repo );
+
+    	if ( dirOrFile.isDirectory() )
+    	{
+    		cl.createArgument().setValue( "-is" );
+    	}
+    	else
+    	{
+    		cl.createArgument().setValue( dirOrFile.getName() );
+    	}
+
+    	//remove working file(s)
+		//cl.createArgument().setValue( "-df" );
+
+    	return cl;
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommand.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/remove/StarteamRemoveCommand.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/remove/StarteamRemoveConsumer.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/remove/StarteamRemoveConsumer.java?rev=225178&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumer.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumer.java
Mon Jul 25 13:41:57 2005
@@ -0,0 +1,122 @@
+package org.apache.maven.scm.provider.starteam.command.remove;
+
+/*
+ * 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@gmail.com">Dan T. Tran</a>
+ * @version $Id$
+ */
+public class StarteamRemoveConsumer
+    implements StreamConsumer
+{
+    private ScmLogger logger;
+
+    private String workingDirectory;
+
+    /**
+     * the current directory entry being processed by the parser
+     */
+    private String currentDir;
+
+    private List files = new ArrayList();
+
+    /**
+     * Marks current directory data
+     */
+    private static final String DIR_MARKER = "(working dir: ";
+
+    /**
+     * Marks current file data
+     */
+    private static final String ADDED_MARKER = ": removed";
+
+    /**
+     * Marks current file data
+     */
+    private static final String LINKTO_MARKER = ": linked to";
+
+    public StarteamRemoveConsumer( 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( ADDED_MARKER ) ) != -1 )
+        {
+            processRemovedFile( line, pos );
+        }
+        else if ( ( pos = line.indexOf( LINKTO_MARKER ) ) != -1 )
+        {
+            //ignore
+        }
+        else
+        {
+            this.logger.warn( "Unknown remove ouput: " + line );
+        }
+    }
+
+    public List getRemovedFiles()
+    {
+        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( "Checkin directory path: " + dirPath );
+
+            throw new IllegalStateException( "Working and remove directories are not on the
same tree" );
+        }
+
+        this.currentDir = "." + dirPath.substring( workingDirectory.length() );
+    }
+
+    private void processRemovedFile( String line, int pos )
+    {
+        String addedFilePath = this.currentDir + "/" + line.substring( 0, pos );
+
+        this.files.add( new ScmFile( addedFilePath, ScmFileStatus.DELETED ) );
+
+        this.logger.info( "Removed: " + addedFilePath );
+    }
+
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumer.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/remove/StarteamRemoveConsumer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/resources/META-INF/plexus/components.xml?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/resources/META-INF/plexus/components.xml
Mon Jul 25 13:41:57 2005
@@ -61,5 +61,11 @@
       <implementation>org.apache.maven.scm.provider.starteam.command.diff.StarteamDiffCommand</implementation>
     </component>
 
+    <component>
+      <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
+      <role-hint>remove</role-hint>
+      <implementation>org.apache.maven.scm.provider.starteam.command.remove.StarteamRemoveCommand</implementation>
+    </component>
+
   </components>
 </component-set>

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddConsumerTest.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/add/StarteamAddConsumerTest.java?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddConsumerTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddConsumerTest.java
Mon Jul 25 13:41:57 2005
@@ -25,9 +25,6 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
 
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.logging.Logger;
-
 /**
  * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
  * @version
@@ -55,8 +52,6 @@
         
 		File basedir = new File( "/usr/scm-starteam/driver" );
         
-        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
-
         StarteamAddConsumer consumer = new StarteamAddConsumer( new DefaultLog(), basedir
);
 
         for ( int i = 0; i < TEST_OUTPUT.length; ++ i )

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.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/changelog/StarteamChangeLogConsumerTest.java?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
Mon Jul 25 13:41:57 2005
@@ -28,9 +28,6 @@
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.log.DefaultLog;
 
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.logging.Logger;
-
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
@@ -58,8 +55,6 @@
         BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
 
         String s = in.readLine();
-
-        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
 
         StarteamChangeLogConsumer consumer = new StarteamChangeLogConsumer( new DefaultLog(),
null, null );
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInConsumerTest.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/checkin/StarteamCheckInConsumerTest.java?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInConsumerTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInConsumerTest.java
Mon Jul 25 13:41:57 2005
@@ -25,9 +25,6 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
 
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.logging.Logger;
-
 /**
  * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
  * @version
@@ -55,8 +52,6 @@
     {
 		File basedir = new File( "/usr/scm-starteam/driver" );
         
-        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
-
         StarteamCheckInConsumer consumer = new StarteamCheckInConsumer( new DefaultLog(),
basedir);
 
         for ( int i = 0; i < TEST_OUTPUT.length; ++ i )

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutConsumerTest.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/checkout/StarteamCheckOutConsumerTest.java?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutConsumerTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutConsumerTest.java
Mon Jul 25 13:41:57 2005
@@ -25,9 +25,6 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
 
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.logging.Logger;
-
 /**
  * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
  * @version 
@@ -59,8 +56,6 @@
         
 		File basedir = new File( "/usr/scm-starteam/driver" );
         
-        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
-
         StarteamCheckOutConsumer consumer = new StarteamCheckOutConsumer( new DefaultLog(),
basedir );
 
         for ( int i = 0; i < TEST_OUTPUT.length; ++ i )

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.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/diff/StarteamDiffConsumerTest.java?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
Mon Jul 25 13:41:57 2005
@@ -24,8 +24,6 @@
 
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.logging.Logger;
 
 /**
  * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
@@ -52,8 +50,6 @@
         BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
 
         String s = in.readLine();
-
-        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
 
 		File basedir = new File( getBasedir() );
 

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommandTest.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/remove/StarteamRemoveCommandTest.java?rev=225178&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommandTest.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveCommandTest.java
Mon Jul 25 13:41:57 2005
@@ -0,0 +1,91 @@
+package org.apache.maven.scm.provider.starteam.command.remove;
+
+/*
+ * 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 StarteamRemoveCommandTest
+    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 remove -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl"
+
+                          " -fp " + testFileDirAbsolutePath + " 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 remove -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/target"
+
+                          " -fp " + testFileDirAbsolutePath +
+                          " testfile" ;
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     testFile,
+                     null, 
+                     expectedCmd );
+
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File fileName , String crPath, String commandLine
)
+        throws Exception
+    {
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamRemoveCommand.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/remove/StarteamRemoveCommandTest.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/remove/StarteamRemoveCommandTest.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/remove/StarteamRemoveConsumerTest.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/remove/StarteamRemoveConsumerTest.java?rev=225178&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumerTest.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumerTest.java
Mon Jul 25 13:41:57 2005
@@ -0,0 +1,78 @@
+package org.apache.maven.scm.provider.starteam.command.remove;
+/*
+ * 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 java.util.Iterator;
+
+import org.apache.maven.scm.ScmFile;
+import org.apache.maven.scm.ScmFileStatus;
+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 StarteamRemoveConsumerTest
+    extends ScmTestCase
+{
+    private static String [] TEST_OUTPUT =
+    {
+        "Folder: driver  (working dir: /usr/scm-starteam/driver)",
+  		"maven.xml: removed",
+        "Folder: driver  (working dir: /usr/scm-starteam/driver/target/checkout)",
+		"maven.xml: removed",
+		"project.properties: removed",
+		"project.xml: removed",
+        "Folder: bootstrap  (working dir: /usr/scm-starteam/driver/target/checkout/bootstrap)",
+		"maven.xml: removed",
+		"project.properties: removed",
+		"project.xml: removed"
+    };
+
+    public void testParse()
+        throws Exception
+    {
+        
+		File basedir = new File( "/usr/scm-starteam/driver" );
+        
+        StarteamRemoveConsumer consumer = new StarteamRemoveConsumer( new DefaultLog(), basedir
);
+
+        for ( int i = 0; i < TEST_OUTPUT.length; ++ i )
+        {
+            consumer.consumeLine( TEST_OUTPUT[i] );
+        }
+
+        Collection entries = consumer.getRemovedFiles();
+
+        assertEquals( "Wrong number of entries returned", 7, entries.size() );
+
+        ScmFile entry;
+
+        for ( Iterator i = entries.iterator(); i.hasNext(); )
+        {
+            entry = (ScmFile) i.next();
+            
+            assertTrue ( entry.getPath().startsWith("./") );
+            
+            assertTrue( entry.getStatus() == ScmFileStatus.DELETED );
+        }
+        
+        
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/remove/StarteamRemoveConsumerTest.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/remove/StarteamRemoveConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.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/status/StarteamStatusConsumerTest.java?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
Mon Jul 25 13:41:57 2005
@@ -25,9 +25,6 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
 
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.logging.Logger;
-
 /**
  * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
  * @version
@@ -56,8 +53,6 @@
         BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
 
         String s = in.readLine();
-
-        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
 
         StarteamStatusConsumer consumer = new StarteamStatusConsumer( new DefaultLog(), new
File( WORKING_DIR ) );
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/tag/StarteamTagCommandTest.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/tag/StarteamTagCommandTest.java?rev=225178&r1=225177&r2=225178&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/tag/StarteamTagCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/tag/StarteamTagCommandTest.java
Mon Jul 25 13:41:57 2005
@@ -19,7 +19,6 @@
 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;
 
@@ -37,8 +36,6 @@
     {
         
 		File workDir = new File( "target" );
-
-        String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath()
);
 
         testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
                          workDir,



Mime
View raw message