当前位置: 首页>>代码示例>>Java>>正文


Java Property.with方法代码示例

本文整理汇总了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));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:21,代码来源:PluggableTaskTest.java

示例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());
}
 
开发者ID:gocd,项目名称:gocd,代码行数:12,代码来源:ConfigurationPropertyBuilderTest.java

示例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());
}
 
开发者ID:gocd,项目名称:gocd,代码行数:12,代码来源:ConfigurationPropertyBuilderTest.java

示例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());
}
 
开发者ID:gocd,项目名称:gocd,代码行数:13,代码来源:ConfigurationPropertyBuilderTest.java

示例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"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:13,代码来源:ConfigurationPropertyBuilderTest.java

示例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"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:13,代码来源:ConfigurationPropertyBuilderTest.java

示例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"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:11,代码来源:ConfigurationPropertyBuilderTest.java

示例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());
}
 
开发者ID:gocd,项目名称:gocd,代码行数:11,代码来源:ConfigurationPropertyBuilderTest.java


注:本文中的com.thoughtworks.go.plugin.api.config.Property.with方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。