use of com.thoughtworks.go.domain.DirHandler in project gocd by gocd.
the class DownloadDirCommandExecutor method execute.
@Override
public boolean execute(BuildCommand command, BuildSession buildSession) {
URLService urlService = new URLService();
String url = urlService.prefixPartialUrl(command.getStringArg("url"));
String dest = command.getStringArg("dest");
String src = command.getStringArg("src");
String checksumUrl = null;
ChecksumFileHandler checksumFileHandler = null;
if (command.hasArg("checksumUrl")) {
checksumUrl = new URLService().prefixPartialUrl(command.getStringArg("checksumUrl"));
File checksumFile;
if (command.hasArg("checksumFile")) {
checksumFile = buildSession.resolveRelativeDir(command.getWorkingDirectory(), command.getStringArg("checksumFile"));
} else {
checksumFile = TempFiles.createUniqueFile("checksum");
}
checksumFileHandler = new ChecksumFileHandler(checksumFile);
}
DirHandler handler = new DirHandler(src, buildSession.resolveRelativeDir(command.getWorkingDirectory(), dest));
buildSession.download(handler, url, checksumFileHandler, checksumUrl);
return true;
}
use of com.thoughtworks.go.domain.DirHandler in project gocd by gocd.
the class BuildWorkArtifactFetchingTest method shouldFetchFolder.
@Test
public void shouldFetchFolder() throws Exception {
buildWork = (BuildWork) BuildWorkTest.getWork(WITH_FETCH_FOLDER, PIPELINE_NAME);
GoArtifactsManipulatorStub stubManipulator = new GoArtifactsManipulatorStub();
buildWork.doWork(agentIdentifier, buildRepository, stubManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), null, null, null);
assertThat(stubManipulator.artifact().get(0), is(new DirHandler("lib", new File("pipelines" + File.separator + PIPELINE_NAME + File.separator + DEST))));
}
Aggregations