use of com.thoughtworks.go.domain.config.ConfigurationProperty in project gocd by gocd.
the class ElasticProfileTest method addConfigurations_shouldAddConfigurationsWithValue.
@Test
public void addConfigurations_shouldAddConfigurationsWithValue() throws Exception {
ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name"));
ElasticProfile profile = new ElasticProfile("id", "plugin_id");
profile.addConfigurations(Arrays.asList(property));
assertThat(profile.size(), is(1));
assertThat(profile, contains(new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name"))));
}
use of com.thoughtworks.go.domain.config.ConfigurationProperty in project gocd by gocd.
the class ElasticProfileTest method addConfiguration_shouldEncryptASecureVariable.
@Test
public void addConfiguration_shouldEncryptASecureVariable() throws Exception {
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), profileSettings, 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));
assertTrue(profile.first().isSecure());
}
use of com.thoughtworks.go.domain.config.ConfigurationProperty in project gocd by gocd.
the class PluginRoleConfigTest method hasErrors_shouldBeTrueIfConfigurationPropertiesHasErrors.
@Test
public void hasErrors_shouldBeTrueIfConfigurationPropertiesHasErrors() throws Exception {
ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("view"));
PluginRoleConfig roleConfig = new PluginRoleConfig("admin", "auth_id", property);
property.addError("username", "username format is incorrect");
assertTrue(roleConfig.hasErrors());
assertTrue(roleConfig.errors().isEmpty());
}
use of com.thoughtworks.go.domain.config.ConfigurationProperty in project gocd by gocd.
the class SecurityAuthConfigTest method addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore.
@Test
public void addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore() throws Exception {
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(pluginDescriptor("plugin_id"), new PluggableInstanceSettings(new ArrayList<>()), null, null, null);
store.setPluginInfo(pluginInfo);
SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id");
authConfig.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
assertThat(authConfig.size(), is(1));
assertFalse(authConfig.first().isSecure());
assertThat(authConfig, contains(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
}
use of com.thoughtworks.go.domain.config.ConfigurationProperty in project gocd by gocd.
the class SecurityAuthConfigTest method addConfigurations_shouldAddConfigurationsWithValue.
@Test
public void addConfigurations_shouldAddConfigurationsWithValue() throws Exception {
ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name"));
SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id");
authConfig.addConfigurations(Arrays.asList(property));
assertThat(authConfig.size(), is(1));
assertThat(authConfig, contains(new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name"))));
}
Aggregations