use of com.thoughtworks.go.matchers.UploadEntry in project gocd by gocd.
the class GoArtifactsManipulatorStub method publish.
@Override
public void publish(DefaultGoPublisher goPublisher, String destPath, File source, JobIdentifier jobIdentifier) {
super.publish(goPublisher, destPath, source, jobIdentifier);
uploads.add(new UploadEntry(source, destPath));
}
use of com.thoughtworks.go.matchers.UploadEntry in project gocd by gocd.
the class BuildWorkArtifactUploadingTest method shouldUploadFolderWhenTrimedPathDirectMatch.
@Test
public void shouldUploadFolderWhenTrimedPathDirectMatch() throws Exception {
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.add(new ArtifactPlan("logs/pic-1 ", "mypic"));
BuildAssignment buildAssigment = createAssignment(artifactPlans, new String[] { "logs/pic-1/fail.png", "logs/pic-1/pass.png", "logs/pic-2/cancel.png", "logs/pic-2/complete.png", "README" });
BuildWork work = new BuildWork(buildAssigment);
GoArtifactsManipulatorStub manipulator = new GoArtifactsManipulatorStub();
AgentIdentifier agentIdentifier = new AgentIdentifier("somename", "127.0.0.1", AGENT_UUID);
work.doWork(agentIdentifier, new FakeBuildRepositoryRemote(), manipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
List<UploadEntry> entries = manipulator.uploadEntries();
assertThat(entries, uploadFileToDestination(new File(buildWorkingDirectory.getPath() + "/logs/pic-1"), "mypic"));
}
use of com.thoughtworks.go.matchers.UploadEntry in project gocd by gocd.
the class BuildWorkArtifactUploadingTest method shouldFailBuildWhenNothingMatchedUsingMatcherStartDotStart.
@Test
public void shouldFailBuildWhenNothingMatchedUsingMatcherStartDotStart() throws Exception {
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.add(new ArtifactPlan("target/pkg/*.*", "MYDEST"));
BuildAssignment buildAssigment = createAssignment(artifactPlans, new String[] { "target/pkg/" });
BuildWork work = new BuildWork(buildAssigment);
GoArtifactsManipulatorStub manipulator = new GoArtifactsManipulatorStub();
BuildRepositoryRemoteStub repository = new BuildRepositoryRemoteStub();
AgentIdentifier agentIdentifier = new AgentIdentifier("somename", "127.0.0.1", AGENT_UUID);
work.doWork(agentIdentifier, repository, manipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
List<UploadEntry> entries = manipulator.uploadEntries();
assertThat(entries.size(), is(0));
assertThat(repository.states, containsResult(JobState.Building));
assertThat(repository.states, containsResult(JobState.Completing));
assertThat(repository.results, containsResult(JobResult.Failed));
assertThat(manipulator.consoleOut(), printedRuleDoesNotMatchFailure(buildWorkingDirectory.getPath(), "target/pkg/*.*"));
}
use of com.thoughtworks.go.matchers.UploadEntry in project gocd by gocd.
the class BuildWorkArtifactUploadingTest method shouldUploadEachMatchedFile.
@Test
public void shouldUploadEachMatchedFile() throws Exception {
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.add(new ArtifactPlan("**/*.png", "mypic"));
BuildAssignment buildAssigment = createAssignment(artifactPlans, new String[] { "logs/pic/fail.png", "logs/pic/pass.png", "README" });
BuildWork work = new BuildWork(buildAssigment);
GoArtifactsManipulatorStub manipulator = new GoArtifactsManipulatorStub();
AgentIdentifier agentIdentifier = new AgentIdentifier("somename", "127.0.0.1", AGENT_UUID);
work.doWork(agentIdentifier, new FakeBuildRepositoryRemote(), manipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
List<UploadEntry> entries = manipulator.uploadEntries();
assertThat(entries, uploadFileToDestination(new File(buildWorkingDirectory.getPath() + "/logs/pic/pass.png"), "mypic/logs/pic"));
assertThat(entries, uploadFileToDestination(new File(buildWorkingDirectory.getPath() + "/logs/pic/fail.png"), "mypic/logs/pic"));
}
use of com.thoughtworks.go.matchers.UploadEntry in project gocd by gocd.
the class BuildWorkArtifactUploadingTest method shouldUploadFolderWhenDirectMatch.
@Test
public void shouldUploadFolderWhenDirectMatch() throws Exception {
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.add(new ArtifactPlan("logs/pic-1", "mypic"));
BuildAssignment buildAssigment = createAssignment(artifactPlans, new String[] { "logs/pic-1/fail.png", "logs/pic-1/pass.png", "logs/pic-2/cancel.png", "logs/pic-2/complete.png", "README" });
BuildWork work = new BuildWork(buildAssigment);
GoArtifactsManipulatorStub manipulator = new GoArtifactsManipulatorStub();
AgentIdentifier agentIdentifier = new AgentIdentifier("somename", "127.0.0.1", AGENT_UUID);
work.doWork(agentIdentifier, new FakeBuildRepositoryRemote(), manipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
List<UploadEntry> entries = manipulator.uploadEntries();
assertThat(entries, uploadFileToDestination(new File(buildWorkingDirectory.getPath() + "/logs/pic-1"), "mypic"));
}
Aggregations