use of com.turn.ttorrent.tracker.AddressChecker in project teamcity-torrent-plugin by JetBrains.
the class TorrentTrackerConfiguratorTest method setUp.
@BeforeMethod
@Override
protected void setUp() throws Exception {
super.setUp();
Mockery m = new Mockery();
final AddressChecker addressChecker = m.mock(AddressChecker.class);
m.checking(new Expectations() {
{
allowing(addressChecker).isBadAddress(with(any(String.class)));
will(returnValue(false));
}
});
myTrackerManager = new TorrentTrackerManager(myConfigurator, new ExecutorServices() {
@NotNull
public ScheduledExecutorService getNormalExecutorService() {
return ExecutorsFactory.newFixedScheduledExecutor("aaa", 1);
}
@NotNull
public ExecutorService getLowPriorityExecutorService() {
return null;
}
}, myDispatcher, addressChecker);
myDispatcher.getMulticaster().serverStartup();
new WaitFor(5 * 1000) {
@Override
protected boolean condition() {
return !myTorrentsSeeder.getTorrentsSeeder().isStopped();
}
};
assertFalse(myTorrentsSeeder.getTorrentsSeeder().isStopped());
}
use of com.turn.ttorrent.tracker.AddressChecker in project teamcity-torrent-plugin by JetBrains.
the class TrackerControllerTest method createController.
@Override
@SuppressWarnings("unchecked")
protected TrackerController createController() throws IOException {
Mockery m = new Mockery();
final XmlRpcHandlerManager rpcHandlerManager = m.mock(XmlRpcHandlerManager.class);
final AddressChecker addressChecker = m.mock(AddressChecker.class);
AuthorizationInterceptor interceptor = m.mock(AuthorizationInterceptor.class);
m.checking(new Expectations() {
{
allowing(rpcHandlerManager).addHandler(with(any(String.class)), with(any(Object.class)));
allowing(interceptor).addPathNotRequiringAuth(with(any(String.class)));
allowing(addressChecker).isBadAddress(with(any(String.class)));
will(returnValue(false));
}
});
final TorrentConfigurator configurator = new TorrentConfigurator(new ServerPaths(createTempDir().getAbsolutePath()), myFixture.getSingletonService(RootUrlHolder.class), rpcHandlerManager);
myTorrentTrackerManager = new TorrentTrackerManager(configurator, myFixture.getSingletonService(ExecutorServices.class), myFixture.getSingletonService(EventDispatcher.class), addressChecker);
myTorrentTrackerManager.startTracker();
return new TrackerController(myWebManager, myTorrentTrackerManager, interceptor);
}
Aggregations