You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-commits@maven.apache.org by ev...@apache.org on 2005/06/13 15:21:44 UTC

svn commit: r190397 [2/2] - 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/ main/java/org/apache/maven/scm/provider/starteam/command/add/ main/java/org/apache/maven/scm/provider/starteam/command/changelog/ main/java/org/apache/maven/scm/provider/starteam/command/checkin/ main/java/org/apache/maven/scm/provider/starteam/command/checkout/ main/java/org/apache/maven/scm/provider/starteam/command/diff/ main/java/org/apache/maven/scm/provider/starteam/command/status/ main/java/org/apache/maven/scm/provider/starteam/command/tag/ main/java/org/apache/maven/scm/provider/starteam/command/update/ main/java/org/apache/maven/scm/provider/starteam/repository/ main/resources/META-INF/plexus/ test/java/org/apache/maven/scm/provider/starteam/command/add/ test/java/org/apache/maven/scm/provider/starteam/command/changelog/ test/java/org/apache/maven/scm/provider/starteam/command/checkin/ test/java/org/apache/maven/scm/provider/starteam/command/checkout/ test/java/org/apache/maven/scm/provider/starteam/command/diff/ test/java/org/apache/maven/scm/provider/starteam/command/status/ test/java/org/apache/maven/scm/provider/starteam/command/tag/ test/java/org/apache/maven/scm/provider/starteam/command/update/ test/resources/starteam/changelog/ test/resources/starteam/diff/ test/resources/starteam/status/

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=190397&r1=190396&r2=190397&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 Jun 13 06:21:42 2005
@@ -15,14 +15,50 @@
 
     <component>
       <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
-      <role-hint>changelog</role-hint>
+      <role-hint>change-log</role-hint>
       <implementation>org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogCommand</implementation>
     </component>
 
     <component>
       <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
-      <role-hint>checkout</role-hint>
+      <role-hint>check-out</role-hint>
       <implementation>org.apache.maven.scm.provider.starteam.command.checkout.StarteamCheckOutCommand</implementation>
+    </component>
+
+    <component>
+      <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
+      <role-hint>update</role-hint>
+      <implementation>org.apache.maven.scm.provider.starteam.command.update.StarteamUpdateCommand</implementation>
+    </component>
+
+    <component>
+      <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
+      <role-hint>tag</role-hint>
+      <implementation>org.apache.maven.scm.provider.starteam.command.tag.StarteamTagCommand</implementation>
+    </component>
+
+    <component>
+      <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
+      <role-hint>status</role-hint>
+      <implementation>org.apache.maven.scm.provider.starteam.command.status.StarteamStatusCommand</implementation>
+    </component>
+
+    <component>
+      <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
+      <role-hint>add</role-hint>
+      <implementation>org.apache.maven.scm.provider.starteam.command.add.StarteamAddCommand</implementation>
+    </component>
+
+    <component>
+      <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
+      <role-hint>check-in</role-hint>
+      <implementation>org.apache.maven.scm.provider.starteam.command.checkin.StarteamCheckInCommand</implementation>
+    </component>
+
+    <component>
+      <role>org.apache.maven.scm.provider.starteam.command.StarteamCommand</role>
+      <role-hint>diff</role-hint>
+      <implementation>org.apache.maven.scm.provider.starteam.command.diff.StarteamDiffCommand</implementation>
     </component>
 
   </components>

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddCommandTest.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/StarteamAddCommandTest.java?rev=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddCommandTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,112 @@
+package org.apache.maven.scm.provider.starteam.command.add;
+
+/*
+ * 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 StarteamAddCommandTest
+    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 add -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl" +
+                          " -fp " + testFileDirAbsolutePath + " testfile" ;
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     testFile,
+                     "",
+                     expectedCmd );
+    }
+
+    public void testGetCommandLineWithCR()
+        throws Exception 
+    {
+	    File testFile = new File( "testfile" );
+
+		File testFileDir= testFile.getAbsoluteFile().getParentFile();
+
+		String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath() );
+		
+	    String expectedCmd = "stcmd add -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl" +
+                          " -fp " + testFileDirAbsolutePath +
+                          " -cr view_root/dummycr" + 
+                          " testfile" ;
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     testFile,
+                     "view_root/dummycr", 
+                     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 add -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 = StarteamAddCommand.createCommandLine( repository, fileName, crPath );
+
+        assertEquals( commandLine, cl.toString() );
+    }
+ }

Added: 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=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddConsumerTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/add/StarteamAddConsumerTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,83 @@
+package org.apache.maven.scm.provider.starteam.command.add;
+
+/*
+ * 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.codehaus.plexus.logging.console.ConsoleLogger;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version
+ */
+public class StarteamAddConsumerTest
+    extends ScmTestCase
+{
+    private static String [] TEST_OUTPUT =
+    {
+        "Folder: driver  (working dir: /usr/scm-starteam/driver)",
+  		"maven.xml: added",
+        "Folder: driver  (working dir: /usr/scm-starteam/driver/target/checkout)",
+		"maven.xml: added",
+		"project.properties: added",
+		"project.xml: added",
+        "Folder: bootstrap  (working dir: /usr/scm-starteam/driver/target/checkout/bootstrap)",
+		"maven.xml: added",
+		"project.properties: added",
+		"project.xml: added"
+    };
+
+    public void testParse()
+        throws Exception
+    {
+        
+		File basedir = new File( "/usr/scm-starteam/driver" );
+        
+        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
+
+        StarteamAddConsumer consumer = new StarteamAddConsumer( logger, basedir );
+
+        for ( int i = 0; i < TEST_OUTPUT.length; ++ i )
+        {
+            consumer.consumeLine( TEST_OUTPUT[i] );
+        }
+
+        Collection entries = consumer.getAddedFiles();
+
+        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.ADDED );
+        }
+        
+        
+    }
+}

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.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/StarteamChangeLogCommandTest.java?rev=190397&r1=190396&r2=190397&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java Mon Jun 13 06:21:42 2005
@@ -19,6 +19,7 @@
 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;
 
