Search in sources :

Example 1 with DirHandler

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;
}
Also used : DirHandler(com.thoughtworks.go.domain.DirHandler) URLService(com.thoughtworks.go.util.URLService) ChecksumFileHandler(com.thoughtworks.go.domain.ChecksumFileHandler) File(java.io.File)

Example 2 with DirHandler

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))));
}
Also used : DirHandler(com.thoughtworks.go.domain.DirHandler) AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) File(java.io.File) Test(org.junit.Test)

Aggregations

DirHandler (com.thoughtworks.go.domain.DirHandler)2 File (java.io.File)2 ChecksumFileHandler (com.thoughtworks.go.domain.ChecksumFileHandler)1 AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)1 URLService (com.thoughtworks.go.util.URLService)1 Test (org.junit.Test)1