use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty in project gocd by gocd.
the class ConfigRepoPluginInfoBuilderTest method setUp.
@BeforeEach
public void setUp() throws Exception {
extension = mock(ConfigRepoExtension.class);
PluginSettingsConfiguration value = new PluginSettingsConfiguration();
value.add(new PluginSettingsProperty("username", null).with(Property.REQUIRED, true).with(Property.SECURE, false));
value.add(new PluginSettingsProperty("password", null).with(Property.REQUIRED, true).with(Property.SECURE, true));
when(extension.getPluginSettingsConfiguration("plugin1")).thenReturn(value);
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty in project gocd by gocd.
the class ElasticAgentPluginInfoBuilderTest method shouldFetchPluginSettingsForPluginsNotSupportingClusterProfiles.
@Test
public void shouldFetchPluginSettingsForPluginsNotSupportingClusterProfiles() {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
PluginSettingsConfiguration pluginSettingsConfiguration = new PluginSettingsConfiguration();
pluginSettingsConfiguration.add(new PluginSettingsProperty("ami-id", "ami-123"));
when(extension.getPluginSettingsConfiguration(descriptor.id())).thenReturn(pluginSettingsConfiguration);
when(extension.getPluginSettingsView(descriptor.id())).thenReturn("some html");
when(extension.supportsClusterProfiles("plugin1")).thenReturn(false);
ElasticAgentPluginInfoBuilder builder = new ElasticAgentPluginInfoBuilder(extension);
ElasticAgentPluginInfo pluginInfo = builder.pluginInfoFor(descriptor);
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(builder.configurations(pluginSettingsConfiguration), new PluginView("some html"))));
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty in project gocd by gocd.
the class ElasticAgentPluginInfoBuilderTest method shouldBuildPluginInfoWithProfileSettings.
@Test
public void shouldBuildPluginInfoWithProfileSettings() {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
List<PluginConfiguration> pluginConfigurations = List.of(new PluginConfiguration("aws_password", new Metadata(true, false)));
PluginSettingsProperty property = new PluginSettingsProperty("ami-id", "ami-123");
PluginSettingsConfiguration pluginSettingsConfiguration = new PluginSettingsConfiguration();
pluginSettingsConfiguration.add(property);
Image icon = new Image("content_type", "data", "hash");
when(pluginManager.resolveExtensionVersion("plugin1", ELASTIC_AGENT_EXTENSION, SUPPORTED_VERSIONS)).thenReturn("1.0");
when(extension.getPluginSettingsConfiguration(descriptor.id())).thenReturn(pluginSettingsConfiguration);
when(extension.getPluginSettingsView(descriptor.id())).thenReturn("some html");
when(extension.getIcon(descriptor.id())).thenReturn(icon);
when(extension.getProfileMetadata(descriptor.id())).thenReturn(pluginConfigurations);
when(extension.getProfileView(descriptor.id())).thenReturn("profile_view");
ElasticAgentPluginInfoBuilder builder = new ElasticAgentPluginInfoBuilder(extension);
ElasticAgentPluginInfo pluginInfo = builder.pluginInfoFor(descriptor);
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("elastic-agent"));
assertThat(pluginInfo.getImage(), is(icon));
assertThat(pluginInfo.getElasticAgentProfileSettings(), is(new PluggableInstanceSettings(pluginConfigurations, new PluginView("profile_view"))));
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(builder.configurations(pluginSettingsConfiguration), new PluginView("some html"))));
assertFalse(pluginInfo.supportsStatusReport());
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty in project gocd by gocd.
the class ElasticAgentPluginInfoBuilderTest method shouldBuildPluginInfoWithoutClusterProfileSettingsForPluginsImplementedUsingv4Extension.
@Test
public void shouldBuildPluginInfoWithoutClusterProfileSettingsForPluginsImplementedUsingv4Extension() {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
List<PluginConfiguration> elasticAgentProfileConfigurations = Arrays.asList(new PluginConfiguration("aws_password", new Metadata(true, false)));
PluginSettingsProperty property = new PluginSettingsProperty("ami-id", "ami-123");
PluginSettingsConfiguration pluginSettingsConfiguration = new PluginSettingsConfiguration();
pluginSettingsConfiguration.add(property);
Image icon = new Image("content_type", "data", "hash");
when(pluginManager.resolveExtensionVersion("plugin1", ELASTIC_AGENT_EXTENSION, SUPPORTED_VERSIONS)).thenReturn("1.0");
when(extension.getPluginSettingsConfiguration(descriptor.id())).thenReturn(pluginSettingsConfiguration);
when(extension.getPluginSettingsView(descriptor.id())).thenReturn("some html");
when(extension.getIcon(descriptor.id())).thenReturn(icon);
when(extension.getProfileMetadata(descriptor.id())).thenReturn(elasticAgentProfileConfigurations);
when(extension.getProfileView(descriptor.id())).thenReturn("elastic_agent_profile_view");
when(extension.supportsClusterProfiles("plugin1")).thenReturn(false);
ElasticAgentPluginInfoBuilder builder = new ElasticAgentPluginInfoBuilder(extension);
ElasticAgentPluginInfo pluginInfo = builder.pluginInfoFor(descriptor);
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("elastic-agent"));
assertThat(pluginInfo.getImage(), is(icon));
assertThat(pluginInfo.getElasticAgentProfileSettings(), is(new PluggableInstanceSettings(elasticAgentProfileConfigurations, new PluginView("elastic_agent_profile_view"))));
assertThat(pluginInfo.getClusterProfileSettings(), is(new PluggableInstanceSettings(null, null)));
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(builder.configurations(pluginSettingsConfiguration), new PluginView("some html"))));
assertFalse(pluginInfo.supportsStatusReport());
verify(extension, never()).getClusterProfileMetadata(any());
verify(extension, never()).getClusterProfileView(any());
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty in project gocd by gocd.
the class NotificationPluginInfoBuilderTest method setUp.
@BeforeEach
public void setUp() {
extension = mock(NotificationExtension.class);
PluginSettingsConfiguration value = new PluginSettingsConfiguration();
value.add(new PluginSettingsProperty("username", null).with(Property.REQUIRED, true).with(Property.SECURE, false));
value.add(new PluginSettingsProperty("password", null).with(Property.REQUIRED, true).with(Property.SECURE, true));
when(extension.getPluginSettingsConfiguration("plugin1")).thenReturn(value);
when(extension.getPluginSettingsView("plugin1")).thenReturn("some-html");
}
Aggregations