@@ -26,6 +27,7 @@
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
  * @version $Id$
  */
 public class StarteamChangeLogCommandTest
@@ -34,31 +36,43 @@
     public void testGetCommandLine()
         throws Exception
     {
-        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", null,
-                         "stcmd hist -x -nologo -is -p myusername:mypassword@myhost:1234/projecturl" );
+		File workDir = new File("target");
+		
+		String workDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                         workDir,
+                         "",
+                         "stcmd hist -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                         "-fp " + workDirAbsolutePath + " -is"  );
     }
 
     public void testGetCommandLineWithTag()
         throws Exception
     {
-        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", "myTag",
-                         "stcmd hist -x -nologo -is -p myusername:mypassword@myhost:1234/projecturl -vl myTag" );
+		File workDir = new File("target");
+
+		String workDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                         workDir,
+                         "myTag",
+                         "stcmd hist -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                         "-fp " + workDirAbsolutePath + " -is -cfgl myTag" );
     }
 
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-    private void testCommandLine( String scmUrl, String tag, String commandLine )
+    private void testCommandLine( String scmUrl, File workDir,  String tag, String commandLine )
         throws Exception
     {
-        File workingDirectory = getTestFile( "target/starteam-changelog-command-test" );
-
         ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
 
         StarteamScmProviderRepository svnRepository = (StarteamScmProviderRepository) repository.getProviderRepository();
 
-        Commandline cl = StarteamChangeLogCommand.createCommandLine( svnRepository, workingDirectory, tag );
+        Commandline cl = StarteamChangeLogCommand.createCommandLine( svnRepository, workDir, tag );
 
         assertEquals( commandLine, cl.toString() );
     }

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=190397&r1=190396&r2=190397&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 Jun 13 06:21:42 2005
@@ -27,6 +27,9 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.ChangeSet;
 
+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$
@@ -55,7 +58,9 @@
 
         String s = in.readLine();
 
