diff options
Diffstat (limited to 'subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java')
-rw-r--r-- | subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java | 155 |
1 files changed, 86 insertions, 69 deletions
diff --git a/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java b/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java index 8190616..20f38f3 100644 --- a/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java +++ b/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java @@ -34,11 +34,12 @@ import java.util.Date; import org.apache.subversion.javahl.types.*; -import junit.framework.Assert; +import junit.framework.TestCase; + /** * This class describe the expected state of the working copy */ -public class WC +public class WC extends TestCase { /** * the map of the items of the working copy. The relative path is the key @@ -127,6 +128,16 @@ public class WC } /** + * 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 @@ -169,9 +180,9 @@ public class WC // since having no content signals a directory, changes of removing the // content or setting a former not set content is not allowed. That // would change the type of the item. - Assert.assertNotNull("cannot unset content", content); + assertNotNull("cannot unset content", content); Item i = items.get(path); - Assert.assertNotNull("cannot set content on directory", i.myContent); + assertNotNull("cannot set content on directory", i.myContent); i.myContent = content; } @@ -304,13 +315,13 @@ public class WC */ void check(DirEntry[] tested, String singleFilePath) { - Assert.assertEquals("not a single dir entry", 1, tested.length); + assertEquals("not a single dir entry", 1, tested.length); Item item = items.get(singleFilePath); - Assert.assertNotNull("not found in working copy", item); - Assert.assertNotNull("not a file", item.myContent); - Assert.assertEquals("state says file, working copy not", - tested[0].getNodeKind(), - item.nodeKind == null ? NodeKind.file : item.nodeKind); + assertNotNull("not found in working copy", item); + assertNotNull("not a file", item.myContent); + assertEquals("state says file, working copy not", + tested[0].getNodeKind(), + item.nodeKind == null ? NodeKind.file : item.nodeKind); } /** @@ -342,19 +353,18 @@ public class WC { String name = basePath + entry.getPath(); Item item = items.get(name); - Assert.assertNotNull("null paths won't be found in working copy", - item); + assertNotNull("null paths won't be found in working copy", item); if (item.myContent != null) { - Assert.assertEquals("Expected '" + entry + "' to be file", - entry.getNodeKind(), - item.nodeKind == null ? NodeKind.file : item.nodeKind); + assertEquals("Expected '" + entry + "' to be file", + entry.getNodeKind(), + item.nodeKind == null ? NodeKind.file : item.nodeKind); } else { - Assert.assertEquals("Expected '" + entry + "' to be dir", - entry.getNodeKind(), - item.nodeKind == null ? NodeKind.dir : item.nodeKind); + assertEquals("Expected '" + entry + "' to be dir", + entry.getNodeKind(), + item.nodeKind == null ? NodeKind.dir : item.nodeKind); } item.touched = true; } @@ -369,9 +379,9 @@ public class WC !item.myPath.equals(basePath)) { // Non-recursive checks will fail here. - Assert.assertFalse("Expected path '" + item.myPath + - "' not found in dir entries", - recursive); + assertFalse("Expected path '" + item.myPath + + "' not found in dir entries", + recursive); // Look deeper under the tree. boolean found = false; @@ -387,8 +397,8 @@ public class WC } } } - Assert.assertTrue("Expected path '" + item.myPath + - "' not found in dir entries", found); + assertTrue("Expected path '" + item.myPath + + "' not found in dir entries", found); } } } @@ -436,14 +446,14 @@ public class WC for (Status status : tested) { String path = status.getPath(); - Assert.assertTrue("status path starts not with working copy path", - path.startsWith(normalizeWCPath)); + assertTrue("status path starts not with working copy path", + path.startsWith(normalizeWCPath)); // we calculate the relative path to the working copy root if (path.length() > workingCopyPath.length() + 1) { - Assert.assertEquals("missing '/' in status path", - path.charAt(workingCopyPath.length()), '/'); + assertEquals("missing '/' in status path", + path.charAt(workingCopyPath.length()), '/'); path = path.substring(workingCopyPath.length() + 1); } else @@ -451,25 +461,26 @@ public class WC path = ""; Item item = items.get(path); - Assert.assertNotNull("status not found in working copy: " + path, - item); - Assert.assertEquals("wrong text status in working copy: " + path, - item.textStatus, status.getTextStatus()); + assertNotNull("status not found in working copy: " + path, item); + assertEquals("wrong text status in working copy: " + path, + item.textStatus, status.getTextStatus()); if (item.workingCopyRev != -1) - Assert.assertEquals("wrong revision number in working copy: " - + path, - item.workingCopyRev, status.getRevisionNumber()); - Assert.assertEquals("lock status wrong: " + path, - item.isLocked, status.isLocked()); - Assert.assertEquals("switch status wrong: " + path, - item.isSwitched, status.isSwitched()); - Assert.assertEquals("wrong prop status in working copy: " + path, - item.propStatus, status.getPropStatus()); + assertEquals("wrong revision number in working copy: " + path, + item.workingCopyRev, status.getRevisionNumber()); + assertEquals("lock status wrong: " + path, + item.isLocked, status.isLocked()); + assertEquals("switch status wrong: " + path, + 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) { - Assert.assertEquals("state says file, working copy not: " + path, - status.getNodeKind(), - item.nodeKind == null ? NodeKind.file : item.nodeKind); + assertEquals("state says file, working copy not: " + path, + status.getNodeKind(), + item.nodeKind == null ? NodeKind.file : item.nodeKind); if (status.getTextStatus() == Status.Kind.normal || item.checkContent) { @@ -483,26 +494,26 @@ public class WC buffer.append((char) ch); } rd.close(); - Assert.assertEquals("content mismatch: " + path, - buffer.toString(), item.myContent); + assertEquals("content mismatch: " + path, + buffer.toString(), item.myContent); } } else { - Assert.assertEquals("state says dir, working copy not: " + path, - status.getNodeKind(), - item.nodeKind == null ? NodeKind.dir : item.nodeKind); + assertEquals("state says dir, working copy not: " + path, + status.getNodeKind(), + item.nodeKind == null ? NodeKind.dir : item.nodeKind); } if (checkRepos) { - Assert.assertEquals("Last commit revisions for OOD path '" - + item.myPath + "' don't match:", - item.reposLastCmtRevision, - status.getReposLastCmtRevisionNumber()); - Assert.assertEquals("Last commit kinds for OOD path '" - + item.myPath + "' don't match:", - item.reposKind, status.getReposKind()); + assertEquals("Last commit revisions for OOD path '" + + item.myPath + "' don't match:", + item.reposLastCmtRevision, + status.getReposLastCmtRevisionNumber()); + assertEquals("Last commit kinds for OOD path '" + + item.myPath + "' don't match:", + item.reposKind, status.getReposKind()); // Only the last committed rev and kind is available for // paths deleted in the repos. @@ -511,17 +522,17 @@ public class WC long lastCmtTime = (status.getReposLastCmtDate() == null ? 0 : status.getReposLastCmtDate().getTime()); - Assert.assertEquals("Last commit dates for OOD path '" + - item.myPath + "' don't match:", - new Date(item.reposLastCmtDate), - new Date(lastCmtTime)); - Assert.assertEquals("Last commit authors for OOD path '" - + item.myPath + "' don't match:", - item.reposLastCmtAuthor, - status.getReposLastCmtAuthor()); - Assert.assertNotNull("URL for path " + item.myPath - + " should not be null", - status.getUrl()); + assertEquals("Last commit dates for OOD path '" + + item.myPath + "' don't match:", + new Date(item.reposLastCmtDate), + new Date(lastCmtTime)); + assertEquals("Last commit authors for OOD path '" + + item.myPath + "' don't match:", + item.reposLastCmtAuthor, + status.getReposLastCmtAuthor()); + assertNotNull("URL for path " + item.myPath + + " should not be null", + status.getUrl()); } } item.touched = true; @@ -531,9 +542,9 @@ public class WC // result array for (Item item : items.values()) { - Assert.assertTrue("item '" + item.myPath + - "' in working copy not found in status", - item.touched); + assertTrue("item '" + item.myPath + + "' in working copy not found in status", + item.touched); } } @@ -563,6 +574,11 @@ public class WC 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; @@ -635,6 +651,7 @@ public class WC myContent = source.myContent; textStatus = source.textStatus; propStatus = source.propStatus; + depth = source.depth; owner.items.put(myPath, this); } |