Search in sources :

Example 6 with ArtifactPlan

use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.

the class AssertHelper method assertArtifactPlans.

private static void assertArtifactPlans(ArtifactPlans actual, ArtifactPlans expect) {
    String msg = "ArtifactPlans should match";
    nullsafeAssert(msg, actual, expect);
    assertThat(actual.size(), is(expect.size()));
    for (int i = 0; i < expect.size(); i++) {
        ArtifactPlan expectPlan = expect.get(i);
        ArtifactPlan actualPlan = actual.get(i);
        assertThat(msg, actualPlan.getArtifactType(), is(expectPlan.getArtifactType()));
        assertThat(msg, actualPlan.getSrc(), is(expectPlan.getSrc()));
        assertThat(msg, actualPlan.getDest(), is(expectPlan.getDest()));
    }
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan)

Example 7 with ArtifactPlan

use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.

the class ArtifactPlanTest method validate_shouldNotFailWhenDestinationIsNotSet.

@Test
public void validate_shouldNotFailWhenDestinationIsNotSet() {
    ArtifactPlan artifactPlan = new ArtifactPlan(null, null);
    artifactPlan.setSrc("source");
    artifactPlan.validate(null);
    assertThat(artifactPlan.errors().isEmpty(), is(true));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) Test(org.junit.Test)

Example 8 with ArtifactPlan

use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.

the class ArtifactPlanTest method shouldBeAbleToCreateACopyOfItself.

@Test
public void shouldBeAbleToCreateACopyOfItself() throws Exception {
    ArtifactPlan existingPlan = new ArtifactPlan("src1", "dest1");
    existingPlan.setId(2);
    existingPlan.setBuildId(10);
    existingPlan.addError("abc", "def");
    assertThat(existingPlan, equalTo(new ArtifactPlan(existingPlan)));
    assertThat(existingPlan, equalTo(new Cloner().deepClone(existingPlan)));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) Cloner(com.rits.cloning.Cloner) Test(org.junit.Test)

Example 9 with ArtifactPlan

use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.

the class ArtifactPlanTest method shouldProvideAppendFilePathToDest.

@Test
public void shouldProvideAppendFilePathToDest() {
    ArtifactPlan artifactPlan = new ArtifactPlan("test/**/*/a.log", "logs");
    assertThat(artifactPlan.destURL(new File("pipelines/pipelineA"), new File("pipelines/pipelineA/test/a/b/a.log")), is("logs/a/b"));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) File(java.io.File) Test(org.junit.Test)

Example 10 with ArtifactPlan

use of com.thoughtworks.go.config.ArtifactPlan in project gocd by gocd.

the class ArtifactPlanTest method shouldProvideAppendFilePathToDestWhenPathProvidedAreSame.

@Test
public void shouldProvideAppendFilePathToDestWhenPathProvidedAreSame() {
    ArtifactPlan artifactPlan = new ArtifactPlan("test/a/b/a.log", "logs");
    assertThat(artifactPlan.destURL(new File("pipelines/pipelineA"), new File("pipelines/pipelineA/test/b/a.log")), is("logs"));
}
Also used : ArtifactPlan(com.thoughtworks.go.config.ArtifactPlan) 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