mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Database refactoring to fix injection problems.
This commit is contained in:
@@ -25,17 +25,15 @@ public class DatabaseCleanerImplTest extends TestCase {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
// Configure the cleaner to wait for 30 seconds between sweeps
|
||||
DatabaseCleanerImpl cleaner =
|
||||
new DatabaseCleanerImpl(callback, 30 * 1000);
|
||||
DatabaseCleanerImpl cleaner = new DatabaseCleanerImpl();
|
||||
long start = System.currentTimeMillis();
|
||||
// Start the cleaner and check that shouldCheckFreeSpace() is called
|
||||
cleaner.startCleaning();
|
||||
cleaner.startCleaning(callback, 30L * 1000L);
|
||||
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||
// Stop the cleaner (it should be waiting between sweeps)
|
||||
cleaner.stopCleaning();
|
||||
long end = System.currentTimeMillis();
|
||||
// Check that much less than 30 seconds expired
|
||||
assertTrue(end - start < 10 * 1000);
|
||||
assertTrue(end - start < 10L * 1000L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,9 @@ public abstract class DatabaseComponentTest extends TestCase {
|
||||
allowing(database).commitTransaction(txn);
|
||||
// open(false)
|
||||
oneOf(database).open(false);
|
||||
oneOf(cleaner).startCleaning();
|
||||
oneOf(cleaner).startCleaning(
|
||||
with(any(DatabaseCleaner.Callback.class)),
|
||||
with(any(long.class)));
|
||||
// getRating(authorId)
|
||||
oneOf(database).getRating(txn, authorId);
|
||||
will(returnValue(Rating.UNRATED));
|
||||
|
||||
Reference in New Issue
Block a user