Search in sources :

Example 1 with ArtifactTypeConfigs

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

the class JobRepresenter method setArtifacts.

private static void setArtifacts(JobConfig jobConfig) {
    ArtifactTypeConfigs artifactTypeConfigs = new ArtifactTypeConfigs();
    jsonReader.readArrayIfPresent("artifacts", artifacts -> {
        artifacts.forEach(artifact -> {
            artifactTypeConfigs.add(ArtifactRepresenter.fromJSON(new JsonReader(artifact.getAsJsonObject())));
        });
    });
    jobConfig.setArtifactTypeConfigs(artifactTypeConfigs);
}
Also used : JsonReader(com.thoughtworks.go.api.representers.JsonReader) ArtifactTypeConfigs(com.thoughtworks.go.config.ArtifactTypeConfigs)

Example 2 with ArtifactTypeConfigs

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

the class ArtifactPlanTest method toArtifactPlans_shouldConvertArtifactConfigsToArtifactPlanList.

@Test
public void toArtifactPlans_shouldConvertArtifactConfigsToArtifactPlanList() {
    final PluggableArtifactConfig artifactConfig = new PluggableArtifactConfig("id", "storeId", create("Foo", true, "Bar"));
    final ArtifactTypeConfigs artifactTypeConfigs = new ArtifactTypeConfigs(Arrays.asList(new BuildArtifactConfig("source", "destination"), new TestArtifactConfig("test-source", "test-destination"), artifactConfig));
    final List<ArtifactPlan> artifactPlans = ArtifactPlan.toArtifactPlans(artifactTypeConfigs);
    assertThat(artifactPlans, containsInAnyOrder(new ArtifactPlan(ArtifactPlanType.file, "source", "destination"), new ArtifactPlan(ArtifactPlanType.unit, "test-source", "test-destination"), new ArtifactPlan(artifactConfig.toJSON())));
}
Also used : PluggableArtifactConfig(com.thoughtworks.go.config.PluggableArtifactConfig) TestArtifactConfig(com.thoughtworks.go.config.TestArtifactConfig) BuildArtifactConfig(com.thoughtworks.go.config.BuildArtifactConfig) ArtifactTypeConfigs(com.thoughtworks.go.config.ArtifactTypeConfigs) Test(org.junit.jupiter.api.Test)

Example 3 with ArtifactTypeConfigs

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

the class JobRepresenter method setArtifacts.

private static void setArtifacts(JobConfig jobConfig) {
    ArtifactTypeConfigs artifactTypeConfigs = new ArtifactTypeConfigs();
    jsonReader.readArrayIfPresent("artifacts", artifacts -> {
        artifacts.forEach(artifact -> {
            artifactTypeConfigs.add(ArtifactRepresenter.fromJSON(new JsonReader(artifact.getAsJsonObject())));
        });
    });
    jobConfig.setArtifactTypeConfigs(artifactTypeConfigs);
}
Also used : JsonReader(com.thoughtworks.go.api.representers.JsonReader) ArtifactTypeConfigs(com.thoughtworks.go.config.ArtifactTypeConfigs)

Example 4 with ArtifactTypeConfigs

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

the class JobRepresenter method setArtifacts.

private static void setArtifacts(JobConfig jobConfig) {
    ArtifactTypeConfigs artifactTypeConfigs = new ArtifactTypeConfigs();
    jsonReader.readArrayIfPresent("artifacts", artifacts -> {
        artifacts.forEach(artifact -> {
            artifactTypeConfigs.add(ArtifactRepresenter.fromJSON(new JsonReader(artifact.getAsJsonObject())));
        });
    });
    jobConfig.setArtifactTypeConfigs(artifactTypeConfigs);
}
Also used : JsonReader(com.thoughtworks.go.api.representers.JsonReader) ArtifactTypeConfigs(com.thoughtworks.go.config.ArtifactTypeConfigs)

Aggregations

ArtifactTypeConfigs (com.thoughtworks.go.config.ArtifactTypeConfigs)4 JsonReader (com.thoughtworks.go.api.representers.JsonReader)3 BuildArtifactConfig (com.thoughtworks.go.config.BuildArtifactConfig)1 PluggableArtifactConfig (com.thoughtworks.go.config.PluggableArtifactConfig)1 TestArtifactConfig (com.thoughtworks.go.config.TestArtifactConfig)1 Test (org.junit.jupiter.api.Test)1