Search in sources :

Example 6 with CommandBuilder

use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.

the class NantTaskBuilderTest method shouldUseDefaultWorkingDirectoryByDefault.

@Test
public void shouldUseDefaultWorkingDirectoryByDefault() throws Exception {
    NantTask nantTask = new NantTask();
    CommandBuilder commandBuilder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, TasksTest.pipelineStub("label", "/cruise"), resolver);
    assertThat(commandBuilder.getWorkingDir(), is(new File("/cruise")));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Example 7 with CommandBuilder

use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.

the class NantTaskBuilderTest method shouldDealWithSpacesInNantPath.

@Test
public void shouldDealWithSpacesInNantPath() throws Exception {
    NantTask nantTask = new NantTask();
    nantTask.setNantPath("lib/nant 1.0");
    nantTask.setBuildFile("ccnet default.build");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
    assertThat(new File(builder.getCommand()), is(new File("lib/nant 1.0/nant")));
    assertThat(builder.getArgs(), is("-buildfile:\"ccnet default.build\""));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Example 8 with CommandBuilder

use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.

the class NantTaskBuilderTest method nantTaskShouldNormalizeWorkingDirectory.

@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void nantTaskShouldNormalizeWorkingDirectory() throws Exception {
    NantTask nantTask = new NantTask();
    nantTask.setWorkingDirectory("folder1\\folder2");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, TasksTest.pipelineStub("label", "/var/cruise-agent/pipelines/cruise"), resolver);
    assertThat(builder.getWorkingDir(), Is.is(new File("/var/cruise-agent/pipelines/cruise/folder1/folder2")));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) RunIf(com.googlecode.junit.ext.RunIf) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Example 9 with CommandBuilder

use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.

the class NantTaskBuilderTest method shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnLinux.

@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnLinux() throws Exception {
    NantTask nantTask = new NantTask();
    nantTask.setNantPath("/usr/bin");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
    assertThat(new File(builder.getCommand()), is(new File("/usr/bin/nant")));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) RunIf(com.googlecode.junit.ext.RunIf) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Example 10 with CommandBuilder

use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.

the class NantTaskBuilderTest method nantTaskShouldNormalizeBuildFile.

@Test
public void nantTaskShouldNormalizeBuildFile() throws Exception {
    NantTask task = new NantTask();
    task.setBuildFile("pavan\\build.xml");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, task, pipeline, resolver);
    assertThat(builder.getArgs(), Is.is("-buildfile:\"pavan/build.xml\""));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Aggregations

CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)22 Test (org.junit.Test)17 TasksTest (com.thoughtworks.go.domain.TasksTest)16 File (java.io.File)16 NantTask (com.thoughtworks.go.config.NantTask)9 RunIf (com.googlecode.junit.ext.RunIf)6 Builder (com.thoughtworks.go.domain.builder.Builder)6 ExecTask (com.thoughtworks.go.config.ExecTask)2 AntTask (com.thoughtworks.go.config.AntTask)1 RakeTask (com.thoughtworks.go.config.RakeTask)1 RunIfConfigs (com.thoughtworks.go.domain.RunIfConfigs)1 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)1 CommandBuilderWithArgList (com.thoughtworks.go.domain.builder.CommandBuilderWithArgList)1 NullBuilder (com.thoughtworks.go.domain.builder.NullBuilder)1 ArrayList (java.util.ArrayList)1