Search in sources :

Example 6 with ExecTask

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

the class PluggableTaskBuilderCreatorTest method shouldReturnBuilderWithCancelBuilderIfOnCancelDefined.

@Test
public void shouldReturnBuilderWithCancelBuilderIfOnCancelDefined() throws Exception {
    ExecTask cancelExecTask = new ExecTask();
    Builder builderForCancelTask = execTaskBuilder.createBuilder(builderFactory, cancelExecTask, pipeline, resolver);
    pluggableTask.setCancelTask(cancelExecTask);
    when(builderFactory.builderFor(cancelExecTask, pipeline, resolver)).thenReturn(builderForCancelTask);
    Builder expected = expectedBuilder(pluggableTask, builderForCancelTask);
    Builder actual = pluggableTaskBuilderCreator.createBuilder(builderFactory, pluggableTask, pipeline, resolver);
    assertThat(actual, Is.is(expected));
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) PluggableTaskBuilder(com.thoughtworks.go.domain.builder.pluggableTask.PluggableTaskBuilder) Builder(com.thoughtworks.go.domain.builder.Builder) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Example 7 with ExecTask

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

the class PipelineBeanTest method shouldReturnExecTasksWithParameters.

@Test
public void shouldReturnExecTasksWithParameters() {
    PipelineBean execBean = execBean("exec", "java", "-DDEBUG_MODE=true -Xms=1024 -jar agent.jar");
    ExecTask execTask = new ExecTask("java", "-DDEBUG_MODE=true -Xms=1024 -jar agent.jar", (String) null);
    assertThat(execBean.getTasks().get(0), is(execTask));
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) Test(org.junit.Test)

Example 8 with ExecTask

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

the class TaskViewServiceTest method shouldGetViewModelsOnlyForBuiltInTasks_WhenThereAreNoExistingPlugins.

@Test
public void shouldGetViewModelsOnlyForBuiltInTasks_WhenThereAreNoExistingPlugins() throws Exception {
    List<Class<? extends Task>> taskClasses = taskImplementations();
    taskClasses.add(PluggableTask.class);
    when(registry.implementersOf(Task.class)).thenReturn(taskClasses);
    when(registry.getViewModelFor(new AntTask(), "new")).thenReturn(viewModel(new AntTask()));
    when(registry.getViewModelFor(new ExecTask(), "new")).thenReturn(new TaskViewModel(new ExecTask(), ""));
    List<PluggableViewModel> taskViewModels = taskViewService.getTaskViewModels();
    assertThat(taskViewModels.size(), is(3));
    assertThat(taskViewModels, hasItem((PluggableViewModel) viewModel(new AntTask())));
    assertThat(taskViewModels, hasItem((PluggableViewModel) new TaskViewModel(new ExecTask(), "")));
}
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) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) TaskViewModel(com.thoughtworks.go.presentation.TaskViewModel) ExecTask(com.thoughtworks.go.config.ExecTask) AntTask(com.thoughtworks.go.config.AntTask) PluggableViewModel(com.thoughtworks.go.plugins.presentation.PluggableViewModel) Test(org.junit.Test)

Example 9 with ExecTask

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

the class TaskViewServiceTest method shouldGetViewModelsForBuiltinTasks.

@Test
public void shouldGetViewModelsForBuiltinTasks() {
    List<Class<? extends Task>> taskClasses = taskImplementations();
    when(registry.implementersOf(Task.class)).thenReturn(taskClasses);
    when(registry.getViewModelFor(new AntTask(), "new")).thenReturn(viewModel(new AntTask()));
    when(registry.getViewModelFor(new ExecTask(), "new")).thenReturn(new TaskViewModel(new ExecTask(), ""));
    List<PluggableViewModel> taskViewModels = taskViewService.getTaskViewModels();
    assertThat(taskViewModels.size(), is(3));
    assertThat(taskViewModels, hasItem((PluggableViewModel) viewModel(new AntTask())));
    assertThat(taskViewModels, hasItem((PluggableViewModel) new TaskViewModel(new ExecTask(), "")));
}
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) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) TaskViewModel(com.thoughtworks.go.presentation.TaskViewModel) ExecTask(com.thoughtworks.go.config.ExecTask) AntTask(com.thoughtworks.go.config.AntTask) PluggableViewModel(com.thoughtworks.go.plugins.presentation.PluggableViewModel) Test(org.junit.Test)

Example 10 with ExecTask

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

the class TaskViewServiceTest method shouldGetListOfOnCancelTaskViewModels.

@Test
public void shouldGetListOfOnCancelTaskViewModels() {
    ConfigElementImplementationRegistry registry = this.registry;
    when(registry.implementersOf(Task.class)).thenReturn(taskImplementations());
    AntTask ant = new AntTask();
    FetchTask fetch = new FetchTask();
    ExecTask exec = new ExecTask();
    when(registry.getViewModelFor(ant, "new")).thenReturn(viewModel(ant));
    when(registry.getViewModelFor(fetch, "new")).thenReturn(viewModel(fetch));
    when(registry.getViewModelFor(exec, "new")).thenReturn(viewModel(exec));
    TaskViewService taskViewService = new TaskViewService(registry, mock(PluginManager.class));
    List<PluggableViewModel<Task>> onCancelTaskViewModels = taskViewService.getOnCancelTaskViewModels(new AntTask());
    assertThat(onCancelTaskViewModels, is(asList(viewModel(ant), viewModel(exec), viewModel(fetch))));
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) ConfigElementImplementationRegistry(com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry) ExecTask(com.thoughtworks.go.config.ExecTask) AntTask(com.thoughtworks.go.config.AntTask) PluggableViewModel(com.thoughtworks.go.plugins.presentation.PluggableViewModel) FetchTask(com.thoughtworks.go.config.FetchTask) Test(org.junit.Test)

Aggregations

ExecTask (com.thoughtworks.go.config.ExecTask)17 Test (org.junit.Test)15 AntTask (com.thoughtworks.go.config.AntTask)7 PluggableViewModel (com.thoughtworks.go.plugins.presentation.PluggableViewModel)6 FetchTask (com.thoughtworks.go.config.FetchTask)5 TasksTest (com.thoughtworks.go.domain.TasksTest)4 PluggableTask (com.thoughtworks.go.config.pluggabletask.PluggableTask)3 Task (com.thoughtworks.go.domain.Task)3 Builder (com.thoughtworks.go.domain.builder.Builder)3 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)3 Tasks (com.thoughtworks.go.config.Tasks)2 TaskViewModel (com.thoughtworks.go.presentation.TaskViewModel)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 RakeTask (com.thoughtworks.go.config.RakeTask)1