You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/03/13 12:12:18 UTC

svn commit: r1577112 - in /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl: BasicTests.java WC.java

Author: brane
Date: Thu Mar 13 11:12:18 2014
New Revision: 1577112

URL: http://svn.apache.org/r1577112
Log:
Extend the JavaHL status test to verify the ambient depth.

[in subversion/bindings/javahl/tests/org/apache/subversion/javahl]
* WC.java
  (WC.setItemDepth): New method.
  (WC.check(Status[], ...): Verify the ambient depth, if enabled.
  (WC.Item.depth): New member; defaults to null, which implies no check.
  (WC.Item.Item): Set depth durgin copy-construction.
* BasicTests.java
  (BasicTests.testBasicStatus): Verify the ambient depth of the WC root
   and the file "iota". Cover all cases of returned status during
   test result verification.

Modified:
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1577112&r1=1577111&r2=1577112&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Thu Mar 13 11:12:18 2014
@@ -307,6 +307,8 @@ public class BasicTests extends SVNTests
         OneTest thisTest = new OneTest();
 
         // check the status of the working copy
+        thisTest.getWc().setItemDepth("", Depth.infinity);
+        thisTest.getWc().setItemDepth("iota", Depth.unknown);
         thisTest.checkStatus();
 
         // Test status of non-existent file
@@ -315,17 +317,20 @@ public class BasicTests extends SVNTests
         MyStatusCallback statusCallback = new MyStatusCallback();
         client.status(fileToSVNPath(fileC, false), Depth.unknown, false, true,
                     false, false, null, statusCallback);
-        if (statusCallback.getStatusArray().length > 1)
-            fail("File foo.c should not return more than one status.");
-        if (statusCallback.getStatusArray().length == 1)
+
+        final int statusCount = statusCallback.getStatusArray().length;
+        if (statusCount == 1)
         {
             Status st = statusCallback.getStatusArray()[0];
             if (st.isConflicted()
                 || st.getNodeStatus() != Status.Kind.none
                 || st.getRepositoryNodeStatus() != Status.Kind.none)
-                fail("File foo.c should not return a status.");
+                fail("File foo.c should return empty status.");
         }
-
+        else if (statusCount > 1)
+            fail("File foo.c should not return more than one status.");
+        else
+            fail("File foo.c should return exactly one empty status.");
     }
 
     /**

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java?rev=1577112&r1=1577111&r2=1577112&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java Thu Mar 13 11:12:18 2014
@@ -128,6 +128,16 @@ public class WC extends TestCase
     }
 
     /**
+     * Set the depth of the item at a path
+     * @param path      the path, where the status is set
+     * @param depth     the new depth
+     */
+    public void setItemDepth(String path, Depth depth)
+    {
+        items.get(path).depth = depth;
+    }
+
+    /**
      * Set the revision number of the item at a path
      * @param path      the path, where the revision number is set
      * @param revision  the new revision number
@@ -463,6 +473,9 @@ public class WC extends TestCase
                          item.isSwitched, status.isSwitched());
             assertEquals("wrong prop status in working copy: " + path,
                          item.propStatus, status.getPropStatus());
+            if (item.depth != null)
+                assertEquals("wrong ambient depth in working copy: " + path,
+                             item.depth, status.getDepth());
             if (item.myContent != null)
             {
                 assertEquals("state says file, working copy not: " + path,
@@ -561,6 +574,11 @@ public class WC extends TestCase
         Status.Kind propStatus = Status.Kind.none;
 
         /**
+         * the ambient depth of the item.
+         */
+        Depth depth = null;
+
+        /**
          * the expected revision number. -1 means do not check.
          */
         long workingCopyRev = -1;
@@ -633,6 +651,7 @@ public class WC extends TestCase
             myContent = source.myContent;
             textStatus = source.textStatus;
             propStatus = source.propStatus;
+            depth = source.depth;
             owner.items.put(myPath, this);
         }