Search in sources :

Example 16 with ExecTask

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

the class PipelineBeanTest method shouldReturnExecTasksWithoutParameters.

@Test
public void shouldReturnExecTasksWithoutParameters() {
    PipelineBean execBean = execBean("exec", "ls", null);
    ExecTask execTask = new ExecTask("ls", "", (String) null);
    assertThat(execBean.getTasks().get(0), is(execTask));
    execBean = execBean("exec", " ls ", null);
    execTask = new ExecTask("ls", "", (String) null);
    assertThat(execBean.getTasks().get(0), is(execTask));
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) Test(org.junit.Test)

Example 17 with ExecTask

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

the class ExecTaskTest method validateTask_shouldValidateThatCommandIsRequired.

@Test
public void validateTask_shouldValidateThatCommandIsRequired() {
    ExecTask execTask = new ExecTask();
    execTask.validateTask(null);
    assertThat(execTask.errors().isEmpty(), is(false));
    assertThat(execTask.errors().on(ExecTask.COMMAND), is("Command cannot be empty"));
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) Test(org.junit.Test)

Example 18 with ExecTask

use of com.thoughtworks.go.config.ExecTask 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));
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Example 19 with ExecTask

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

the class TaskViewServiceTest method shouldGetViewModelForPluggableFetchArtifactTaskWhenToggleIsOn.

@Test
public void shouldGetViewModelForPluggableFetchArtifactTaskWhenToggleIsOn() {
    List<Class<? extends Task>> taskClasses = taskImplementations();
    taskClasses.add(FetchPluggableArtifactTask.class);
    when(featureToggleService.isToggleOn(Toggles.ARTIFACT_EXTENSION_KEY)).thenReturn(true);
    when(registry.implementersOf(Task.class)).thenReturn(taskClasses);
    when(registry.getViewModelFor(new FetchPluggableArtifactTask(), "new")).thenReturn(viewModel(new FetchPluggableArtifactTask()));
    when(registry.getViewModelFor(new ExecTask(), "new")).thenReturn(new TaskViewModel(new ExecTask(), ""));
    List<PluggableViewModel> taskViewModels = taskViewService.getTaskViewModels();
    assertThat(taskViewModels.size(), is(4));
    assertThat(taskViewModels, hasItem((PluggableViewModel) new TaskViewModel(new ExecTask(), "")));
    assertThat(taskViewModels, hasItem((PluggableViewModel) new TaskViewModel(new FetchPluggableArtifactTask(), "")));
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) Task(com.thoughtworks.go.domain.Task) FetchTask(com.thoughtworks.go.config.FetchTask) AntTask(com.thoughtworks.go.config.AntTask) FetchPluggableArtifactTask(com.thoughtworks.go.config.FetchPluggableArtifactTask) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) TaskViewModel(com.thoughtworks.go.presentation.TaskViewModel) ExecTask(com.thoughtworks.go.config.ExecTask) PluggableViewModel(com.thoughtworks.go.plugins.presentation.PluggableViewModel) FetchPluggableArtifactTask(com.thoughtworks.go.config.FetchPluggableArtifactTask) Test(org.junit.Test)

Aggregations

ExecTask (com.thoughtworks.go.config.ExecTask)19 Test (org.junit.Test)17 AntTask (com.thoughtworks.go.config.AntTask)9 PluggableViewModel (com.thoughtworks.go.plugins.presentation.PluggableViewModel)8 FetchTask (com.thoughtworks.go.config.FetchTask)7 PluggableTask (com.thoughtworks.go.config.pluggabletask.PluggableTask)5 Task (com.thoughtworks.go.domain.Task)5 FetchPluggableArtifactTask (com.thoughtworks.go.config.FetchPluggableArtifactTask)4 TasksTest (com.thoughtworks.go.domain.TasksTest)4 TaskViewModel (com.thoughtworks.go.presentation.TaskViewModel)4 Builder (com.thoughtworks.go.domain.builder.Builder)3 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)3 Tasks (com.thoughtworks.go.config.Tasks)2 File (java.io.File)2 RunIf (com.googlecode.junit.ext.RunIf)1 Argument (com.thoughtworks.go.config.Argument)1 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 ConfigCache (com.thoughtworks.go.config.ConfigCache)1 MagicalGoConfigXmlLoader (com.thoughtworks.go.config.MagicalGoConfigXmlLoader)1 NantTask (com.thoughtworks.go.config.NantTask)1