use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.
the class SecurityAuthConfigTest method postConstruct_shouldEncryptSecureConfigurations.
@Test
public void postConstruct_shouldEncryptSecureConfigurations() throws Exception {
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(pluginDescriptor("plugin_id"), profileSettings, null, null, null);
store.setPluginInfo(pluginInfo);
SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
authConfig.encryptSecureConfigurations();
assertThat(authConfig.size(), is(1));
assertTrue(authConfig.first().isSecure());
}
use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.
the class ElasticProfileTest method addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore.
@Test
public void addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore() throws Exception {
ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), new PluggableInstanceSettings(new ArrayList<>()), null, null, null);
store.setPluginInfo(pluginInfo);
ElasticProfile profile = new ElasticProfile("id", "plugin_id");
profile.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
assertThat(profile.size(), is(1));
assertFalse(profile.first().isSecure());
assertThat(profile, contains(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
}
use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings 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.PluggableInstanceSettings 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.PluggableInstanceSettings 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));
}
Aggregations