RacyGitTests: Open NameConflictTreeWalk in try-with-resource
Change-Id: Ic17b05fd7d056761b352168de97efb607a289276 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
parent
3adea9ac7f
commit
83f1f8fc7c
|
@ -82,38 +82,42 @@ public void testIterator() throws IllegalStateException, IOException,
|
||||||
}
|
}
|
||||||
FileTreeIteratorWithTimeControl fileIt = new FileTreeIteratorWithTimeControl(
|
FileTreeIteratorWithTimeControl fileIt = new FileTreeIteratorWithTimeControl(
|
||||||
db, modTimes);
|
db, modTimes);
|
||||||
NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
|
try (NameConflictTreeWalk tw = new NameConflictTreeWalk(db)) {
|
||||||
tw.addTree(fileIt);
|
tw.addTree(fileIt);
|
||||||
tw.setRecursive(true);
|
tw.setRecursive(true);
|
||||||
FileTreeIterator t;
|
FileTreeIterator t;
|
||||||
long t0 = 0;
|
long t0 = 0;
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
assertTrue(tw.next());
|
assertTrue(tw.next());
|
||||||
t = tw.getTree(0, FileTreeIterator.class);
|
t = tw.getTree(0, FileTreeIterator.class);
|
||||||
if (i == 0)
|
if (i == 0) {
|
||||||
t0 = t.getEntryLastModified();
|
t0 = t.getEntryLastModified();
|
||||||
else
|
} else {
|
||||||
assertEquals(t0, t.getEntryLastModified());
|
assertEquals(t0, t.getEntryLastModified());
|
||||||
}
|
}
|
||||||
long t1 = 0;
|
}
|
||||||
for (int i = 0; i < 10; i++) {
|
long t1 = 0;
|
||||||
assertTrue(tw.next());
|
for (int i = 0; i < 10; i++) {
|
||||||
t = tw.getTree(0, FileTreeIterator.class);
|
assertTrue(tw.next());
|
||||||
if (i == 0) {
|
t = tw.getTree(0, FileTreeIterator.class);
|
||||||
t1 = t.getEntryLastModified();
|
if (i == 0) {
|
||||||
assertTrue(t1 > t0);
|
t1 = t.getEntryLastModified();
|
||||||
} else
|
assertTrue(t1 > t0);
|
||||||
assertEquals(t1, t.getEntryLastModified());
|
} else {
|
||||||
}
|
assertEquals(t1, t.getEntryLastModified());
|
||||||
long t2 = 0;
|
}
|
||||||
for (int i = 0; i < 10; i++) {
|
}
|
||||||
assertTrue(tw.next());
|
long t2 = 0;
|
||||||
t = tw.getTree(0, FileTreeIterator.class);
|
for (int i = 0; i < 10; i++) {
|
||||||
if (i == 0) {
|
assertTrue(tw.next());
|
||||||
t2 = t.getEntryLastModified();
|
t = tw.getTree(0, FileTreeIterator.class);
|
||||||
assertTrue(t2 > t1);
|
if (i == 0) {
|
||||||
} else
|
t2 = t.getEntryLastModified();
|
||||||
assertEquals(t2, t.getEntryLastModified());
|
assertTrue(t2 > t1);
|
||||||
|
} else {
|
||||||
|
assertEquals(t2, t.getEntryLastModified());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue