use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanRepositoryIntegrationTest method shouldLoadSavedArtifactPlanWithTypeUnit.
@Test
public void shouldLoadSavedArtifactPlanWithTypeUnit() {
// Arrange
JobInstance jobInstance = jobInstanceDao.save(stageId, new JobInstance(JOB_NAME));
ArtifactPlan savedArtifactPlan = new TestArtifactPlan("src", "dest");
savedArtifactPlan.setBuildId(jobInstance.getId());
artifactPlanRepository.save(savedArtifactPlan);
// Act
List<ArtifactPlan> artifactPlanList = artifactPlanRepository.findByBuildId(jobInstance.getId());
// Assert
assertThat(artifactPlanList.size(), is(1));
assertThat(artifactPlanList.get(0), is(savedArtifactPlan));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanRepositoryIntegrationTest method shouldLoadSavedArtifactPlan.
@Test
public void shouldLoadSavedArtifactPlan() {
// Arrange
JobInstance jobInstance = jobInstanceDao.save(stageId, new JobInstance(JOB_NAME));
ArtifactPlan savedArtifactPlan = new ArtifactPlan("src", "dest");
savedArtifactPlan.setBuildId(jobInstance.getId());
artifactPlanRepository.save(savedArtifactPlan);
// Act
List<ArtifactPlan> artifactPlanList = artifactPlanRepository.findByBuildId(jobInstance.getId());
// Assert
assertThat(artifactPlanList.size(), is(1));
assertThat(artifactPlanList.get(0), is(savedArtifactPlan));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class ArtifactPlanRepositoryIntegrationTest method shouldLoadSavedTestArtifactPlan.
@Test
public void shouldLoadSavedTestArtifactPlan() {
// Arrange
JobInstance jobInstance = jobInstanceDao.save(stageId, new JobInstance(JOB_NAME));
ArtifactPlan savedArtifactPlan = new TestArtifactPlan();
savedArtifactPlan.setBuildId(jobInstance.getId());
artifactPlanRepository.save(savedArtifactPlan);
// Act
List<ArtifactPlan> artifactPlanList = artifactPlanRepository.findByBuildId(jobInstance.getId());
// Assert
assertThat(artifactPlanList.size(), is(1));
ArtifactPlan loadedArtifactPlan = artifactPlanList.get(0);
assertThat(loadedArtifactPlan, is(savedArtifactPlan));
}
use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.
the class TestArtifactPlanTest method shouldSupportGlobPatternsInSourcePath.
@Test
public void shouldSupportGlobPatternsInSourcePath() {
ArtifactPlan artifactPlan = new ArtifactPlan("**/*/a.log", "logs");
TestArtifactPlan testArtifactPlan = new TestArtifactPlan(artifactPlan);
File first = new File("target/test/report/a.log");
File second = new File("target/test/test/a/b/a.log");
first.mkdirs();
second.mkdirs();
testArtifactPlan.publish(mockArtifactPublisher, rootPath);
verify(mockArtifactPublisher).upload(first, "logs/report");
verify(mockArtifactPublisher).upload(second, "logs/test/a/b");
verify(mockArtifactPublisher, new Times(2)).upload(any(File.class), eq("testoutput"));
}
Aggregations