Search in sources :

Example 11 with TaskPreference

use of com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference in project gocd by gocd.

the class TaskViewService method allPluginTasks.

private List<PluggableTask> allPluginTasks() {
    final ArrayList<PluggableTask> tasks = new ArrayList<>();
    for (final String pluginId : PluggableTaskConfigStore.store().pluginIds()) {
        GoPluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptorFor(pluginId);
        TaskPreference taskPreference = PluggableTaskConfigStore.store().preferenceFor(pluginId);
        if (pluginDescriptor != null && taskPreference != null) {
            tasks.add(new PluggableTask(new PluginConfiguration(pluginId, pluginDescriptor.version()), getConfiguration(taskPreference.getConfig())));
        }
    }
    return tasks;
}
Also used : ArrayList(java.util.ArrayList) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Example 12 with TaskPreference

use of com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference in project gocd by gocd.

the class PluggableTaskPluginInfoBuilder method pluginInfoFor.

@Override
public PluggableTaskPluginInfo pluginInfoFor(String pluginId) {
    if (!store.pluginIds().contains(pluginId)) {
        return null;
    }
    GoPluginDescriptor plugin = pluginManager.getPluginDescriptorFor(pluginId);
    TaskPreference taskPreference = store.preferenceFor(pluginId);
    List<PluginConfiguration> pluginConfigurations = configurations(taskPreference.getConfig());
    PluginView pluginView = new PluginView(taskPreference.getView().template());
    return new PluggableTaskPluginInfo(plugin, taskPreference.getView().displayValue(), new PluggableInstanceSettings(pluginConfigurations, pluginView));
}
Also used : PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginView(com.thoughtworks.go.server.ui.plugins.PluginView) PluggableTaskPluginInfo(com.thoughtworks.go.server.ui.plugins.PluggableTaskPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Example 13 with TaskPreference

use of com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference in project gocd by gocd.

the class PluggableTaskViewModelBuilder method allPluginInfos.

public List<PluginInfo> allPluginInfos() {
    List<PluginInfo> pluginInfos = new ArrayList<>();
    for (String pluginId : PluggableTaskConfigStore.store().pluginIds()) {
        GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
        TaskPreference taskPreference = PluggableTaskConfigStore.store().preferenceFor(pluginId);
        pluginInfos.add(new PluginInfo(descriptor, TaskExtension.TASK_EXTENSION, taskPreference.getView().displayValue(), null, null));
    }
    return pluginInfos;
}
Also used : ArrayList(java.util.ArrayList) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Example 14 with TaskPreference

use of com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference in project gocd by gocd.

the class TaskViewServiceTest method storeTaskPreferences.

private void storeTaskPreferences(String pluginId, Property... properties) {
    FakeTask task = new FakeTask(properties);
    PluggableTaskConfigStore.store().setPreferenceFor(pluginId, new TaskPreference(task));
}
Also used : TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Example 15 with TaskPreference

use of com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference in project gocd by gocd.

the class TaskViewServiceTest method storeTaskPreferences.

private void storeTaskPreferences(String pluginId, String... properties) {
    FakeTask task = new FakeTask(properties);
    PluggableTaskConfigStore.store().setPreferenceFor(pluginId, new TaskPreference(task));
}
Also used : TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Aggregations

TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)26 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)16 Test (org.junit.Test)14 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)12 Configuration (com.thoughtworks.go.domain.config.Configuration)11 TaskProperty (com.thoughtworks.go.domain.TaskProperty)8 TaskView (com.thoughtworks.go.plugin.api.task.TaskView)8 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)8 TaskConfigProperty (com.thoughtworks.go.plugin.api.task.TaskConfigProperty)7 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)5 JsonBasedPluggableTask (com.thoughtworks.go.plugin.access.pluggabletask.JsonBasedPluggableTask)4 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)4 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)4 Before (org.junit.Before)4 PluggableTask (com.thoughtworks.go.config.pluggabletask.PluggableTask)3 Property (com.thoughtworks.go.plugin.api.config.Property)3 PluggableTaskPluginInfo (com.thoughtworks.go.server.ui.plugins.PluggableTaskPluginInfo)3 ArrayList (java.util.ArrayList)3 AntTask (com.thoughtworks.go.config.AntTask)2 PluggableTaskConfigStore (com.thoughtworks.go.plugin.access.pluggabletask.PluggableTaskConfigStore)2