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 tr...@apache.org on 2004/11/02 22:58:30 UTC
cvs commit: maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm ScmTestCase.java
trygvis 2004/11/02 13:58:30
Modified: maven-scm-api/src/main/java/org/apache/maven/scm
ScmTestCase.java
Log:
o Adding a generic ScmResult assertion.
Revision Changes Path
1.7 +36 -19 maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTestCase.java
Index: ScmTestCase.java
===================================================================
RCS file: /home/cvs/maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ScmTestCase.java 31 Oct 2004 14:12:11 -0000 1.6
+++ ScmTestCase.java 2 Nov 2004 21:58:30 -0000 1.7
@@ -17,20 +17,19 @@
*/
import java.io.File;
-import java.io.IOException;
import java.io.FileWriter;
+import java.io.IOException;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
-import junit.framework.TestCase;
-
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
import org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer;
+import org.codehaus.plexus.util.cli.Commandline;
+import junit.framework.TestCase;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -77,6 +76,38 @@
}
// ----------------------------------------------------------------------
+ // Assertions
+ // ----------------------------------------------------------------------
+
+ public void assertPath( String expectedPath, String actualPath )
+ throws Exception
+ {
+ assertEquals( StringUtils.replace( expectedPath, "\\", "/" ), StringUtils.replace( expectedPath, "\\", "/" ) );
+ }
+
+ public void assertResultIsSuccess( ScmResult result )
+ {
+ if ( result.isSuccess() )
+ {
+ return;
+ }
+
+ System.err.println( "----------------------------------------------------------------------" );
+ System.err.println( "Provider message" );
+ System.err.println( "----------------------------------------------------------------------" );
+ System.err.println( result.getProviderMessage() );
+ System.err.println( "----------------------------------------------------------------------" );
+
+ System.err.println( "----------------------------------------------------------------------" );
+ System.err.println( "Command output" );
+ System.err.println( "----------------------------------------------------------------------" );
+ System.err.println( result.getCommandOutput() );
+ System.err.println( "----------------------------------------------------------------------" );
+
+ fail( "The check out result success flag was false." );
+ }
+
+ // ----------------------------------------------------------------------
// Utility Methods
// ----------------------------------------------------------------------
@@ -138,20 +169,6 @@
fail( "Exit value wasn't 0, was:" + exitValue );
}
}
-
- // ----------------------------------------------------------------------
- // Assertions
- // ----------------------------------------------------------------------
-
- protected void assertPath( String expectedPath, String actualPath )
- throws Exception
- {
- assertEquals( StringUtils.replace( expectedPath, "\\", "/" ), StringUtils.replace( expectedPath, "\\", "/" ) );
- }
-
- // ----------------------------------------------------------------------
- // Util methods
- // ----------------------------------------------------------------------
public static void makeDirectory( File basedir, String fileName )
{