Search in sources :

Example 6 with PluggableTaskPluginInfo

use of com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo in project gocd by gocd.

the class PluggableTaskPluginInfoBuilder method pluginInfoFor.

public PluggableTaskPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
    final TaskPreference[] tp = { null };
    extension.doOnTask(descriptor.id(), new Action<Task>() {

        @Override
        public void execute(Task task, GoPluginDescriptor pluginDescriptor) {
            tp[0] = new TaskPreference(task);
        }
    });
    TaskConfig config = tp[0].getConfig();
    TaskView view = tp[0].getView();
    if (config == null) {
        throw new RuntimeException(format("Plugin[%s] returned null task configuration", descriptor.id()));
    }
    if (view == null) {
        throw new RuntimeException(format("Plugin[%s] returned null task view", descriptor.id()));
    }
    String displayName = view.displayValue();
    PluggableInstanceSettings taskSettings = new PluggableInstanceSettings(configurations(config), new PluginView(view.template()));
    return new PluggableTaskPluginInfo(descriptor, displayName, taskSettings);
}
Also used : Task(com.thoughtworks.go.plugin.api.task.Task) TaskView(com.thoughtworks.go.plugin.api.task.TaskView) PluggableTaskPluginInfo(com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo) TaskConfig(com.thoughtworks.go.plugin.api.task.TaskConfig) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) PluginView(com.thoughtworks.go.plugin.domain.common.PluginView) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)

Aggregations

PluggableTaskPluginInfo (com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo)6 Test (org.junit.Test)5 NotificationPluginInfo (com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo)4 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)2 PluginView (com.thoughtworks.go.plugin.domain.common.PluginView)2 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)2 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)1 Task (com.thoughtworks.go.plugin.api.task.Task)1 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)1 TaskView (com.thoughtworks.go.plugin.api.task.TaskView)1 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)1 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)1