Search in sources :

Example 1 with HttpService

use of com.thoughtworks.go.util.HttpService in project gocd by gocd.

the class DownloadActionTest method shouldReturnWithoutRetryingArtifactIsNotModified.

@Test
public void shouldReturnWithoutRetryingArtifactIsNotModified() throws Exception {
    fetchHandler = new FileHandler(new File(""), getSrc());
    HttpService httpService = mock(HttpService.class);
    StubGoPublisher goPublisher = new StubGoPublisher();
    when(httpService.download("foo", fetchHandler)).thenReturn(SC_NOT_MODIFIED);
    new DownloadAction(httpService, goPublisher, clock).perform("foo", fetchHandler);
    verify(httpService).download("foo", this.fetchHandler);
    verifyNoMoreInteractions(httpService);
    assertThat(goPublisher.getMessage(), containsString("Artifact is not modified, skipped fetching it"));
}
Also used : HttpService(com.thoughtworks.go.util.HttpService) File(java.io.File) Test(org.junit.Test)

Example 2 with HttpService

use of com.thoughtworks.go.util.HttpService in project gocd by gocd.

the class GoArtifactsManipulatorTest method setUp.

@Before
public void setUp() throws Exception {
    httpService = mock(HttpService.class);
    artifactFolder = temporaryFolder.newFolder("artifact_folder");
    tempFile = temporaryFolder.newFile("artifact_folder/file.txt");
    goArtifactsManipulatorStub = new GoArtifactsManipulatorStub(httpService);
    jobIdentifier = new JobIdentifier("pipeline1", 1, "label-1", "stage1", "1", "job1");
    AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(new AgentIdentifier("h", "1", "u"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), null, false);
    goPublisher = new DefaultGoPublisher(goArtifactsManipulatorStub, jobIdentifier, new BuildRepositoryRemoteStub(), agentRuntimeInfo, "utf-8");
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) DefaultGoPublisher(com.thoughtworks.go.work.DefaultGoPublisher) HttpService(com.thoughtworks.go.util.HttpService) AgentIdentifier(com.thoughtworks.go.remote.AgentIdentifier) GoArtifactsManipulatorStub(com.thoughtworks.go.remote.work.GoArtifactsManipulatorStub) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) BuildRepositoryRemoteStub(com.thoughtworks.go.remote.work.BuildRepositoryRemoteStub) Before(org.junit.Before)

Aggregations

HttpService (com.thoughtworks.go.util.HttpService)2 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)1 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)1 BuildRepositoryRemoteStub (com.thoughtworks.go.remote.work.BuildRepositoryRemoteStub)1 GoArtifactsManipulatorStub (com.thoughtworks.go.remote.work.GoArtifactsManipulatorStub)1 AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)1 DefaultGoPublisher (com.thoughtworks.go.work.DefaultGoPublisher)1 File (java.io.File)1 Before (org.junit.Before)1 Test (org.junit.Test)1