-        StarteamChangeLogConsumer consumer = new StarteamChangeLogConsumer( null, null, null );
+        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
+
+        StarteamChangeLogConsumer consumer = new StarteamChangeLogConsumer( logger, null, null );
 
         while ( s != null )
         {

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.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/StarteamCheckInCommandTest.java?rev=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,102 @@
+package org.apache.maven.scm.provider.starteam.command.checkin;
+
+/*
+ * 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 StarteamCheckInCommandTest
+    extends ScmTestCase
+{
+    
+    public void testGetCommandLineWithWorkingDirectory()
+    	throws Exception
+    {
+        File workDir = new File( "target" ) ;
+    
+        String workDirAbsolutePath=StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                     workDir,
+                     "",
+                     "",
+                     "",
+                     "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                     "-fp " + workDirAbsolutePath + " -f NCI -is" );
+    }
+
+    public void testGetCommandLineWithFileOnRoot()
+    	throws Exception
+    {
+        File testFile = new File("testfile");
+        
+        String testFileAbsolutePath= StarteamCommandLineUtils.toJavaPath( testFile.getAbsoluteFile().getParent() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                 testFile,
+                 "myMessage",
+                 "myTag",
+                 "",
+                 "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                 "-fp " + testFileAbsolutePath + " -r myMessage -vl myTag " + "testfile" );
+
+    }	
+
+    public void testGetCommandLineWithFileInSubDir()
+    	throws Exception
+    {
+        File testFile = new File("src/testfile");
+        
+        String testFileAbsolutePath= StarteamCommandLineUtils.toJavaPath( testFile.getAbsoluteFile().getParent() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                 testFile,
+                 null,
+                 "",
+                 "myCr",
+                 "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/src " +
+                 "-fp " + testFileAbsolutePath + " -cr myCr " + "testfile" );
+    }
+
+// ----------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File testFileOrDir, String message, String tag, String cr, String commandLine )
+    	throws Exception
+    {
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamCheckInCommand.createCommandLine( repository, testFileOrDir, message, tag, cr );
+        
+        assertEquals( commandLine, cl.toString() );
+    }
+    
+
+ }

Added: 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=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInConsumerTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInConsumerTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,83 @@
+package org.apache.maven.scm.provider.starteam.command.checkin;
+
+/*
+ * 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.codehaus.plexus.logging.console.ConsoleLogger;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version
+ */
+public class StarteamCheckInConsumerTest
+    extends ScmTestCase
+{
+    private static String [] TEST_OUTPUT =
+    {
+        "Folder: driver  (working dir: /usr/scm-starteam/driver)",
+  		"maven.xml: checked in",
+        "Folder: driver  (working dir: /usr/scm-starteam/driver/target/checkout)",
+		"maven.xml: checked in",
+		"project.properties: skipped",
+		"project.xml: checked in",
+        "Folder: bootstrap  (working dir: /usr/scm-starteam/driver/target/checkout/bootstrap)",
+        "Folder: dev  (working dir: /usr/scm-starteam/driver/target/checkout/dev)",
+		"maven.xml:skipped",
+		"project.properties: skipped",
+		"project.xml: checked in"
+    };
+
+    public void testParse()
+        throws Exception
+    {
+		File basedir = new File( "/usr/scm-starteam/driver" );
+        
+        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
+
+        StarteamCheckInConsumer consumer = new StarteamCheckInConsumer( logger, basedir);
+
+        for ( int i = 0; i < TEST_OUTPUT.length; ++ i )
+        {
+            consumer.consumeLine( TEST_OUTPUT[i] );
+        }
+
+        Collection entries = consumer.getCheckedInFiles();
+
+        assertEquals( "Wrong number of entries returned", 4, entries.size() );
+        
+        ScmFile entry;
+
+        for ( Iterator i = entries.iterator(); i.hasNext(); )
+        {
+            entry = (ScmFile) i.next();
+            
+            assertTrue ( entry.getPath().startsWith("./") );
+            
+            assertTrue( entry.getStatus() == ScmFileStatus.CHECKED_OUT );
+        }
+        
+
+    }
+}

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.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/StarteamCheckOutCommandTest.java?rev=190397&r1=190396&r2=190397&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java Mon Jun 13 06:21:42 2005
@@ -19,6 +19,7 @@
 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;
 
@@ -34,25 +35,31 @@
     public void testGetCommandLineWithWorkingDirectory()
         throws Exception
     {
-        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", "myTag",
-                         "stcmd co -x -nologo -is -p myusername:mypassword@myhost:1234/projecturl -vl myTag" );
+		File workDir = new File("target");
+
+        String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                         workDir,
+                         "myTag",
+                         "stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                         "-fp " + workDirAbsolutePath + " -vl myTag -is" );
     }
 
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-    private void testCommandLine( String scmUrl, String tag, String commandLine )
+    private void testCommandLine( String scmUrl, File workDir, String tag, String commandLine )
         throws Exception
     {
-        File workingDirectory = getTestFile( "target/starteam-checkout-command-test" );
-
         ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
 
         StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
 
-        Commandline cl = StarteamCheckOutCommand.createCommandLine( repository, workingDirectory, tag );
+        Commandline cl = StarteamCheckOutCommand.createCommandLine( repository, workDir, tag );
 
         assertEquals( commandLine, cl.toString() );
     }
