use of jetbrains.buildServer.agent.BuildProgressLogger in project teamcity-powershell by JetBrains.
the class PowerShellServiceWindows method getFileCommandLine.
@Override
protected SimpleProgramCommandLine getFileCommandLine(@NotNull final PowerShellInfo info, @NotNull final Map<String, String> env, @NotNull final String workDir, @NotNull final List<String> args) throws RunBuildException {
final BuildProgressLogger buildLogger = getBuild().getBuildLogger();
final String command = myCommands.getNativeCommand(info);
buildLogger.message("Command: " + command);
buildLogger.message("PowerShell arguments: " + StringUtil.join(args, ", "));
return new SimpleProgramCommandLine(env, workDir, command, args);
}
use of jetbrains.buildServer.agent.BuildProgressLogger in project teamcity-torrent-plugin by JetBrains.
the class TorrentTransportTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
myServer = new Server(12345);
WebAppContext handler = new WebAppContext();
handler.setResourceBase("/");
handler.setContextPath(CONTEXT_PATH);
myDownloadMap = new HashMap<String, File>();
myDownloadAttempts = new ArrayList<String>();
myDownloadHonestly = true;
myConfiguration = new FakeTorrentConfiguration();
myDownloadHacks = new HashMap<String, byte[]>();
myDownloadHackAttempts = new ArrayList<String>();
handler.addServlet(new ServletHolder(new HttpServlet() {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
myDownloadAttempts.add(req.getPathInfo());
final ServletOutputStream os = resp.getOutputStream();
final File file = myDownloadMap.get(req.getPathInfo());
if (file == null) {
resp.getOutputStream().close();
} else {
final byte[] bytes = FileUtils.readFileToByteArray(file);
os.write(bytes);
os.close();
}
}
}), "/*");
myServer.setHandler(handler);
myServer.start();
myAgentParametersMap = new HashMap<String, String>();
Mockery m = new Mockery();
myBuild = m.mock(AgentRunningBuild.class);
myLeechSettings = m.mock(LeechSettings.class);
final BuildProgressLogger myLogger = new FakeBuildProgressLogger();
final TorrentFilesFactory torrentFilesFactory = m.mock(TorrentFilesFactory.class);
m.checking(new Expectations() {
{
allowing(myBuild).getSharedConfigParameters();
will(returnValue(myAgentParametersMap));
allowing(myBuild).getBuildTypeId();
will(returnValue("TC_Gaya80x_BuildDist"));
allowing(myBuild).getBuildLogger();
will(returnValue(myLogger));
allowing(myLeechSettings).isDownloadEnabled();
will(returnValue(true));
allowing(myLeechSettings).getMaxPieceDownloadTime();
will(returnValue(15));
allowing(myLeechSettings).getMinSeedersForDownload();
will(returnValue(1));
allowing(torrentFilesFactory).getTorrentFile();
will(returnValue(createTempFile()));
}
});
BuildAgentConfiguration agentConfiguration = myAgentConfigurationFixture.setUp();
mySeeder = new AgentTorrentsSeeder(agentConfiguration, myConfiguration);
myTorrentTransport = new TorrentTransportFactory.TorrentTransport(mySeeder.getTorrentsSeeder(), new HttpClient(), myBuild.getBuildLogger(), "http://localhost:12345", new TorrentsDownloadStatistic(), myLeechSettings, torrentFilesFactory) {
@Override
protected byte[] download(@NotNull String urlString) throws IOException {
if (myDownloadHonestly) {
return super.download(urlString);
} else {
myDownloadHackAttempts.add(urlString);
return myDownloadHacks.get(urlString);
}
}
};
myTempDir = createTempDir();
}
Aggregations