use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class ElasticAgentPluginInfoBuilder method elasticClusterProfileSettings.
private PluggableInstanceSettings elasticClusterProfileSettings(String pluginId) {
if (extension.supportsClusterProfiles(pluginId)) {
List<PluginConfiguration> profileMetadata = extension.getClusterProfileMetadata(pluginId);
String profileView = extension.getClusterProfileView(pluginId);
return new PluggableInstanceSettings(profileMetadata, new PluginView(profileView));
}
return new PluggableInstanceSettings(null, null);
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class ConfigRepoPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() throws Exception {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
when(extension.getPluginSettingsView("plugin1")).thenReturn("some-html");
when(extension.getCapabilities("plugin1")).thenReturn(new Capabilities(true, true, true, true));
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)));
assertThat(pluginInfo.getCapabilities(), is(new Capabilities(true, true, true, true)));
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class ElasticAgentExtensionV5Test method shouldGetProfileMetadata.
@Test
public void shouldGetProfileMetadata() {
String responseBody = "[{\"key\":\"Username\",\"metadata\":{\"required\":true,\"secure\":false}},{\"key\":\"Password\",\"metadata\":{\"required\":true,\"secure\":true}}]";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ELASTIC_AGENT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
final List<PluginConfiguration> metadata = extensionV5.getElasticProfileMetadata(PLUGIN_ID);
assertThat(metadata, hasSize(2));
assertThat(metadata, containsInAnyOrder(new PluginConfiguration("Username", new Metadata(true, false)), new PluginConfiguration("Password", new Metadata(true, true))));
assertExtensionRequest("5.0", REQUEST_GET_ELASTIC_AGENT_PROFILE_METADATA, null);
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class NotificationPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
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.PluginConfiguration in project gocd by gocd.
the class RoleConfigCommandTest method setAuthorizationPluginInfo.
private void setAuthorizationPluginInfo() {
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
PluginConfiguration k1 = new PluginConfiguration("k1", new Metadata(false, true));
PluginConfiguration k2 = new PluginConfiguration("k2", new Metadata(false, false));
PluginConfiguration k3 = new PluginConfiguration("k3", new Metadata(false, true));
PluggableInstanceSettings authConfigSettins = new PluggableInstanceSettings(asList(k1, k2, k3));
PluggableInstanceSettings roleConfigSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
com.thoughtworks.go.plugin.domain.authorization.Capabilities capabilities = new com.thoughtworks.go.plugin.domain.authorization.Capabilities(SupportedAuthType.Web, true, true, true);
AuthorizationPluginInfo artifactPluginInfo = new AuthorizationPluginInfo(pluginDescriptor, authConfigSettins, roleConfigSettings, null, capabilities);
when(pluginDescriptor.id()).thenReturn("cd.go.github");
AuthorizationMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
Aggregations