use of com.thoughtworks.go.plugin.domain.scm.SCMPluginInfo in project gocd by gocd.
the class SCMExtensionRepresenter method toJSON.
@Override
public void toJSON(OutputWriter extensionWriter, PluginInfo extension) {
super.toJSON(extensionWriter, extension);
SCMPluginInfo scmPluginInfo = (SCMPluginInfo) extension;
extensionWriter.add("display_name", scmPluginInfo.getDisplayName()).addChild("scm_settings", scmSettingsWriter -> PluggableInstanceSettingsRepresenter.toJSON(scmSettingsWriter, scmPluginInfo.getScmSettings()));
}
use of com.thoughtworks.go.plugin.domain.scm.SCMPluginInfo in project gocd by gocd.
the class SCMPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() throws Exception {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
SCMPluginInfo pluginInfo = new SCMPluginInfoBuilder(extension).pluginInfoFor(descriptor);
List<PluginConfiguration> scmConfigurations = Arrays.asList(new PluginConfiguration("username", new MetadataWithPartOfIdentity(true, false, true)), new PluginConfiguration("password", new MetadataWithPartOfIdentity(true, true, false)));
PluginView pluginView = new PluginView("some html");
List<PluginConfiguration> pluginSettings = Arrays.asList(new PluginConfiguration("k1", new Metadata(true, false)));
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("scm"));
assertThat(pluginInfo.getDisplayName(), is("some scm plugin"));
assertThat(pluginInfo.getScmSettings(), is(new PluggableInstanceSettings(scmConfigurations, pluginView)));
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginSettings, new PluginView("settings view"))));
}
use of com.thoughtworks.go.plugin.domain.scm.SCMPluginInfo in project gocd by gocd.
the class PluginServiceTest method shouldReturnNullForGetPluginInfoIfDoesNotImplementPluginSettings_MultipleExtensionImpl.
@Test
public void shouldReturnNullForGetPluginInfoIfDoesNotImplementPluginSettings_MultipleExtensionImpl() {
String pluginId = "plugin-id";
CombinedPluginInfo combinedPluginInfo = new CombinedPluginInfo();
GoPluginDescriptor pluginDescriptor = GoPluginDescriptor.builder().id(pluginId).build();
NotificationPluginInfo notificationPluginInfo = new NotificationPluginInfo(pluginDescriptor, null);
combinedPluginInfo.add(notificationPluginInfo);
SCMPluginInfo scmPluginInfo = new SCMPluginInfo(pluginDescriptor, "display_name", new PluggableInstanceSettings(null), null);
combinedPluginInfo.add(scmPluginInfo);
assertNull(pluginService.pluginInfoForExtensionThatHandlesPluginSettings(pluginId));
}
Aggregations