use of com.thoughtworks.go.config.ArtifactPropertiesGenerator in project gocd by gocd.
the class BuildComposer method harvestProperties.
private BuildCommand harvestProperties() {
List<ArtifactPropertiesGenerator> generators = assignment.getPlan().getPropertyGenerators();
List<BuildCommand> commands = new ArrayList<>();
for (ArtifactPropertiesGenerator generator : generators) {
BuildCommand command = BuildCommand.generateProperty(generator.getName(), generator.getSrc(), generator.getXpath()).setWorkingDirectory(workingDirectory());
commands.add(command);
}
return BuildCommand.compose(reportAction("Start to create properties"), BuildCommand.compose(commands));
}
use of com.thoughtworks.go.config.ArtifactPropertiesGenerator in project gocd by gocd.
the class ArtifactPropertiesGeneratorTest method shouldReportPropertyIsCreated.
@Test
public void shouldReportPropertyIsCreated() throws Exception {
String validXpath = "//buildplan/@name";
generator = new ArtifactPropertiesGenerator(TEST_PROPERTY, createSrcFile().getName(), validXpath);
generator.generate(goPublisherImple, workspace);
assertThat(sentContents.get(0), containsString("Property " + TEST_PROPERTY + " = test created"));
}
use of com.thoughtworks.go.config.ArtifactPropertiesGenerator in project gocd by gocd.
the class ArtifactPropertiesGeneratorTest method shouldBeAbleToCreateACopyOfItself.
@Test
public void shouldBeAbleToCreateACopyOfItself() throws Exception {
ArtifactPropertiesGenerator existingGenerator = new ArtifactPropertiesGenerator("prop1", "props.xml", "//some_xpath");
existingGenerator.setId(2);
existingGenerator.setJobId(10);
existingGenerator.addError("abc", "def");
assertThat(existingGenerator, equalTo(new ArtifactPropertiesGenerator(existingGenerator)));
assertThat(existingGenerator, equalTo(new Cloner().deepClone(existingGenerator)));
}
use of com.thoughtworks.go.config.ArtifactPropertiesGenerator in project gocd by gocd.
the class ArtifactPropertiesGeneratorTest method shouldReportFirstMatchedProperty.
@Test
public void shouldReportFirstMatchedProperty() throws Exception {
String multipleMatchXPATH = "//artifact/@src";
generator = new ArtifactPropertiesGenerator(TEST_PROPERTY, createSrcFile().getName(), multipleMatchXPATH);
generator.generate(goPublisherImple, workspace);
assertThat(sentContents.get(0), containsString("Property " + TEST_PROPERTY + " = target\\connectfour.jar created"));
}
use of com.thoughtworks.go.config.ArtifactPropertiesGenerator in project gocd by gocd.
the class ArtifactPropertiesGeneratorTest method shouldValidateThatNameIsMandatory.
@Test
public void shouldValidateThatNameIsMandatory() {
ArtifactPropertiesGenerator generator = new ArtifactPropertiesGenerator(null, "props.xml", "//some_xpath");
generator.validateTree(null);
assertThat(generator.errors().on(ArtifactPropertiesGenerator.NAME), containsString("Invalid property name 'null'."));
}
Aggregations