Search in sources :

Example 26 with ArtifactPlan

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));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) Test(org.junit.Test)

Example 27 with ArtifactPlan

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));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) Test(org.junit.Test)

Example 28 with ArtifactPlan

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));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) Test(org.junit.Test)

Example 29 with ArtifactPlan

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"));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) Times(org.mockito.internal.verification.Times) TestArtifactPlan(com.thoughtworks.go.config.TestArtifactPlan) File(java.io.File) Test(org.junit.Test)

Aggregations

ArtifactPlan (com.thoughtworks.go.config.ArtifactPlan)29 Test (org.junit.Test)25 TestArtifactPlan (com.thoughtworks.go.config.TestArtifactPlan)15 ArtifactPlans (com.thoughtworks.go.config.ArtifactPlans)8 File (java.io.File)7 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)2 Cloner (com.rits.cloning.Cloner)1 EnvironmentVariableConfig (com.thoughtworks.go.config.EnvironmentVariableConfig)1 JobConfig (com.thoughtworks.go.config.JobConfig)1 Resource (com.thoughtworks.go.config.Resource)1 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)1 JobPlan (com.thoughtworks.go.domain.JobPlan)1 Property (com.thoughtworks.go.domain.Property)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 DefaultGoPublisher (com.thoughtworks.go.work.DefaultGoPublisher)1 Document (org.dom4j.Document)1 Element (org.dom4j.Element)1 DOMDocument (org.dom4j.dom.DOMDocument)1 DOMElement (org.dom4j.dom.DOMElement)1