use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class AntTaskBuilderTest method antTaskShouldNormalizeWorkingDirectory.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void antTaskShouldNormalizeWorkingDirectory() {
AntTask task = new AntTask();
task.setWorkingDirectory("folder1\\folder2");
CommandBuilder commandBuilder = (CommandBuilder) antTaskBuilder.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.domain.builder.CommandBuilder in project gocd by gocd.
the class ExecTaskBuilderTest method shouldUseProjectDefaultWorkingDirectoryIfNotSpecified.
@Test
public void shouldUseProjectDefaultWorkingDirectoryIfNotSpecified() throws Exception {
ExecTask task = new ExecTask("command", "", (String) null);
final File defaultWorkingDir = new File("foo");
CommandBuilder builder = (CommandBuilder) execTaskBuilder.createBuilder(builderFactory, task, TasksTest.pipelineStub("label", "foo"), resolver);
assertThat(builder.getWorkingDir(), isSamePath(defaultWorkingDir));
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class NantTaskBuilderTest method shouldSetNAntWorkingDirectoryAbsolutelyIfSpecified.
@Test
public void shouldSetNAntWorkingDirectoryAbsolutelyIfSpecified() throws Exception {
final File absoluteFile = new File("project").getAbsoluteFile();
NantTask task = new NantTask();
task.setWorkingDirectory(absoluteFile.getPath());
CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, task, pipeline, resolver);
assertThat(builder.getWorkingDir(), is(absoluteFile));
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class NantTaskBuilderTest method shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnWindows.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { EnhancedOSChecker.WINDOWS })
public void shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnWindows() throws Exception {
NantTask nantTask = new NantTask();
nantTask.setNantPath("c:\\nantdir");
CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
assertThat(new File(builder.getCommand()), is(new File("c:\\nantdir\\nant")));
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class NantTaskBuilderTest method shouldJoinNantPathWithWorkingDirectoryIfRelativeNantPathIsSpecified.
@Test
public void shouldJoinNantPathWithWorkingDirectoryIfRelativeNantPathIsSpecified() throws Exception {
NantTask nantTask = new NantTask();
nantTask.setNantPath("lib");
CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
assertThat(new File(builder.getCommand()), is(new File("lib/nant")));
}
Aggregations