Search in sources :

Example 6 with AntTask

use of com.thoughtworks.go.config.AntTask 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) 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) AntTask(com.thoughtworks.go.config.AntTask) PluggableViewModel(com.thoughtworks.go.plugins.presentation.PluggableViewModel) Test(org.junit.Test)

Example 7 with AntTask

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

the class AntTaskRepresenter method fromJSON.

public static AntTask fromJSON(JsonReader jsonReader) {
    AntTask antTask = new AntTask();
    if (jsonReader == null) {
        return antTask;
    }
    BaseTaskRepresenter.fromJSON(jsonReader, antTask);
    jsonReader.readStringIfPresent("working_directory", antTask::setWorkingDirectory);
    jsonReader.readStringIfPresent("build_file", antTask::setBuildFile);
    jsonReader.readStringIfPresent("target", antTask::setTarget);
    return antTask;
}
Also used : AntTask(com.thoughtworks.go.config.AntTask)

Example 8 with AntTask

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

the class AntTaskBuilderTest method shouldReturnBuilderWithCancelBuilderIfOnCancelDefined.

@Test
void shouldReturnBuilderWithCancelBuilderIfOnCancelDefined() {
    ExecTask cancelTask = new ExecTask();
    Builder builderForCancelTask = execTaskBuilder.createBuilder(builderFactory, cancelTask, pipeline, resolver);
    AntTask antTask = new AntTask();
    antTask.setCancelTask(cancelTask);
    when(builderFactory.builderFor(cancelTask, pipeline, resolver)).thenReturn(builderForCancelTask);
    Builder expected = expectedBuilder(antTask, builderForCancelTask);
    Builder actualBuilder = antTaskBuilder.createBuilder(builderFactory, antTask, pipeline, resolver);
    assertThat(actualBuilder).isEqualTo(expected);
}
Also used : ExecTask(com.thoughtworks.go.config.ExecTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Builder(com.thoughtworks.go.domain.builder.Builder) AntTask(com.thoughtworks.go.config.AntTask) Test(org.junit.jupiter.api.Test)

Example 9 with AntTask

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

the class PluggableTaskTest method shouldReturnFalseWhenPluggableTaskIsComparedWithAnyOtherTask.

@Test
public void shouldReturnFalseWhenPluggableTaskIsComparedWithAnyOtherTask() {
    PluginConfiguration pluginConfiguration = new PluginConfiguration("test-plugin-1", "1.0");
    PluggableTask pluggableTask = new PluggableTask(pluginConfiguration, new Configuration());
    AntTask antTask = new AntTask();
    assertFalse(pluggableTask.hasSameTypeAs(antTask));
}
Also used : Configuration(com.thoughtworks.go.domain.config.Configuration) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) AntTask(com.thoughtworks.go.config.AntTask) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) Test(org.junit.jupiter.api.Test)

Example 10 with AntTask

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

the class PipelineBean method getTasks.

public Tasks getTasks() {
    Tasks tasks = new Tasks();
    if ("ant".equals(builder)) {
        AntTask antTask = new AntTask();
        antTask.setTarget(this.target);
        antTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "build.xml" : this.buildfile));
        tasks.add(antTask);
    } else if ("nant".equals(builder)) {
        NantTask nantTask = new NantTask();
        nantTask.setTarget(this.target);
        nantTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "default.build" : this.buildfile));
        tasks.add(nantTask);
    } else if ("rake".equals(builder)) {
        RakeTask rakeTask = new RakeTask();
        rakeTask.setTarget(this.target);
        rakeTask.setBuildFile(StringUtils.isBlank(this.buildfile) ? null : this.buildfile);
        tasks.add(rakeTask);
    } else if ("exec".equals(builder)) {
        String trimmedCommand = StringUtils.defaultString(this.command).trim();
        String trimmedArguments = StringUtils.defaultString(this.arguments).trim();
        ExecTask execTask = new ExecTask(trimmedCommand, trimmedArguments, (String) null);
        tasks.add(execTask);
    }
    return tasks;
}
Also used : Tasks(com.thoughtworks.go.config.Tasks) RakeTask(com.thoughtworks.go.config.RakeTask) ExecTask(com.thoughtworks.go.config.ExecTask) AntTask(com.thoughtworks.go.config.AntTask) NantTask(com.thoughtworks.go.config.NantTask) StringUtils.defaultString(org.apache.commons.lang.StringUtils.defaultString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

AntTask (com.thoughtworks.go.config.AntTask)14 ExecTask (com.thoughtworks.go.config.ExecTask)7 Test (org.junit.Test)6 FetchTask (com.thoughtworks.go.config.FetchTask)5 PluggableViewModel (com.thoughtworks.go.plugins.presentation.PluggableViewModel)5 Test (org.junit.jupiter.api.Test)3 FetchPluggableArtifactTask (com.thoughtworks.go.config.FetchPluggableArtifactTask)2 PluggableTask (com.thoughtworks.go.config.pluggabletask.PluggableTask)2 ConfigElementImplementationRegistry (com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry)2 Task (com.thoughtworks.go.domain.Task)2 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)2 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)2 TaskViewModel (com.thoughtworks.go.presentation.TaskViewModel)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 NantTask (com.thoughtworks.go.config.NantTask)1 RakeTask (com.thoughtworks.go.config.RakeTask)1 Tasks (com.thoughtworks.go.config.Tasks)1 Builder (com.thoughtworks.go.domain.builder.Builder)1 Configuration (com.thoughtworks.go.domain.config.Configuration)1 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)1