+    
  }

Added: 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=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutConsumerTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutConsumerTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,86 @@
+package org.apache.maven.scm.provider.starteam.command.checkout;
+
+/*
+ * 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.codehaus.plexus.logging.console.ConsoleLogger;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
+ * @version 
+ */
+public class StarteamCheckOutConsumerTest
+    extends ScmTestCase
+{
+    private static String [] TEST_OUTPUT = 
+    {
+        "Folder: driver  (working dir: /usr/scm-starteam/driver/target/checkout)",
+		"maven.xml: checked out",
+		"project.properties: checked out",
+		"project.xml: checked out",
+        "Folder: bootstrap  (working dir: /usr/scm-starteam/driver/target/checkout/bootstrap)",
+        "Folder: dev  (working dir: /usr/scm-starteam/driver/target/checkout/dev)",
+		"maven.xml: checked out",
+		"project.properties: checked out",
+		"project.xml: checked out",
+        "Folder: dev  (working dir: /usr/scm-starteam/driver)",
+		"maven.xml: checked out",
+		"project.properties: checked out",
+		"project.xml: checked out"
+		
+    };
+    
+    public void testParse()
+        throws Exception
+    {
+        
+		File basedir = new File( "/usr/scm-starteam/driver" );
+        
+        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
+
+        StarteamCheckOutConsumer consumer = new StarteamCheckOutConsumer( logger, basedir );
+
+        for ( int i = 0; i < TEST_OUTPUT.length; ++ i )
+        {
+            consumer.consumeLine( TEST_OUTPUT[i] );
+        }
+
+        Collection entries = consumer.getCheckedOutFiles();
+
+        assertEquals( "Wrong number of entries returned", 9, entries.size() );
+
+        ScmFile entry;
+
+        for ( Iterator i = entries.iterator(); i.hasNext(); )
+        {
+            entry = (ScmFile) i.next();
+            
+            assertTrue ( entry.getPath().startsWith("./") );
+            
+            assertTrue( entry.getStatus() == ScmFileStatus.CHECKED_OUT );
+        }
+        
+    }
+}

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommandTest.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/StarteamDiffCommandTest.java?rev=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommandTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,90 @@
+package org.apache.maven.scm.provider.starteam.command.diff;
+
+/*
+ * 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 StarteamDiffCommandTest
+    extends ScmTestCase
+{
+    
+    public void testGetCommandLine()
+        throws Exception
+    {
+        
+		File workDir = new File( "target" );
+
+        String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+		
+		String expectedCmd = "stcmd diff -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                             "-fp " + workDirAbsolutePath + " -is -filter M"; 
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                         workDir,
+                         null, null,
+                         expectedCmd );
+    }
+
+    public void testGetCommandLineWithLabels()
+        throws Exception
+    {
+    
+		File workDir = new File( "target" );
+
+        String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+		
+	    String expectedCmd = "stcmd diff -x -nologo -stop " +
+	                         "-p myusername:mypassword@myhost:1234/projecturl " +
+                             "-fp " + workDirAbsolutePath + " -is -filter M " + 
+                             "-vl label1 -vl label2";
+
+    
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                         workDir,
+                         "label1", "label2", 
+                         expectedCmd );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File basedir, String startLabel, String endLabel, String commandLine )
+        throws Exception
+    {
+
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamDiffCommand.createCommandLine( repository, basedir, startLabel, endLabel );
+        
+        assertEquals( commandLine, cl.toString() );
+    }
+
+ }

Added: 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=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,72 @@
+package org.apache.maven.scm.provider.starteam.command.diff;
+
+/*
+ * 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.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.Collection;
+
+import org.apache.maven.scm.ScmTestCase;
+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
+ */
+public class StarteamDiffConsumerTest
+    extends ScmTestCase
+{
+    private File testFile;
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        testFile = getTestFile( "/src/test/resources/starteam/diff/diff.txt" );
+    }
+
+    public void testParse()
+        throws Exception
+    {
+        FileInputStream fis = new FileInputStream( testFile );
+
+        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
+
+        String s = in.readLine();
+
+        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
+
+		File basedir = new File( getBasedir() );
+
+        StarteamDiffConsumer consumer = new StarteamDiffConsumer( logger, basedir );
+
+        while ( s != null )
+        {
+            consumer.consumeLine( s );
+
+            s = in.readLine();
+        }
+
+        Collection entries = consumer.getChangedFiles();
+
+        assertEquals( "Wrong number of entries returned", 3, entries.size() );
+    }
+}

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusCommandTest.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/StarteamStatusCommandTest.java?rev=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusCommandTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,66 @@
+package org.apache.maven.scm.provider.starteam.command.status;
+
+/*
+ * 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 StarteamStatusCommandTest
+    extends ScmTestCase
+{
+
+    public void testGetCommandLineWithWorkingDirectory()
+        throws Exception
+    {
+		File workDir = new File( "target" );
+
+        String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+        
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                         workDir,
+                         "myTag",
+                         "stcmd hist -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                         "-fp " + workDirAbsolutePath + " -is" );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File workDir, String tag, String commandLine )
+        throws Exception
+    {
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamStatusCommand.createCommandLine( repository, workDir );
+
+        assertEquals( commandLine, cl.toString() );
+    }
+
+ }

Added: 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=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,76 @@
+package org.apache.maven.scm.provider.starteam.command.status;
+
+/*
+ * 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.util.Collection;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import org.apache.maven.scm.ScmTestCase;
+
+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
+ */
+public class StarteamStatusConsumerTest
+    extends ScmTestCase
+{
+    // must match with the test file    
+    private static final String WORKING_DIR = "/usr/scm-starteam/driver";
+    
+    private File testFile;
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        testFile = getTestFile( "/src/test/resources/starteam/status/status.txt" );
+    }
+    
+    public void testParse()
+        throws Exception
+    {
+        FileInputStream fis = new FileInputStream( testFile );
+
+        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
+
+        String s = in.readLine();
+
+        Logger logger = new ConsoleLogger(Logger.LEVEL_INFO, "testlogger");
+
+        StarteamStatusConsumer consumer = new StarteamStatusConsumer( logger, new File( WORKING_DIR ) );
+
+        while ( s != null )
+        {
+            consumer.consumeLine( s );
+
+            s = in.readLine();
+        }
+
+        Collection entries = consumer.getChangedFiles();
+
+        assertEquals( "Wrong number of entries returned", 4, entries.size() );
+
+        // TODO add more validation to the entries
+    }
+}

