mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Q: What does the plugin manager do? A: It manages plugins.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
<test name='net.sf.briar.i18n.FontManagerTest'/>
|
||||
<test name='net.sf.briar.i18n.I18nTest'/>
|
||||
<test name='net.sf.briar.invitation.InvitationWorkerTest'/>
|
||||
<test name='net.sf.briar.plugins.PluginManagerImplTest'/>
|
||||
<test name='net.sf.briar.plugins.file.LinuxRemovableDriveFinderTest'/>
|
||||
<test name='net.sf.briar.plugins.file.MacRemovableDriveFinderTest'/>
|
||||
<test name='net.sf.briar.plugins.file.PollingRemovableDriveMonitorTest'/>
|
||||
|
||||
44
test/net/sf/briar/plugins/PluginManagerImplTest.java
Normal file
44
test/net/sf/briar/plugins/PluginManagerImplTest.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package net.sf.briar.plugins;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.db.DatabaseComponent;
|
||||
import net.sf.briar.api.transport.ConnectionDispatcher;
|
||||
import net.sf.briar.api.ui.UiCallback;
|
||||
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.Mockery;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PluginManagerImplTest extends TestCase {
|
||||
|
||||
@Test
|
||||
public void testStartAndStop() throws Exception {
|
||||
Mockery context = new Mockery();
|
||||
final DatabaseComponent db = context.mock(DatabaseComponent.class);
|
||||
final Map<?, ?> localTransports = context.mock(Map.class);
|
||||
final ConnectionDispatcher dispatcher =
|
||||
context.mock(ConnectionDispatcher.class);
|
||||
final UiCallback uiCallback = context.mock(UiCallback.class);
|
||||
context.checking(new Expectations() {{
|
||||
allowing(db).getLocalTransports();
|
||||
will(returnValue(localTransports));
|
||||
allowing(localTransports).get(with(any(TransportId.class)));
|
||||
will(returnValue(new TransportProperties()));
|
||||
allowing(db).getRemoteProperties(with(any(TransportId.class)));
|
||||
will(returnValue(new TransportProperties()));
|
||||
}});
|
||||
Executor executor = new ImmediateExecutor();
|
||||
Poller poller = new PollerImpl();
|
||||
PluginManagerImpl p =
|
||||
new PluginManagerImpl(executor, db, poller, dispatcher, uiCallback);
|
||||
// The Bluetooth plugin will not start without a Bluetooth device, so
|
||||
// we expect two plugins to be started
|
||||
assertEquals(2, p.startPlugins());
|
||||
assertEquals(2, p.stopPlugins());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user