mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Merged clock and os packages, moved events into their own package.
This commit is contained in:
@@ -41,7 +41,6 @@ import net.sf.briar.api.transport.ConnectionReader;
|
||||
import net.sf.briar.api.transport.ConnectionReaderFactory;
|
||||
import net.sf.briar.api.transport.ConnectionWriter;
|
||||
import net.sf.briar.api.transport.ConnectionWriterFactory;
|
||||
import net.sf.briar.clock.ClockModule;
|
||||
import net.sf.briar.crypto.CryptoModule;
|
||||
import net.sf.briar.db.DatabaseModule;
|
||||
import net.sf.briar.messaging.MessagingModule;
|
||||
@@ -49,6 +48,7 @@ import net.sf.briar.messaging.duplex.DuplexMessagingModule;
|
||||
import net.sf.briar.messaging.simplex.SimplexMessagingModule;
|
||||
import net.sf.briar.reliability.ReliabilityModule;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.system.ClockModule;
|
||||
import net.sf.briar.transport.TransportModule;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.sf.briar;
|
||||
import java.io.File;
|
||||
|
||||
import net.sf.briar.api.db.DatabaseConfig;
|
||||
import net.sf.briar.api.os.FileUtils;
|
||||
import net.sf.briar.api.system.FileUtils;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.sf.briar;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sf.briar.api.os.FileUtils;
|
||||
import net.sf.briar.api.system.FileUtils;
|
||||
|
||||
public class TestFileUtils implements FileUtils {
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import net.sf.briar.BriarTestCase;
|
||||
import net.sf.briar.api.clock.SystemTimer;
|
||||
import net.sf.briar.api.clock.Timer;
|
||||
import net.sf.briar.api.db.DbException;
|
||||
import net.sf.briar.api.system.SystemTimer;
|
||||
import net.sf.briar.api.system.Timer;
|
||||
import net.sf.briar.db.DatabaseCleaner.Callback;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -5,10 +5,10 @@ import static net.sf.briar.db.DatabaseConstants.MIN_FREE_SPACE;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import net.sf.briar.api.clock.SystemClock;
|
||||
import net.sf.briar.api.db.DatabaseComponent;
|
||||
import net.sf.briar.api.db.DbException;
|
||||
import net.sf.briar.api.lifecycle.ShutdownManager;
|
||||
import net.sf.briar.api.system.SystemClock;
|
||||
import net.sf.briar.db.DatabaseCleaner.Callback;
|
||||
|
||||
import org.jmock.Expectations;
|
||||
|
||||
@@ -24,18 +24,18 @@ import net.sf.briar.api.db.NoSuchContactException;
|
||||
import net.sf.briar.api.db.NoSuchLocalAuthorException;
|
||||
import net.sf.briar.api.db.NoSuchSubscriptionException;
|
||||
import net.sf.briar.api.db.NoSuchTransportException;
|
||||
import net.sf.briar.api.db.event.ContactAddedEvent;
|
||||
import net.sf.briar.api.db.event.ContactRemovedEvent;
|
||||
import net.sf.briar.api.db.event.DatabaseListener;
|
||||
import net.sf.briar.api.db.event.LocalAuthorAddedEvent;
|
||||
import net.sf.briar.api.db.event.LocalAuthorRemovedEvent;
|
||||
import net.sf.briar.api.db.event.LocalSubscriptionsUpdatedEvent;
|
||||
import net.sf.briar.api.db.event.LocalTransportsUpdatedEvent;
|
||||
import net.sf.briar.api.db.event.MessageAddedEvent;
|
||||
import net.sf.briar.api.db.event.MessageToAckEvent;
|
||||
import net.sf.briar.api.db.event.MessageToRequestEvent;
|
||||
import net.sf.briar.api.db.event.SubscriptionAddedEvent;
|
||||
import net.sf.briar.api.db.event.SubscriptionRemovedEvent;
|
||||
import net.sf.briar.api.event.ContactAddedEvent;
|
||||
import net.sf.briar.api.event.ContactRemovedEvent;
|
||||
import net.sf.briar.api.event.EventListener;
|
||||
import net.sf.briar.api.event.LocalAuthorAddedEvent;
|
||||
import net.sf.briar.api.event.LocalAuthorRemovedEvent;
|
||||
import net.sf.briar.api.event.LocalSubscriptionsUpdatedEvent;
|
||||
import net.sf.briar.api.event.LocalTransportsUpdatedEvent;
|
||||
import net.sf.briar.api.event.MessageAddedEvent;
|
||||
import net.sf.briar.api.event.MessageToAckEvent;
|
||||
import net.sf.briar.api.event.MessageToRequestEvent;
|
||||
import net.sf.briar.api.event.SubscriptionAddedEvent;
|
||||
import net.sf.briar.api.event.SubscriptionRemovedEvent;
|
||||
import net.sf.briar.api.lifecycle.ShutdownManager;
|
||||
import net.sf.briar.api.messaging.Ack;
|
||||
import net.sf.briar.api.messaging.Group;
|
||||
@@ -120,7 +120,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
exactly(11).of(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -278,7 +278,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -990,7 +990,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -1031,7 +1031,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -1093,7 +1093,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -1294,7 +1294,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -1326,7 +1326,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -1354,7 +1354,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -1389,7 +1389,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
@@ -1421,7 +1421,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
||||
final Database<Object> database = context.mock(Database.class);
|
||||
final DatabaseCleaner cleaner = context.mock(DatabaseCleaner.class);
|
||||
final ShutdownManager shutdown = context.mock(ShutdownManager.class);
|
||||
final DatabaseListener listener = context.mock(DatabaseListener.class);
|
||||
final EventListener listener = context.mock(EventListener.class);
|
||||
context.checking(new Expectations() {{
|
||||
// setVisibility()
|
||||
oneOf(database).startTransaction();
|
||||
|
||||
@@ -31,7 +31,6 @@ import net.sf.briar.api.LocalAuthor;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.clock.SystemClock;
|
||||
import net.sf.briar.api.db.DbException;
|
||||
import net.sf.briar.api.db.MessageHeader;
|
||||
import net.sf.briar.api.messaging.Group;
|
||||
@@ -39,6 +38,7 @@ import net.sf.briar.api.messaging.GroupId;
|
||||
import net.sf.briar.api.messaging.GroupStatus;
|
||||
import net.sf.briar.api.messaging.Message;
|
||||
import net.sf.briar.api.messaging.MessageId;
|
||||
import net.sf.briar.api.system.SystemClock;
|
||||
import net.sf.briar.api.transport.Endpoint;
|
||||
import net.sf.briar.api.transport.TemporarySecret;
|
||||
|
||||
|
||||
@@ -40,12 +40,12 @@ import net.sf.briar.api.messaging.PacketWriter;
|
||||
import net.sf.briar.api.messaging.PacketWriterFactory;
|
||||
import net.sf.briar.api.messaging.SubscriptionUpdate;
|
||||
import net.sf.briar.api.messaging.TransportUpdate;
|
||||
import net.sf.briar.clock.ClockModule;
|
||||
import net.sf.briar.crypto.CryptoModule;
|
||||
import net.sf.briar.db.DatabaseModule;
|
||||
import net.sf.briar.messaging.duplex.DuplexMessagingModule;
|
||||
import net.sf.briar.messaging.simplex.SimplexMessagingModule;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.system.ClockModule;
|
||||
import net.sf.briar.transport.TransportModule;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -26,11 +26,11 @@ import net.sf.briar.api.messaging.PacketWriterFactory;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
import net.sf.briar.api.transport.ConnectionRegistry;
|
||||
import net.sf.briar.api.transport.ConnectionWriterFactory;
|
||||
import net.sf.briar.clock.ClockModule;
|
||||
import net.sf.briar.crypto.CryptoModule;
|
||||
import net.sf.briar.messaging.MessagingModule;
|
||||
import net.sf.briar.messaging.duplex.DuplexMessagingModule;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.system.ClockModule;
|
||||
import net.sf.briar.transport.TransportModule;
|
||||
|
||||
import org.jmock.Expectations;
|
||||
|
||||
@@ -20,9 +20,9 @@ import net.sf.briar.api.LocalAuthor;
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.crypto.KeyManager;
|
||||
import net.sf.briar.api.db.DatabaseComponent;
|
||||
import net.sf.briar.api.db.event.DatabaseEvent;
|
||||
import net.sf.briar.api.db.event.DatabaseListener;
|
||||
import net.sf.briar.api.db.event.MessageAddedEvent;
|
||||
import net.sf.briar.api.event.Event;
|
||||
import net.sf.briar.api.event.EventListener;
|
||||
import net.sf.briar.api.event.MessageAddedEvent;
|
||||
import net.sf.briar.api.messaging.Group;
|
||||
import net.sf.briar.api.messaging.GroupId;
|
||||
import net.sf.briar.api.messaging.Message;
|
||||
@@ -36,13 +36,13 @@ import net.sf.briar.api.transport.ConnectionRecogniser;
|
||||
import net.sf.briar.api.transport.ConnectionRegistry;
|
||||
import net.sf.briar.api.transport.ConnectionWriterFactory;
|
||||
import net.sf.briar.api.transport.Endpoint;
|
||||
import net.sf.briar.clock.ClockModule;
|
||||
import net.sf.briar.crypto.CryptoModule;
|
||||
import net.sf.briar.db.DatabaseModule;
|
||||
import net.sf.briar.messaging.MessagingModule;
|
||||
import net.sf.briar.messaging.duplex.DuplexMessagingModule;
|
||||
import net.sf.briar.plugins.ImmediateExecutor;
|
||||
import net.sf.briar.serial.SerialModule;
|
||||
import net.sf.briar.system.ClockModule;
|
||||
import net.sf.briar.transport.TransportModule;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -234,11 +234,11 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
TestUtils.deleteTestDirectory(testDir);
|
||||
}
|
||||
|
||||
private static class MessageListener implements DatabaseListener {
|
||||
private static class MessageListener implements EventListener {
|
||||
|
||||
private boolean messageAdded = false;
|
||||
|
||||
public void eventOccurred(DatabaseEvent e) {
|
||||
public void eventOccurred(Event e) {
|
||||
if(e instanceof MessageAddedEvent) messageAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.concurrent.Executors;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.clock.SystemClock;
|
||||
import net.sf.briar.api.system.SystemClock;
|
||||
import net.sf.briar.plugins.DuplexClientTest;
|
||||
|
||||
// This is not a JUnit test - it has to be run manually while the server test
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.concurrent.Executors;
|
||||
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.clock.SystemClock;
|
||||
import net.sf.briar.api.system.SystemClock;
|
||||
import net.sf.briar.plugins.DuplexServerTest;
|
||||
|
||||
// This is not a JUnit test - it has to be run manually while the client test
|
||||
|
||||
@@ -15,9 +15,9 @@ import net.sf.briar.BriarTestCase;
|
||||
import net.sf.briar.TestFileUtils;
|
||||
import net.sf.briar.TestUtils;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.os.FileUtils;
|
||||
import net.sf.briar.api.plugins.simplex.SimplexPluginCallback;
|
||||
import net.sf.briar.api.plugins.simplex.SimplexTransportWriter;
|
||||
import net.sf.briar.api.system.FileUtils;
|
||||
import net.sf.briar.plugins.ImmediateExecutor;
|
||||
import net.sf.briar.plugins.file.RemovableDriveMonitor.Callback;
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import java.util.concurrent.Executors;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.clock.Clock;
|
||||
import net.sf.briar.api.clock.SystemClock;
|
||||
import net.sf.briar.api.system.Clock;
|
||||
import net.sf.briar.api.system.SystemClock;
|
||||
import net.sf.briar.plugins.DuplexClientTest;
|
||||
|
||||
// This is not a JUnit test - it has to be run manually while the server test
|
||||
|
||||
@@ -17,11 +17,11 @@ import net.sf.briar.BriarTestCase;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.clock.Clock;
|
||||
import net.sf.briar.api.clock.SystemClock;
|
||||
import net.sf.briar.api.plugins.duplex.DuplexPlugin;
|
||||
import net.sf.briar.api.plugins.duplex.DuplexPluginCallback;
|
||||
import net.sf.briar.api.plugins.duplex.DuplexTransportConnection;
|
||||
import net.sf.briar.api.system.Clock;
|
||||
import net.sf.briar.api.system.SystemClock;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import java.util.concurrent.Executors;
|
||||
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.clock.Clock;
|
||||
import net.sf.briar.api.clock.SystemClock;
|
||||
import net.sf.briar.api.system.Clock;
|
||||
import net.sf.briar.api.system.SystemClock;
|
||||
import net.sf.briar.plugins.DuplexServerTest;
|
||||
|
||||
// This is not a JUnit test - it has to be run manually while the client test
|
||||
|
||||
@@ -10,11 +10,11 @@ import net.sf.briar.BriarTestCase;
|
||||
import net.sf.briar.TestUtils;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.clock.Clock;
|
||||
import net.sf.briar.api.clock.Timer;
|
||||
import net.sf.briar.api.crypto.CryptoComponent;
|
||||
import net.sf.briar.api.db.DatabaseComponent;
|
||||
import net.sf.briar.api.db.event.DatabaseListener;
|
||||
import net.sf.briar.api.event.EventListener;
|
||||
import net.sf.briar.api.system.Clock;
|
||||
import net.sf.briar.api.system.Timer;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
import net.sf.briar.api.transport.ConnectionRecogniser;
|
||||
import net.sf.briar.api.transport.Endpoint;
|
||||
@@ -68,7 +68,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Collections.emptyList()));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -78,7 +78,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(timer).scheduleAtFixedRate(with(keyManager),
|
||||
with(any(long.class)), with(any(long.class)));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -110,7 +110,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Collections.emptyList()));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -135,7 +135,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(connectionRecogniser).addSecret(s1);
|
||||
oneOf(connectionRecogniser).addSecret(s2);
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -168,7 +168,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Collections.emptyList()));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -196,7 +196,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(db).incrementConnectionCounter(contactId, transportId, 1);
|
||||
will(returnValue(0L));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -237,7 +237,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -253,7 +253,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(timer).scheduleAtFixedRate(with(keyManager),
|
||||
with(any(long.class)), with(any(long.class)));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -287,7 +287,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -311,7 +311,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(timer).scheduleAtFixedRate(with(keyManager),
|
||||
with(any(long.class)), with(any(long.class)));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -346,7 +346,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -371,7 +371,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(timer).scheduleAtFixedRate(with(keyManager),
|
||||
with(any(long.class)), with(any(long.class)));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -403,7 +403,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -425,7 +425,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(db).incrementConnectionCounter(contactId, transportId, 1);
|
||||
will(returnValue(0L));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -468,7 +468,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -499,7 +499,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(db).incrementConnectionCounter(contactId, transportId, 2);
|
||||
will(returnValue(0L));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
@@ -543,7 +543,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -576,7 +576,7 @@ public class KeyManagerImplTest extends BriarTestCase {
|
||||
oneOf(db).incrementConnectionCounter(contactId, transportId, 3);
|
||||
will(returnValue(0L));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
oneOf(connectionRecogniser).removeSecrets();
|
||||
}});
|
||||
|
||||
@@ -11,12 +11,12 @@ import net.sf.briar.BriarTestCase;
|
||||
import net.sf.briar.TestUtils;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.clock.Clock;
|
||||
import net.sf.briar.api.clock.Timer;
|
||||
import net.sf.briar.api.crypto.CryptoComponent;
|
||||
import net.sf.briar.api.crypto.SecretKey;
|
||||
import net.sf.briar.api.db.DatabaseComponent;
|
||||
import net.sf.briar.api.db.event.DatabaseListener;
|
||||
import net.sf.briar.api.event.EventListener;
|
||||
import net.sf.briar.api.system.Clock;
|
||||
import net.sf.briar.api.system.Timer;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
import net.sf.briar.api.transport.ConnectionRecogniser;
|
||||
import net.sf.briar.api.transport.Endpoint;
|
||||
@@ -85,7 +85,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Collections.emptyList()));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -95,7 +95,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
oneOf(timer).scheduleAtFixedRate(with(keyManager),
|
||||
with(any(long.class)), with(any(long.class)));
|
||||
// stop()
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
}});
|
||||
|
||||
@@ -129,7 +129,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Collections.emptyList()));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -217,7 +217,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
}
|
||||
oneOf(k2).erase();
|
||||
// Remove the listener and stop the timer
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
}});
|
||||
|
||||
@@ -252,7 +252,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Collections.emptyList()));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -343,7 +343,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
}
|
||||
oneOf(k2).erase();
|
||||
// Remove the listener and stop the timer
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
}});
|
||||
|
||||
@@ -386,7 +386,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Collections.emptyList()));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -485,7 +485,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
}
|
||||
oneOf(k2).erase();
|
||||
// Remove the listener and stop the timer
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
}});
|
||||
|
||||
@@ -531,7 +531,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -611,7 +611,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
}
|
||||
oneOf(k2).erase();
|
||||
// Remove the listener and stop the timer
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
}});
|
||||
|
||||
@@ -647,7 +647,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -735,7 +735,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
}
|
||||
oneOf(k3).erase();
|
||||
// Remove the listener and stop the timer
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
}});
|
||||
|
||||
@@ -772,7 +772,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// start()
|
||||
oneOf(db).addListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).addListener(with(any(EventListener.class)));
|
||||
oneOf(db).getSecrets();
|
||||
will(returnValue(Arrays.asList(s0, s1, s2)));
|
||||
oneOf(db).getTransportLatencies();
|
||||
@@ -861,7 +861,7 @@ public class KeyRotationIntegrationTest extends BriarTestCase {
|
||||
}
|
||||
oneOf(k4).erase();
|
||||
// Remove the listener and stop the timer
|
||||
oneOf(db).removeListener(with(any(DatabaseListener.class)));
|
||||
oneOf(db).removeListener(with(any(EventListener.class)));
|
||||
oneOf(timer).cancel();
|
||||
}});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user