Added: 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=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/tag/StarteamTagCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/tag/StarteamTagCommandTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,66 @@
+package org.apache.maven.scm.provider.starteam.command.tag;
+
+/*
+ * 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:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id: StarteamTagCommandTest.java 162289 2005-01-12 15:07:52Z trygvis $
+ */
+public class StarteamTagCommandTest
+    extends ScmTestCase
+{
+    public void testTagCommandLine()
+        throws Exception
+    {
+        
+		File workDir = new File( "target" );
+
+        String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                         workDir,
+                         "myTag",
+                         "stcmd label -x -nologo -stop " +
+                         "-p myusername:mypassword@myhost:1234/projecturl " +
+                         "-nl myTag -b" );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File workDir, String tag, String commandLine )
+        throws Exception
+    {
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamTagCommand.createCommandLine( repository, workDir, tag );
+
+        assertEquals( commandLine, cl.toString() );
+    }
+ }

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/update/StarteamUpdateCommandTest.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/update/StarteamUpdateCommandTest.java?rev=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/update/StarteamUpdateCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/update/StarteamUpdateCommandTest.java Mon Jun 13 06:21:42 2005
@@ -0,0 +1,106 @@
+package org.apache.maven.scm.provider.starteam.command.update;
+
+/*
+ * 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.ScmFileSet;
+
+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 StarteamUpdateCommandTest
+    extends ScmTestCase
+{
+    public void testGetCommandLineWithWorkingDirectory()
+        throws Exception
+    {
+        File workDir = new File ( "target" ) ;
+        
+		String absolutePath=StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                         workDir,
+                         "myTag",
+                         "stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                         "-fp " + absolutePath + " -merge -neverprompt -vl myTag -is" );
+
+    }
+    
+    
+    public void testGetCommandLineWithFileOnRoot()
+        throws Exception
+    {
+        ScmFileSet fileSet = new ScmFileSet( new File( "./" ), "*", null );
+        
+        File [] files = fileSet.getFiles();
+
+        File workDir = new File( getBasedir() );
+        
+	    String absolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                     files[0],
+                     "myTag",
+                     "stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " +
+                     "-fp " + absolutePath + " -merge -neverprompt -vl myTag " + files[0].getName() );
+
+    }
+
+    public void testGetCommandLineWithFileInSubDir()
+       throws Exception
+    {
+        ScmFileSet fileSet = new ScmFileSet( new File( "./" ), "**/*.java", null );
+        
+        File [] files = fileSet.getFiles();
+        
+        File testFile = files[0];
+
+        String absolutePath = StarteamCommandLineUtils.toJavaPath( testFile.getAbsoluteFile().getParent() );
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", 
+                 testFile,
+                 "myTag",
+                 "stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/" + StarteamCommandLineUtils.toJavaPath( testFile.getParent() ) +
+                 " -fp " + absolutePath + " -merge -neverprompt -vl myTag " + testFile.getName()  );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void testCommandLine( String scmUrl, File testFileOrDir, String tag, String commandLine )
+        throws Exception
+    {
+        ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
+
+        StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
+
+        Commandline cl = StarteamUpdateCommand.createCommandLine( repository, testFileOrDir, tag );
+
+        assertEquals( commandLine, cl.toString() );
+    }
+ }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/changelog/starteamlog_en.txt
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/changelog/starteamlog_en.txt?rev=190397&r1=190396&r2=190397&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/changelog/starteamlog_en.txt (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/changelog/starteamlog_en.txt Mon Jun 13 06:21:42 2005
@@ -6,12 +6,12 @@
 Status: Current
 ----------------------------
 Revision: 2 View: GRP_Dev Branch Revision: 1.1
-Author: Emmanuel VENISSE Date: 4/21/04 1:05 PM
+Author: Emmanuel VENISSE Date: 4/21/04 1:05:00 PM PDT
 Add method print
 
 ----------------------------
 Revision: 1 View: GRP_Dev Branch Revision: 1.0
-Author: Emmanuel VENISSE Date: 4/21/04 1:05 PM
+Author: Emmanuel VENISSE Date: 4/21/04 1:05:00 PM PDT
 =============================================================================
 
 History for: File1.java
@@ -20,12 +20,12 @@
 Status: Current
 ----------------------------
 Revision: 2 View: GRP_Dev Branch Revision: 1.1
-Author: Emmanuel VENISSE Date: 4/21/04 1:05 PM
+Author: Emmanuel VENISSE Date: 4/21/04 1:05:00 PM PDT
 Add method main
 
 ----------------------------
 Revision: 1 View: GRP_Dev Branch Revision: 1.0
-Author: Emmanuel VENISSE Date: 4/21/04 1:05 PM
+Author: Emmanuel VENISSE Date: 4/21/04 1:05:00 PM PDT
 =============================================================================
 
 Folder: test  (working dir: C:\Test\maven\test)
@@ -35,11 +35,11 @@
 Status: Current
 ----------------------------
 Revision: 2 View: GRP_Dev Branch Revision: 1.1
-Author: Emmanuel VENISSE Date: 4/21/04 1:05 PM
+Author: Emmanuel VENISSE Date: 4/21/04 1:05:00 PM PDT
 Add method main
 
 ----------------------------
 Revision: 1 View: GRP_Dev Branch Revision: 1.0
-Author: Emmanuel VENISSE Date: 4/21/04 1:05 PM
+Author: Emmanuel VENISSE Date: 4/21/04 1:05:00 PM PDT
 =============================================================================
 

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/diff/diff.txt
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/diff/diff.txt?rev=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/diff/diff.txt (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/diff/diff.txt Mon Jun 13 06:21:42 2005
@@ -0,0 +1,59 @@
+Folder: driver  (working dir: C:\dev\scm-starteam\driver)
+maven.xml Revision: 2 Date: 5/26/05 6:03:53 PM PDT
+maven.xml (on disk)
+-------------------------------------------------------------------------------
+       1       1  |<?xml version="1.0"?>
+       2       2  |
+       3       3  |
+       4       4  |<project
+       5       5  |  xmlns:j="jelly:core"
+       6       6  |  xmlns:u="jelly:util"
+       7       7  |  xmlns:ant="jelly:ant"
+       8       8  |  >
+       9       9  |
+-     10          |
+-     11          |
+-     12          |
+      13      10  |</project>
+      14      11  |
+-------------------------------------------------------------------------------
+
+Folder: dev  (working dir: C:\dev\scm-starteam\driver\dev)
+maven.xml Revision: 2 Date: 5/26/05 1:44:00 PM PDT
+maven.xml (on disk)
+-------------------------------------------------------------------------------
+       1       1  |<project
+       2       2  |  default="scm:bootstrap"
+       3       3  |  xmlns:j="jelly:core"
+       4       4  |  xmlns:u="jelly:util"
+       5       5  |  xmlns:ant="jelly:ant"
+       6       6  |  >
++              7  |
+-      7          |
+       8       8  |
+       9       9  |
+      10      10  |</project>
+      11      11  |
+-------------------------------------------------------------------------------
+
+project.xml Revision: 3 Date: 5/25/05 5:08:12 PM PDT
+project.xml (on disk)
+-------------------------------------------------------------------------------
+       1       1  |<?xml version="1.0" encoding="ISO-8859-1"?>
+       2       2  |
+       3       3  |<project>
++              4  |  <extend>${basedir}/../common/project.xml</extend>
++              5  |  <artifactId>janeva-build-bootstrap-driver</artifactId>
++              6  |  <name>Janeva Build Bootstrap Driver</name>
+-      4          |  <extend>${basedir}/../project.xml</extend>
+-      5          |  <artifactId>janeva-build-driver-dev</artifactId>
+-      6          |  <name>Janeva Build Driver Dev</name>
+       7       7  |
+       8       8  |  <dependencies>
+-      9          |
+      10       9  |  </dependencies>
+      11      10  |
+      12      11  |</project>
+      13      12  |
+-------------------------------------------------------------------------------
+

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/status/status.txt
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/status/status.txt?rev=190397&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/status/status.txt (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/resources/starteam/status/status.txt Mon Jun 13 06:21:42 2005
@@ -0,0 +1,110 @@
+Folder: driver  (working dir: /usr/scm-starteam/driver)
+History for: maven.xml
+Description:
+Locked by:
+Status: Out of Date
+----------------------------
+Revision: 2 View: driver Branch Revision: 1.1
+Author: build Date: 5/26/05 6:03:53 PM PDT
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:42:28 PM PDT
+=============================================================================
+
+History for: project.properties
+Description:
+Locked by:
+Status: Merge
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:42:28 PM PDT
+=============================================================================
+
+History for: project.xml
+Description:
+Locked by:
+Status: Current
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:42:28 PM PDT
+=============================================================================
+
+Folder: bootstrap  (working dir: /usr/scm-starteam/driver/bootstrap)
+History for: maven.xml
+Description:
+Locked by:
+Status: Current
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:41:22 PM PDT
+=============================================================================
+
+History for: project.properties
+Description:
+Locked by:
+Status: Current
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:41:22 PM PDT
+=============================================================================
+
+History for: project.xml
+Description:
+Locked by:
+Status: Current
+----------------------------
+Revision: 2 View: driver Branch Revision: 1.1
+Author: build Date: 5/25/05 4:50:13 PM PDT
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:41:22 PM PDT
+=============================================================================
+
+Folder: xdocs  (working dir: /usr/scm-starteam/driver/bootstrap/xdocs)
+History for: index.xml
+Description:
+Locked by:
+Status: Missing
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/27/05 9:35:44 AM PDT
+initial revision
+
+=============================================================================
+
+Folder: dev  (working dir: /usr/scm-starteam/driver/dev)
+History for: maven.xml
+Description:
+Locked by:
+Status: Current
+----------------------------
+Revision: 2 View: driver Branch Revision: 1.1
+Author: build Date: 5/26/05 1:44:00 PM PDT
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:40:06 PM PDT
+=============================================================================
+
+History for: project.properties
+Description:
+Locked by:
+Status: Modified
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:40:06 PM PDT
+=============================================================================
+
+History for: project.xml
+Description:
+Locked by:
+Status: Current
+----------------------------
+Revision: 3 View: driver Branch Revision: 1.2
+Author: build Date: 5/25/05 5:08:12 PM PDT
+----------------------------
+Revision: 2 View: driver Branch Revision: 1.1
+Author: build Date: 5/25/05 4:53:18 PM PDT
+----------------------------
+Revision: 1 View: driver Branch Revision: 1.0
+Author: build Date: 5/25/05 4:40:07 PM PDT
+=============================================================================
\ No newline at end of file