Search in sources :

Example 1 with TorrentTrackerManager

use of jetbrains.buildServer.torrent.TorrentTrackerManager 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);
}
Also used : XmlRpcHandlerManager(jetbrains.buildServer.XmlRpcHandlerManager) Expectations(org.jmock.Expectations) AddressChecker(com.turn.ttorrent.tracker.AddressChecker) RootUrlHolder(jetbrains.buildServer.RootUrlHolder) AuthorizationInterceptor(jetbrains.buildServer.controllers.AuthorizationInterceptor) TorrentConfigurator(jetbrains.buildServer.torrent.TorrentConfigurator) Mockery(org.jmock.Mockery) ServerPaths(jetbrains.buildServer.serverSide.ServerPaths) TorrentTrackerManager(jetbrains.buildServer.torrent.TorrentTrackerManager)

Aggregations

AddressChecker (com.turn.ttorrent.tracker.AddressChecker)1 RootUrlHolder (jetbrains.buildServer.RootUrlHolder)1 XmlRpcHandlerManager (jetbrains.buildServer.XmlRpcHandlerManager)1 AuthorizationInterceptor (jetbrains.buildServer.controllers.AuthorizationInterceptor)1 ServerPaths (jetbrains.buildServer.serverSide.ServerPaths)1 TorrentConfigurator (jetbrains.buildServer.torrent.TorrentConfigurator)1 TorrentTrackerManager (jetbrains.buildServer.torrent.TorrentTrackerManager)1 Expectations (org.jmock.Expectations)1 Mockery (org.jmock.Mockery)1