ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1534957 - /ace/trunk/org.apache.ace.repository/test/org/apache/ace/repository/impl/RepositoryImplTest.java
Date Wed, 23 Oct 2013 08:36:09 GMT
Author: jawi
Date: Wed Oct 23 08:36:08 2013
New Revision: 1534957

URL: http://svn.apache.org/r1534957
Log:
ACE-421 - minor updates to the unit tests.


Modified:
    ace/trunk/org.apache.ace.repository/test/org/apache/ace/repository/impl/RepositoryImplTest.java

Modified: ace/trunk/org.apache.ace.repository/test/org/apache/ace/repository/impl/RepositoryImplTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository/test/org/apache/ace/repository/impl/RepositoryImplTest.java?rev=1534957&r1=1534956&r2=1534957&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository/test/org/apache/ace/repository/impl/RepositoryImplTest.java
(original)
+++ ace/trunk/org.apache.ace.repository/test/org/apache/ace/repository/impl/RepositoryImplTest.java
Wed Oct 23 08:36:08 2013
@@ -45,7 +45,7 @@ public class RepositoryImplTest {
      * Tests that if we do change something in an {@link InputStream} while committing data,
that the version is bumped
      * for a repository.
      */
-    @Test
+    @Test(groups = { UNIT })
     public void testCheckoutAndCommitWithChangeDoesChangeVersion() throws Exception {
         SortedRangeSet range;
         RepositoryImpl repo = new RepositoryImpl(new File(m_baseDir, "data"), new File(m_baseDir,
"tmp"), true);
@@ -61,7 +61,7 @@ public class RepositoryImplTest {
 
         data = new ByteArrayInputStream("def".getBytes());
 
-        assertTrue(repo.commit(data, 1), "Commit should be ignored");
+        assertTrue(repo.commit(data, 1), "Commit should NOT be ignored");
 
         range = repo.getRange();
         assertEquals(2, range.getHigh());
@@ -71,7 +71,7 @@ public class RepositoryImplTest {
      * Tests that if we do not change anything in an {@link InputStream} while committing
data, that the version is not
      * bumped for a repository.
      */
-    @Test
+    @Test(groups = { UNIT })
     public void testCheckoutAndCommitWithoutChangeDoesNotChangeVersion() throws Exception
{
         SortedRangeSet range;
         RepositoryImpl repo = new RepositoryImpl(new File(m_baseDir, "data"), new File(m_baseDir,
"tmp"), true);
@@ -137,6 +137,25 @@ public class RepositoryImplTest {
         repo.commit(data, 1); // should fail, as we're at version 0!
     }
 
+    /**
+     * Tests that if we do change something in an {@link InputStream} while committing data,
that the version is bumped
+     * for a repository.
+     */
+    @Test(groups = { UNIT })
+    public void testCommitInitialVersionDoesChangeVersion() throws Exception {
+        SortedRangeSet range;
+        RepositoryImpl repo = new RepositoryImpl(new File(m_baseDir, "data"), new File(m_baseDir,
"tmp"), true);
+        InputStream data = new ByteArrayInputStream("abc".getBytes());
+
+        range = repo.getRange();
+        assertEquals(0, range.getHigh(), "Version 0 should be the most recent one");
+
+        assertTrue(repo.commit(data, 0), "Commit should NOT be ignored");
+
+        range = repo.getRange();
+        assertEquals(1, range.getHigh());
+    }
+
     @Test(groups = { UNIT })
     public void testCommitMultipleVersionsOk() throws Exception {
         RepositoryImpl repo = new RepositoryImpl(new File(m_baseDir, "data"), new File(m_baseDir,
"tmp"), true);



Mime
View raw message