maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r684588 - in /maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons: ./ src/test/java/org/apache/maven/scm/provider/git/command/diff/ src/test/resources/git/diff/
Date Sun, 10 Aug 2008 20:51:42 GMT
Author: olamy
Date: Sun Aug 10 13:51:41 2008
New Revision: 684588

URL: http://svn.apache.org/viewvc?rev=684588&view=rev
Log:
[SCM-374] maven-scm-providers-git is missing some testdata
add unit tests for the git diff consumer


Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff-empty.log
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff1.log
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff2.log
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/pom.xml
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/pom.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/pom.xml?rev=684588&r1=684587&r2=684588&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/pom.xml
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/pom.xml
Sun Aug 10 13:51:41 2008
@@ -37,14 +37,6 @@
   <build>
     <plugins>
       <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>**/GitDiffConsumerTest.*</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-      <plugin>
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
         <executions>

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java?rev=684588&r1=684587&r2=684588&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
Sun Aug 10 13:51:41 2008
@@ -38,7 +38,7 @@
 {
 
     public void testEmptyLogConsumer()
-    throws Exception
+        throws Exception
     {
         GitDiffConsumer consumer = new GitDiffConsumer( new DefaultLog(), null );
 
@@ -54,12 +54,12 @@
         }
 
         List changedFiles = consumer.getChangedFiles();
-        
+
         assertEquals( 0, changedFiles.size() );
-   }
+    }
 
     public void testLog1Consumer()
-    throws Exception
+        throws Exception
     {
         GitDiffConsumer consumer = new GitDiffConsumer( new DefaultLog(), null );
 
@@ -75,21 +75,21 @@
         }
 
         List changedFiles = consumer.getChangedFiles();
-        
+
         assertEquals( 1, changedFiles.size() );
 
-        testScmFile( (ScmFile) changedFiles.get( 0 ), "readme.txt" , ScmFileStatus.MODIFIED
);
-        
+        testScmFile( (ScmFile) changedFiles.get( 0 ), "olamy.test", ScmFileStatus.MODIFIED
);
+
         Map differences = consumer.getDifferences();
         assertNotNull( differences );
-        
-        StringBuffer readmeDiffs = (StringBuffer) differences.get( "readme.txt" );
+
+        StringBuffer readmeDiffs = (StringBuffer) differences.get( "olamy.test" );
         assertNotNull( readmeDiffs );
-        assertTrue( readmeDiffs.indexOf( "-/readme.txt" ) >= 0 );
-   }
-  
+        assertTrue( readmeDiffs.indexOf( "+new line" ) >= 0 );
+    }
+
     public void testLog2Consumer()
-    throws Exception
+        throws Exception
     {
         GitDiffConsumer consumer = new GitDiffConsumer( new DefaultLog(), null );
 
@@ -105,26 +105,25 @@
         }
 
         List changedFiles = consumer.getChangedFiles();
-        
-        assertEquals( 12, changedFiles.size() );
-        
-        testScmFile( (ScmFile) changedFiles.get( 0 ), 
-        		     "maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitAddCommand.java",

-        		     ScmFileStatus.MODIFIED );
-        
-        testScmFile( (ScmFile) changedFiles.get( 1 ), 
-        		     "maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/branch/GitBranchCommand.java",

-        		     ScmFileStatus.MODIFIED );
-        
+
+        assertEquals( 2, changedFiles.size() );
+
+        testScmFile( (ScmFile) changedFiles.get( 0 ), "pom.xml", ScmFileStatus.MODIFIED );
+
+        testScmFile( (ScmFile) changedFiles.get( 1 ), "test.txt", ScmFileStatus.MODIFIED
);
+
         Map differences = consumer.getDifferences();
         assertNotNull( differences );
-        
-        StringBuffer addDiffs = (StringBuffer) differences.get( "maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/add/GitAddCommand.java"
);
+
+        StringBuffer addDiffs = (StringBuffer) differences.get( "pom.xml" );
         assertNotNull( addDiffs );
-        assertTrue( addDiffs.indexOf( "verbosity needed for consumer" ) >= 0 );
+        assertTrue( addDiffs.indexOf( "+  <!-- test -->" ) >= 0 );
+
+        addDiffs = (StringBuffer) differences.get( "test.txt" );
+        assertNotNull( addDiffs );
+        assertTrue( addDiffs.indexOf( "+maven-scm git provider works fine :-)" ) >= 0
);
     }
-    
-    
+
     private void testScmFile( ScmFile fileToTest, String expectedFilePath, ScmFileStatus
expectedStatus )
     {
         assertEquals( expectedFilePath, fileToTest.getPath() );

Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff-empty.log
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff-empty.log?rev=684588&view=auto
==============================================================================
    (empty)

Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff1.log
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff1.log?rev=684588&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff1.log
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff1.log
Sun Aug 10 13:51:41 2008
@@ -0,0 +1,7 @@
+diff --git a/olamy.test b/olamy.test
+index 83fecd7..a64804b 100644
+--- a/olamy.test
++++ b/olamy.test
+@@ -1 +1,2 @@
+ test olamy
++new line
\ No newline at end of file

Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff2.log
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff2.log?rev=684588&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff2.log
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/resources/git/diff/git-diff2.log
Sun Aug 10 13:51:41 2008
@@ -0,0 +1,17 @@
+diff --git a/pom.xml b/pom.xml
+index 5bb559a..4d2f09a 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -42,4 +42,5 @@
+       <url>file://${user.home}/mavenreposnapshot</url>
+     </snapshotRepository>
+   </distributionManagement>
++  <!-- test -->
+ </project>
+diff --git a/test.txt b/test.txt
+index 1b69af7..e12ba22 100644
+--- a/test.txt
++++ b/test.txt
+@@ -1 +1,2 @@
+ Huhu ...who is there?
++maven-scm git provider works fine :-)
\ No newline at end of file



Mime
View raw message