use of com.thoughtworks.go.config.RakeTask in project gocd by gocd.
the class RakeTaskBuilderTest method rakeTaskShouldNormalizeWorkingDirectory.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void rakeTaskShouldNormalizeWorkingDirectory() throws Exception {
RakeTask task = new RakeTask();
task.setWorkingDirectory("folder1\\folder2");
CommandBuilder commandBuilder = (CommandBuilder) rakeTaskBuilder.createBuilder(builderFactory, task, TasksTest.pipelineStub("label", "/var/cruise-agent/pipelines/cruise"), resolver);
assertThat(commandBuilder.getWorkingDir().getPath(), is("/var/cruise-agent/pipelines/cruise/folder1/folder2"));
}
use of com.thoughtworks.go.config.RakeTask in project gocd by gocd.
the class RakeTaskTest method shouldDefaultToUsingAKillAllChildrenCancelTask.
@Test
public void shouldDefaultToUsingAKillAllChildrenCancelTask() throws Exception {
RakeTask rakeTask = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).fromXmlPartial("<rake/>", RakeTask.class);
assertThat(rakeTask.cancelTask(), is(instanceOf(KillAllChildProcessTask.class)));
}
use of com.thoughtworks.go.config.RakeTask in project gocd by gocd.
the class RakeTaskTest method shouldNotKillAllChildrenWhenEmptyOnCancel.
@Test
public void shouldNotKillAllChildrenWhenEmptyOnCancel() throws Exception {
RakeTask rakeTask = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).fromXmlPartial("<rake>" + " <oncancel />" + "</rake>", RakeTask.class);
assertThat(rakeTask.cancelTask(), is(instanceOf(NullTask.class)));
}
use of com.thoughtworks.go.config.RakeTask in project gocd by gocd.
the class PipelineBean method getTasks.
public Tasks getTasks() {
Tasks tasks = new Tasks();
if ("ant".equals(builder)) {
AntTask antTask = new AntTask();
antTask.setTarget(this.target);
antTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "build.xml" : this.buildfile));
tasks.add(antTask);
} else if ("nant".equals(builder)) {
NantTask nantTask = new NantTask();
nantTask.setTarget(this.target);
nantTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "default.build" : this.buildfile));
tasks.add(nantTask);
} else if ("rake".equals(builder)) {
RakeTask rakeTask = new RakeTask();
rakeTask.setTarget(this.target);
rakeTask.setBuildFile(StringUtils.isBlank(this.buildfile) ? null : this.buildfile);
tasks.add(rakeTask);
} else if ("exec".equals(builder)) {
String trimmedCommand = StringUtils.defaultString(this.command).trim();
String trimmedArguments = StringUtils.defaultString(this.arguments).trim();
ExecTask execTask = new ExecTask(trimmedCommand, trimmedArguments, (String) null);
tasks.add(execTask);
}
return tasks;
}
Aggregations