use of com.thoughtworks.go.plugin.domain.common.PluginView in project gocd by gocd.
the class PluggableTaskPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
PluggableTaskPluginInfo pluginInfo = new PluggableTaskPluginInfoBuilder(extension).pluginInfoFor(descriptor);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
PluginView pluginView = new PluginView("some html");
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("task"));
assertThat(pluginInfo.getDisplayName(), is("my task plugin"));
assertThat(pluginInfo.getTaskSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
assertNull(pluginInfo.getPluginSettings());
}
use of com.thoughtworks.go.plugin.domain.common.PluginView in project gocd by gocd.
the class ConfigRepoPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
stub(extension.getPluginSettingsView("plugin1")).toReturn("some-html");
ConfigRepoPluginInfo pluginInfo = new ConfigRepoPluginInfoBuilder(extension).pluginInfoFor(descriptor);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
PluginView pluginView = new PluginView("some-html");
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("configrepo"));
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
}
use of com.thoughtworks.go.plugin.domain.common.PluginView in project gocd by gocd.
the class NotificationPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
NotificationPluginInfo pluginInfo = new NotificationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
PluginView pluginView = new PluginView("some-html");
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("notification"));
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
}
use of com.thoughtworks.go.plugin.domain.common.PluginView in project gocd by gocd.
the class ElasticAgentPluginInfoBuilder method elasticProfileSettings.
private PluggableInstanceSettings elasticProfileSettings(String pluginId) {
List<PluginConfiguration> profileMetadata = extension.getProfileMetadata(pluginId);
String profileView = extension.getProfileView(pluginId);
return new PluggableInstanceSettings(profileMetadata, new PluginView(profileView));
}
use of com.thoughtworks.go.plugin.domain.common.PluginView 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);
}
Aggregations