[ 
https://issues.apache.org/jira/browse/WAGON-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585250#comment-16585250
 ] 

ASF GitHub Bot commented on WAGON-500:
--------------------------------------

asfgit closed pull request #44: [WAGON-500] re-enable ScmCvsExeWagonTest
URL: https://github.com/apache/maven-wagon/pull/44
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java 
b/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
index e89f1e29..ddbb5914 100644
--- 
a/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
+++ 
b/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
@@ -93,6 +93,8 @@ public int getSize()
 
     protected String resource;
 
+    protected boolean testSkipped;
+
     protected File artifactSourceFile;
 
     protected File artifactDestFile;
@@ -226,6 +228,24 @@ protected Wagon getWagon()
         return wagon;
     }
 
+    /**
+     * @param cmd the executable to run, not null.
+     * @return <code>true</code>
+     */
+    public static boolean isSystemCmd( String cmd )
+    {
+        try
+        {
+            Runtime.getRuntime().exec( cmd );
+
+            return true;
+        }
+        catch ( IOException e )
+        {
+            return false;
+        }
+    }
+
     protected void message( String message )
     {
         logger.info( message );
@@ -261,6 +281,16 @@ public void testWagonGetIfNewerIsNewer()
             // CHECKSTYLE_ON: MagicNumber
         }
     }
+    
+    @Override
+    protected void runTest()
+        throws Throwable
+    {
+        if ( !testSkipped )
+        {
+            super.runTest();
+        }
+    }
 
     protected boolean supportsGetIfNewer()
     {
diff --git a/wagon-providers/wagon-scm/pom.xml 
b/wagon-providers/wagon-scm/pom.xml
index 68ac1c6f..2d54981f 100644
--- a/wagon-providers/wagon-scm/pom.xml
+++ b/wagon-providers/wagon-scm/pom.xml
@@ -83,8 +83,6 @@ under the License.
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <excludes>
-            <!-- disable testing the CVS SCM as CVS is broken -->
-            <exclude>**/*Cvs*.java</exclude>
           </excludes>
         </configuration>
       </plugin>
diff --git 
a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmCvsWagonTest.java
 
b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmCvsWagonTest.java
index eac45626..26d3d6db 100644
--- 
a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmCvsWagonTest.java
+++ 
b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmCvsWagonTest.java
@@ -19,8 +19,11 @@
  * under the License.
  */
 
+import java.io.File;
 import java.io.IOException;
 
+import org.codehaus.plexus.util.FileUtils;
+
 /**
  * Test for ScmWagon using CVS as underlying SCM
  * 
@@ -30,6 +33,25 @@
 public abstract class AbstractScmCvsWagonTest
     extends AbstractScmWagonTest
 {
+    private String repository;
+
+    @Override
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        File origRepo = getTestFile( "target/test-classes/test-repo-cvs" );
+
+        File testRepo = getTestFile( "target/test-classes/test-repo-cvs-test" 
);
+
+        FileUtils.deleteDirectory( testRepo );
+
+        FileUtils.copyDirectoryStructure( origRepo, testRepo );
+
+        repository = "scm:cvs|local|" + testRepo.getAbsolutePath() + 
"|repository";
+
+    }
 
     protected String getScmId()
     {
@@ -39,8 +61,6 @@ protected String getScmId()
     protected String getTestRepositoryUrl()
         throws IOException
     {
-        String repository = getTestFile( "target/test-classes/test-repo-cvs" 
).getAbsolutePath();
-
-        return "scm:cvs|local|" + repository + "|repository";
+        return repository;
     }
 }
diff --git 
a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmCvsExeWagonTest.java
 
b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmCvsExeWagonTest.java
index 8839faf0..f795a638 100644
--- 
a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmCvsExeWagonTest.java
+++ 
b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmCvsExeWagonTest.java
@@ -31,34 +31,60 @@
 public class ScmCvsExeWagonTest
     extends AbstractScmCvsWagonTest
 {
+    
+    @Override
+    protected void setUp()
+        throws Exception
+    {
+        assumeHaveCvsBinary();
+        if ( !testSkipped )
+        {
+            super.setUp();
+        }
+    }
 
     protected ScmProvider getScmProvider()
     {
         return new CvsExeScmProvider();
     }
 
-    public void testFailedGet()
+    @Override
+    public void testWagonGetFileList()
         throws Exception
     {
-        // Not ready yet
+        // cvs rls is rare
     }
 
-    public void testWagon()
+    @Override
+    public void testWagonResourceExists()
         throws Exception
     {
-        // Not ready yet
+        // cvs rls is rare
     }
 
-    public void testWagonPutDirectory()
+    @Override
+    public void testWagonResourceNotExists()
         throws Exception
     {
-        // Not ready yet
+        // cvs rls is rare
     }
 
-    public void testWagonPutDirectoryWhenDirectoryAlreadyExists()
-        throws Exception
+    @Override
+    protected boolean supportsGetIfNewer()
+    {
+        return false;
+    }
+
+    /** Optionally set the testSkipped flag */
+    protected void assumeHaveCvsBinary()
     {
-        // Not ready yet
+        if ( !isSystemCmd( CVS_COMMAND_LINE ) )
+        {
+            testSkipped = true;
+            System.err.println( "'" + CVS_COMMAND_LINE + "' is not a system 
command. Ignored " + getName() + "." );
+        }
     }
 
+    /** 'cvs' command line */
+    public static final String CVS_COMMAND_LINE = "cvs";
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Re-enable ScmCvsExeWagonTest
> ----------------------------
>
>                 Key: WAGON-500
>                 URL: https://issues.apache.org/jira/browse/WAGON-500
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-scm
>    Affects Versions: 3.0.0, 3.1.0
>            Reporter: Ilya Basin
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: 3.1.1
>
>
> ScmCvsExeWagonTest should be re-enabled



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to