Search in sources :

Example 1 with BuildServerListenerEventDispatcher

use of jetbrains.buildServer.serverSide.BuildServerListenerEventDispatcher in project teamcity-torrent-plugin by JetBrains.

the class ServerTorrentsSeederTestCase method setUp.

@BeforeMethod
@Override
protected void setUp() throws Exception {
    super.setUp();
    final Mockery m = new Mockery();
    final ServerPaths serverPaths = new ServerPaths(createTempDir().getAbsolutePath());
    final RootUrlHolder rootUrlHolder = m.mock(RootUrlHolder.class);
    final ExecutorServices executorServices = m.mock(ExecutorServices.class);
    myExecutorService = Executors.newScheduledThreadPool(1);
    m.checking(new Expectations() {

        {
            allowing(rootUrlHolder).getRootUrl();
            will(returnValue("http://localhost:8111/"));
            allowing(executorServices).getNormalExecutorService();
            will(returnValue(myExecutorService));
        }
    });
    final ServerSettings serverSettings = m.mock(ServerSettings.class);
    m.checking(new Expectations() {

        {
            allowing(serverSettings).getArtifactDirectories();
            will(returnValue(Collections.singletonList(serverPaths.getArtifactsDirectory())));
        }
    });
    myConfigurator = new TorrentConfigurator(serverPaths, rootUrlHolder, new XmlRpcHandlerManager() {

        public void addHandler(String handlerName, Object handler) {
        }

        public void addSessionHandler(String handlerName, Object handler) {
        }
    });
    myConfigurator.setDownloadEnabled(true);
    myConfigurator.setSeedingEnabled(true);
    myDispatcher = new BuildServerListenerEventDispatcher(new SecurityContextImpl());
    myTorrentsSeeder = new ServerTorrentsDirectorySeeder(serverPaths, serverSettings, myConfigurator, myDispatcher, executorServices);
}
Also used : Expectations(org.jmock.Expectations) RootUrlHolder(jetbrains.buildServer.RootUrlHolder) SecurityContextImpl(jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl) Mockery(org.jmock.Mockery) BuildServerListenerEventDispatcher(jetbrains.buildServer.serverSide.BuildServerListenerEventDispatcher) XmlRpcHandlerManager(jetbrains.buildServer.XmlRpcHandlerManager) ServerSettings(jetbrains.buildServer.serverSide.ServerSettings) ExecutorServices(jetbrains.buildServer.serverSide.executors.ExecutorServices) ServerPaths(jetbrains.buildServer.serverSide.ServerPaths) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

RootUrlHolder (jetbrains.buildServer.RootUrlHolder)1 XmlRpcHandlerManager (jetbrains.buildServer.XmlRpcHandlerManager)1 BuildServerListenerEventDispatcher (jetbrains.buildServer.serverSide.BuildServerListenerEventDispatcher)1 ServerPaths (jetbrains.buildServer.serverSide.ServerPaths)1 ServerSettings (jetbrains.buildServer.serverSide.ServerSettings)1 ExecutorServices (jetbrains.buildServer.serverSide.executors.ExecutorServices)1 SecurityContextImpl (jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl)1 Expectations (org.jmock.Expectations)1 Mockery (org.jmock.Mockery)1 BeforeMethod (org.testng.annotations.BeforeMethod)1