本文整理汇总了Java中com.thoughtworks.go.plugin.api.config.Property.with方法的典型用法代码示例。如果您正苦于以下问题:Java Property.with方法的具体用法?Java Property.with怎么用?Java Property.with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thoughtworks.go.plugin.api.config.Property
的用法示例。
在下文中一共展示了Property.with方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldAddConfigurationProperties
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldAddConfigurationProperties() {
List<ConfigurationProperty> configurationProperties = Arrays.asList(ConfigurationPropertyMother.create("key", "value", "encValue"), new ConfigurationProperty());
PluginConfiguration pluginConfiguration = new PluginConfiguration("github.pr", "1.1");
TaskPreference taskPreference = mock(TaskPreference.class);
TaskConfig taskConfig = new TaskConfig();
Configuration configuration = new Configuration();
Property property = new Property("key");
property.with(Property.SECURE, false);
PluggableTaskConfigStore.store().setPreferenceFor(pluginConfiguration.getId(), taskPreference);
TaskConfigProperty taskConfigProperty = taskConfig.addProperty("key");
when(taskPreference.getConfig()).thenReturn(taskConfig);
PluggableTask pluggableTask = new PluggableTask(pluginConfiguration, configuration);
pluggableTask.addConfigurations(configurationProperties);
assertThat(configuration.size(), is(2));
}
示例2: shouldCreateConfigurationPropertyWithEncyrptedValueForSecureProperty
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldCreateConfigurationPropertyWithEncyrptedValueForSecureProperty() {
Property key = new Property("key");
key.with(Property.SECURE, true);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", null, "enc_value", true);
assertThat(property.getConfigKeyName(), is("key"));
assertThat(property.getEncryptedValue(), is("enc_value"));
assertNull(property.getConfigurationValue());
}
示例3: shouldCreateWithEncyrptedValueForOnlyPlainTextInputForSecureProperty
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldCreateWithEncyrptedValueForOnlyPlainTextInputForSecureProperty() throws Exception {
Property key = new Property("key");
key.with(Property.SECURE, true);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", "value", null, true);
assertThat(property.getConfigKeyName(), is("key"));
assertThat(property.getEncryptedValue(), is(new GoCipher().encrypt("value")));
assertNull(property.getConfigurationValue());
}
示例4: shouldCreatePropertyInAbsenceOfPlainAndEncryptedTextInputForSecureProperty
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldCreatePropertyInAbsenceOfPlainAndEncryptedTextInputForSecureProperty() throws Exception {
Property key = new Property("key");
key.with(Property.SECURE, true);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", null, null, true);
assertThat(property.errors().size(), is(0));
assertThat(property.getConfigKeyName(), is("key"));
assertNull(property.getEncryptedConfigurationValue());
assertNull(property.getConfigurationValue());
}
示例5: shouldCreateWithErrorsIfBothPlainAndEncryptedTextInputAreSpecifiedForSecureProperty
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldCreateWithErrorsIfBothPlainAndEncryptedTextInputAreSpecifiedForSecureProperty() {
Property key = new Property("key");
key.with(Property.SECURE, true);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", "value", "enc_value", true);
assertThat(property.errors().get("configurationValue").get(0), is("You may only specify `value` or `encrypted_value`, not both!"));
assertThat(property.errors().get("encryptedValue").get(0), is("You may only specify `value` or `encrypted_value`, not both!"));
assertThat(property.getConfigurationValue().getValue(), is("value"));
assertThat(property.getEncryptedValue(), is("enc_value"));
}
示例6: shouldCreateWithErrorsIfBothPlainAndEncryptedTextInputAreSpecifiedForUnSecuredProperty
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldCreateWithErrorsIfBothPlainAndEncryptedTextInputAreSpecifiedForUnSecuredProperty() {
Property key = new Property("key");
key.with(Property.SECURE, false);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", "value", "enc_value", false);
assertThat(property.errors().get("configurationValue").get(0), is("You may only specify `value` or `encrypted_value`, not both!"));
assertThat(property.errors().get("encryptedValue").get(0), is("You may only specify `value` or `encrypted_value`, not both!"));
assertThat(property.getConfigurationValue().getValue(), is("value"));
assertThat(property.getEncryptedValue(), is("enc_value"));
}
示例7: shouldCreateWithErrorsInPresenceOfEncryptedTextInputForUnSecuredProperty
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldCreateWithErrorsInPresenceOfEncryptedTextInputForUnSecuredProperty() {
Property key = new Property("key");
key.with(Property.SECURE, false);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", null, "enc_value", false);
assertThat(property.errors().get("encryptedValue").get(0), is("encrypted_value cannot be specified to a unsecured property."));
assertThat(property.getEncryptedValue(), is("enc_value"));
}
示例8: shouldCreateWithValueForAUnsecuredProperty
import com.thoughtworks.go.plugin.api.config.Property; //导入方法依赖的package包/类
@Test
public void shouldCreateWithValueForAUnsecuredProperty() {
Property key = new Property("key");
key.with(Property.SECURE, false);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", "value", null, false);
assertThat(property.getConfigurationValue().getValue(), is("value"));
assertNull(property.getEncryptedConfigurationValue());
}