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));
}
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));
}
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(), "")));
}
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(), "")));
}
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))));
}
Aggregations