• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Property类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.thoughtworks.go.plugin.api.config.Property的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Property类属于com.thoughtworks.go.plugin.api.config包,在下文中一共展示了Property类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: isRepositoryConfigurationValid

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
/**
 * Check the validity of the supplied repository fields. It does a syntax
 * check. It does not check if the repository is available. It checks if the
 * repository contains unwanted fields.
 *
 * NOTE: A package in Go is the repository from Docker.
 *
 * @param repositoryConfiguration
 * @return ValidationResult
 */
@Override
public ValidationResult isRepositoryConfigurationValid(
        final RepositoryConfiguration repositoryConfiguration) {

    LOG.info("Validating repository: " + repositoryConfiguration.get(Constants.REGISTRY).getValue());
    ValidationResult validationResult = new ValidationResult();
    this.validateKeys(getRepositoryConfiguration(), repositoryConfiguration, validationResult);

    Property registry = repositoryConfiguration.get(Constants.REGISTRY);
    if (registry == null) {
        validationResult.addError(new ValidationError(Constants.REGISTRY, "Registry url not specified"));
        return validationResult;
    }

    DockerRegistry.getInstance(registry.getValue()).validate(validationResult);
    return validationResult;
}
 
开发者ID:decoomanj,项目名称:gocd-docker-material-poller,代码行数:28,代码来源:DockerMaterialConfiguration.java


示例2: shouldConstructPackageConfigurationFromApiRepositoryConfiguration

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldConstructPackageConfigurationFromApiRepositoryConfiguration() throws Exception {

    RepositoryConfiguration configuration = new RepositoryConfiguration();
    configuration.add(new PackageMaterialProperty("k1", "v1").with(Property.SECURE, Boolean.TRUE));

    PackageConfigurations packageConfigurations = new PackageConfigurations(configuration);
    assertThat(packageConfigurations.list().size(), is(1));
    assertThat(packageConfigurations.list().get(0).getKey(), is("k1"));
    assertThat(packageConfigurations.list().get(0).getValue(), is("v1"));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.REQUIRED), is(true));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.PART_OF_IDENTITY), is(true));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.SECURE), is(true));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.DISPLAY_NAME), is(""));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.DISPLAY_ORDER), is(0));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:17,代码来源:PackageConfigurationsTest.java


示例3: shouldConstructPackageConfigurationFromApiPackageConfiguration

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldConstructPackageConfigurationFromApiPackageConfiguration() throws Exception {

    com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration configuration = new com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration();
    configuration.add(new PackageMaterialProperty("k1", "v1").with(Property.SECURE, Boolean.TRUE));

    PackageConfigurations packageConfigurations = new PackageConfigurations(configuration);
    assertThat(packageConfigurations.list().size(), is(1));
    assertThat(packageConfigurations.list().get(0).getKey(), is("k1"));
    assertThat(packageConfigurations.list().get(0).getValue(), is("v1"));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.REQUIRED), is(true));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.PART_OF_IDENTITY), is(true));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.SECURE), is(true));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.DISPLAY_NAME), is(""));
    assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.DISPLAY_ORDER), is(0));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:17,代码来源:PackageConfigurationsTest.java


示例4: shouldConstructSCMConfiguration

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldConstructSCMConfiguration() throws Exception {
    SCMPropertyConfiguration scmPropertyConfiguration = new SCMPropertyConfiguration();
    scmPropertyConfiguration.add(new SCMProperty("k1", "v1").with(Property.SECURE, Boolean.TRUE));

    SCMConfigurations scmConfigurations = new SCMConfigurations(scmPropertyConfiguration);

    assertThat(scmConfigurations.list().size(), is(1));
    SCMConfiguration scmConfiguration = scmConfigurations.list().get(0);
    assertThat(scmConfiguration.getKey(), is("k1"));
    assertThat(scmConfiguration.getValue(), is("v1"));
    assertThat(scmConfiguration.getOption(SCMConfiguration.REQUIRED), is(true));
    assertThat(scmConfiguration.getOption(SCMConfiguration.PART_OF_IDENTITY), is(true));
    assertThat(scmConfiguration.getOption(SCMConfiguration.SECURE), is(true));
    assertThat(scmConfiguration.getOption(SCMConfiguration.DISPLAY_NAME), is(""));
    assertThat(scmConfiguration.getOption(SCMConfiguration.DISPLAY_ORDER), is(0));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:SCMConfigurationsTest.java


示例5: validateSCMPropertyDefaults

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void validateSCMPropertyDefaults() throws Exception {
    SCMProperty scmProperty = new SCMProperty("Test-Property");

    assertThat(scmProperty.getOptions().size(), is(5));
    assertThat(scmProperty.getOption(Property.REQUIRED), is(true));
    assertThat(scmProperty.getOption(Property.PART_OF_IDENTITY), is(true));
    assertThat(scmProperty.getOption(Property.SECURE), is(false));
    assertThat(scmProperty.getOption(Property.DISPLAY_NAME), is(""));
    assertThat(scmProperty.getOption(Property.DISPLAY_ORDER), is(0));

    scmProperty = new SCMProperty("Test-Property", "Dummy Value");

    assertThat(scmProperty.getOptions().size(), is(5));
    assertThat(scmProperty.getOption(Property.REQUIRED), is(true));
    assertThat(scmProperty.getOption(Property.PART_OF_IDENTITY), is(true));
    assertThat(scmProperty.getOption(Property.SECURE), is(false));
    assertThat(scmProperty.getOption(Property.DISPLAY_NAME), is(""));
    assertThat(scmProperty.getOption(Property.DISPLAY_ORDER), is(0));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:21,代码来源:SCMPropertyTest.java


示例6: setUp

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    extension = mock(PackageRepositoryExtension.class);

    com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageSettings = new com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration();
    packageSettings.add(new PackageMaterialProperty("username", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.PART_OF_IDENTITY, false).with(Property.DISPLAY_NAME, "foo").with(Property.DISPLAY_ORDER, 1));
    packageSettings.add(new PackageMaterialProperty("password", null).with(Property.REQUIRED, true).with(Property.SECURE, true).with(Property.DISPLAY_ORDER, 2));

    RepositoryConfiguration repoSettings = new RepositoryConfiguration();
    repoSettings.add(new PackageMaterialProperty("foo", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.DISPLAY_ORDER, 1));
    repoSettings.add(new PackageMaterialProperty("bar", null).with(Property.REQUIRED, true).with(Property.SECURE, true).with(Property.DISPLAY_ORDER, 2));

    stub(extension.getPackageConfiguration("plugin1")).toReturn(packageSettings);
    stub(extension.getRepositoryConfiguration("plugin1")).toReturn(repoSettings);
    stub(extension.getPluginSettingsView("plugin1")).toReturn("some-html");
    PluginSettingsConfiguration pluginSettingsConfiguration = new PluginSettingsConfiguration();
    pluginSettingsConfiguration.add(new PluginSettingsProperty("k1", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.DISPLAY_ORDER, 3));
    stub(extension.getPluginSettingsConfiguration("plugin1")).toReturn(pluginSettingsConfiguration);
}
 
开发者ID:gocd,项目名称:gocd,代码行数:20,代码来源:PackageMaterialPluginInfoBuilderTest.java


示例7: setUp

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    extension = mock(SCMExtension.class);

    SCMPropertyConfiguration value = new SCMPropertyConfiguration();
    value.add(new SCMProperty("username", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.PART_OF_IDENTITY, true).with(Property.DISPLAY_ORDER, 1));
    value.add(new SCMProperty("password", null).with(Property.REQUIRED, true).with(Property.SECURE, true).with(Property.PART_OF_IDENTITY, false).with(Property.DISPLAY_ORDER, 2));
    stub(extension.getSCMConfiguration("plugin1")).toReturn(value);
    stub(extension.getSCMView("plugin1")).toReturn(new SCMView() {
        @Override
        public String displayValue() {
            return "some scm plugin";
        }

        @Override
        public String template() {
            return "some html";
        }
    });
    PluginSettingsConfiguration pluginSettingsConfiguration = new PluginSettingsConfiguration();
    pluginSettingsConfiguration.add(new PluginSettingsProperty("k1", null).with(Property.REQUIRED, true).with(Property.SECURE, false).with(Property.DISPLAY_ORDER, 3));
    stub(extension.getPluginSettingsConfiguration("plugin1")).toReturn(pluginSettingsConfiguration);
    stub(extension.getPluginSettingsView("plugin1")).toReturn("settings view");
}
 
开发者ID:gocd,项目名称:gocd,代码行数:25,代码来源:SCMPluginInfoBuilderTest.java


示例8: config

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
private TaskConfig config() {
    TaskConfig taskConfig = new TaskConfig();
    TaskConfigProperty p1 = new TaskConfigProperty("k1", "value1");
    p1.with(Property.DISPLAY_ORDER, 10);
    p1.with(Property.SECURE, true);
    p1.with(Property.DISPLAY_NAME, "display name for k1");
    p1.with(Property.REQUIRED, true);
    TaskConfigProperty p2 = new TaskConfigProperty("k2", "value1");
    p2.with(Property.DISPLAY_ORDER, 1);
    p2.with(Property.SECURE, false);
    p2.with(Property.DISPLAY_NAME, "display name for k2");
    p2.with(Property.REQUIRED, true);
    p2.with(Property.REQUIRED, true);
    taskConfig.add(p1);
    taskConfig.add(p2);
    return taskConfig;
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:JsonBasedTaskExecutorTest.java


示例9: shouldConvertJsonResponseToValidationResultWhenValidationFails

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldConvertJsonResponseToValidationResultWhenValidationFails() {
    String jsonResponse = "{\"errors\":{\"key1\":\"err1\",\"key2\":\"err2\"}}";

    TaskConfig configuration = new TaskConfig();
    TaskConfigProperty property = new TaskConfigProperty("URL", "http://foo");
    property.with(Property.SECURE, false);
    property.with(Property.REQUIRED, true);
    configuration.add(property);

    ValidationResult result = new JsonBasedTaskExtensionHandler_V1().toValidationResult(jsonResponse);

    Assert.assertThat(result.isSuccessful(), CoreMatchers.is(false));


    ValidationError error1 = result.getErrors().get(0);
    ValidationError error2 = result.getErrors().get(1);

    Assert.assertThat(error1.getKey(), CoreMatchers.is("key1"));
    Assert.assertThat(error1.getMessage(), CoreMatchers.is("err1"));
    Assert.assertThat(error2.getKey(), CoreMatchers.is("key2"));
    Assert.assertThat(error2.getMessage(), CoreMatchers.is("err2"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:24,代码来源:JsonBasedTaskExtensionHandler_V1Test.java


示例10: shouldBuildPluginInfoWithPluginSettingsConfiguration

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldBuildPluginInfoWithPluginSettingsConfiguration() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    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));

    stub(extension.getPluginSettingsConfiguration("plugin1")).toReturn(value);
    stub(extension.getPluginSettingsView("plugin1")).toReturn("some-html");

    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfoBuilder(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("analytics"));
    assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:23,代码来源:AnalyticsPluginInfoBuilderTest.java


示例11: validatePropertyDefaults

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void validatePropertyDefaults() {
    PluginSettingsProperty property = new PluginSettingsProperty("Test-Property");
    assertThat(property.getOptions().size(), is(4));
    assertThat(property.getOption(Property.REQUIRED), is(true));
    assertThat(property.getOption(Property.SECURE), is(false));
    assertThat(property.getOption(Property.DISPLAY_NAME), is("Test-Property"));
    assertThat(property.getOption(Property.DISPLAY_ORDER), is(0));

    property = new PluginSettingsProperty("Test-Property", "Dummy Value");
    assertThat(property.getOptions().size(), is(4));
    assertThat(property.getOption(Property.REQUIRED), is(true));
    assertThat(property.getOption(Property.SECURE), is(false));
    assertThat(property.getOption(Property.DISPLAY_NAME), is("Test-Property"));
    assertThat(property.getOption(Property.DISPLAY_ORDER), is(0));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:17,代码来源:PluginSettingsPropertyTest.java


示例12: shouldFetchPluginSettingsMetadataForPluginBasedOnPluginId

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldFetchPluginSettingsMetadataForPluginBasedOnPluginId() throws Exception {
    for (GoPluginExtension extension : extensions) {

        PluginSettingsConfiguration configuration = new PluginSettingsConfiguration();
        configuration.add(new PluginSettingsProperty("k1").with(Property.REQUIRED, true).with(Property.SECURE, false));

        pluginDescriptor = new GoPluginDescriptor(UUID.randomUUID().toString(), "1.0", null, null, null, true);

        when(extension.canHandlePlugin(pluginDescriptor.id())).thenReturn(true);
        when(extension.extensionName()).thenReturn("extension-name");
        when(extension.getPluginSettingsConfiguration(pluginDescriptor.id())).thenReturn(configuration);
        when(extension.getPluginSettingsView(pluginDescriptor.id())).thenReturn("template");

        metadataLoader.fetchPluginSettingsMetaData(pluginDescriptor);

        verifyMetadataForPlugin(pluginDescriptor.id());
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:20,代码来源:PluginSettingsMetadataLoaderTest.java


示例13: shouldNotFetchPluginSettingsMetadataForTaskPlugin

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldNotFetchPluginSettingsMetadataForTaskPlugin() throws Exception {
    PluginSettingsConfiguration configuration = new PluginSettingsConfiguration();
    configuration.add(new PluginSettingsProperty("k1").with(Property.REQUIRED, true).with(Property.SECURE, false));

    pluginDescriptor = new GoPluginDescriptor(UUID.randomUUID().toString(), "1.0", null, null, null, true);

    when(taskExtension.canHandlePlugin(pluginDescriptor.id())).thenReturn(true);
    when(taskExtension.extensionName()).thenReturn("task");
    when(taskExtension.getPluginSettingsView(pluginDescriptor.id())).thenReturn("template");

    metadataLoader.fetchPluginSettingsMetaData(pluginDescriptor);

    verify(taskExtension, never()).getPluginSettingsConfiguration(pluginDescriptor.id());
    PluginSettingsConfiguration configurationInStore = PluginSettingsMetadataStore.getInstance().configuration(pluginDescriptor.id());
    assertNull(configurationInStore);
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:PluginSettingsMetadataLoaderTest.java


示例14: shouldSortConfigurationPropertiesBasedOnDisplayOrder

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldSortConfigurationPropertiesBasedOnDisplayOrder() {
    PluginSettingsProperty p3 = createProperty("k3", 3);
    PluginSettingsProperty p0 = createProperty("k0", 0);
    PluginSettingsProperty p2 = createProperty("k2", 2);
    PluginSettingsProperty p1 = createProperty("k1", 1);
    PluginSettingsConfiguration configuration = new PluginSettingsConfiguration();
    configuration.add(p3);
    configuration.add(p0);
    configuration.add(p2);
    configuration.add(p1);

    List<? extends Property> properties = configuration.list();
    assertThat(properties.get(0).getKey(), is("k0"));
    assertThat(properties.get(1).getKey(), is("k1"));
    assertThat(properties.get(2).getKey(), is("k2"));
    assertThat(properties.get(3).getKey(), is("k3"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:19,代码来源:PluginSettingsConfigurationTest.java


示例15: validatePackagePropertyDefaults

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void validatePackagePropertyDefaults() throws Exception {
    PackageMaterialProperty packageMaterialProperty = new PackageMaterialProperty("Test-Property");
    assertThat(packageMaterialProperty.getOptions().size(), is(5));
    assertThat(packageMaterialProperty.getOption(Property.REQUIRED), is(true));
    assertThat(packageMaterialProperty.getOption(Property.PART_OF_IDENTITY), is(true));
    assertThat(packageMaterialProperty.getOption(Property.SECURE), is(false));
    assertThat(packageMaterialProperty.getOption(Property.DISPLAY_NAME), is(""));
    assertThat(packageMaterialProperty.getOption(Property.DISPLAY_ORDER), is(0));

    packageMaterialProperty = new PackageMaterialProperty("Test-Property", "Dummy Value");
    assertThat(packageMaterialProperty.getOptions().size(), is(5));
    assertThat(packageMaterialProperty.getOption(Property.REQUIRED), is(true));
    assertThat(packageMaterialProperty.getOption(Property.PART_OF_IDENTITY), is(true));
    assertThat(packageMaterialProperty.getOption(Property.SECURE), is(false));
    assertThat(packageMaterialProperty.getOption(Property.DISPLAY_NAME), is(""));
    assertThat(packageMaterialProperty.getOption(Property.DISPLAY_ORDER), is(0));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:19,代码来源:PackageMaterialPropertyTest.java


示例16: shouldAddPropertyWithGiveName

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldAddPropertyWithGiveName() throws Exception {
    String abcd = "Abcd";
    String abcdDefault = "first of alphabets";
    String wxyz = "wxyz";
    String wxyzDefault = "last of alphabets";

    taskConfig.addProperty(wxyz).withDefault(wxyzDefault);
    taskConfig.addProperty(abcd).withDefault(abcdDefault);
    List<? extends Property> properties = taskConfig.list();
    assertThat(properties.size(), is(2));
    for (Property property : properties) {
        assertThat(property != null, is(true));
        assertThat(property instanceof TaskConfigProperty, is(true));
    }
    assertThat(taskConfig.get(abcd) != null, is(true));
    assertThat(taskConfig.get(abcd).getValue(), is(abcdDefault));
    assertThat(taskConfig.get(wxyz) != null, is(true));
    assertThat(taskConfig.get(wxyz).getValue(), is(wxyzDefault));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:21,代码来源:TaskConfigTest.java


示例17: shouldValidateSCM

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldValidateSCM() {
    SCMConfiguration scmConfig = new SCMConfiguration(new SCMProperty("KEY2").with(Property.REQUIRED, false));
    scmConfigurations.add(scmConfig);

    Configuration configuration = new Configuration(ConfigurationPropertyMother.create("KEY1"));
    SCM modifiedSCM = new SCM("scm-id", new PluginConfiguration(pluginId, "1"), configuration);
    ValidationResult validationResult = new ValidationResult();
    validationResult.addError(new ValidationError("KEY1", "error message"));
    when(scmExtension.isSCMConfigurationValid(eq(modifiedSCM.getPluginConfiguration().getId()), any(SCMPropertyConfiguration.class))).thenReturn(validationResult);

    pluggableScmService.validate(modifiedSCM);

    assertFalse(modifiedSCM.getConfiguration().getProperty("KEY1").errors().isEmpty());
    assertThat(modifiedSCM.getConfiguration().getProperty("KEY1").errors().firstError(), is("error message"));
    verify(scmExtension).isSCMConfigurationValid(eq(modifiedSCM.getPluginConfiguration().getId()), any(SCMPropertyConfiguration.class));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:PluggableScmServiceTest.java


示例18: shouldValidateMandatoryAndSecureFieldsForSCM

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Test
public void shouldValidateMandatoryAndSecureFieldsForSCM() {
    SCMConfiguration scmConfig = new SCMConfiguration(new SCMProperty("KEY2").with(Property.REQUIRED, true).with(Property.SECURE, true));
    scmConfigurations.add(scmConfig);

    Configuration configuration = new Configuration(ConfigurationPropertyMother.create("KEY1"), ConfigurationPropertyMother.create("KEY2", true, ""));
    SCM modifiedSCM = new SCM("scm-id", new PluginConfiguration(pluginId, "1"), configuration);
    ValidationResult validationResult = new ValidationResult();
    when(scmExtension.isSCMConfigurationValid(eq(modifiedSCM.getPluginConfiguration().getId()), any(SCMPropertyConfiguration.class))).thenReturn(validationResult);
    when(localizer.localize("MANDATORY_CONFIGURATION_FIELD")).thenReturn("MANDATORY_CONFIGURATION_FIELD");

    pluggableScmService.validate(modifiedSCM);

    final List<ValidationError> validationErrors = validationResult.getErrors();
    assertFalse(validationErrors.isEmpty());
    final ValidationError validationErrorForKey1 = getValidationErrorFor(validationErrors, "KEY1");
    assertNotNull(validationErrorForKey1);
    assertThat(validationErrorForKey1.getMessage(), is("MANDATORY_CONFIGURATION_FIELD"));
    final ValidationError validationErrorForKey2 = getValidationErrorFor(validationErrors, "KEY2");
    assertNotNull(validationErrorForKey2);
    assertThat(validationErrorForKey2.getMessage(), is("MANDATORY_CONFIGURATION_FIELD"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:23,代码来源:PluggableScmServiceTest.java


示例19: getPropertiesForDisplay

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
@Override
public List<TaskProperty> getPropertiesForDisplay() {
    ArrayList<TaskProperty> taskProperties = new ArrayList<>();
    if (PluggableTaskConfigStore.store().hasPreferenceFor(pluginConfiguration.getId())) {
        TaskPreference preference = taskPreference();
        List<? extends Property> propertyDefinitions = preference.getConfig().list();
        for (Property propertyDefinition : propertyDefinitions) {
            ConfigurationProperty configuredProperty = configuration.getProperty(propertyDefinition.getKey());
            if (configuredProperty == null) continue;
            taskProperties.add(new TaskProperty(propertyDefinition.getOption(Property.DISPLAY_NAME), configuredProperty.getDisplayValue(), configuredProperty.getConfigKeyName()));
        }
        return taskProperties;
    }

    for (ConfigurationProperty property : configuration) {
        taskProperties.add(new TaskProperty(property.getConfigKeyName(), property.getDisplayValue()));
    }
    return taskProperties;
}
 
开发者ID:gocd,项目名称:gocd,代码行数:20,代码来源:PluggableTask.java


示例20: setPluginConfigurationAttributes

import com.thoughtworks.go.plugin.api.config.Property; //导入依赖的package包/类
protected void setPluginConfigurationAttributes(Map attributes) {
    SCMConfigurations scmConfigurations = SCMMetadataStore.getInstance().getConfigurationMetadata(pluginConfiguration.getId());
    if (scmConfigurations == null) {
        throw new RuntimeException("metadata unavailable for plugin: " + pluginConfiguration.getId());
    }
    for (SCMConfiguration scmConfiguration : scmConfigurations.list()) {
        String key = scmConfiguration.getKey();
        if (attributes.containsKey(key)) {
            if (configuration.getProperty(key) == null) {
                configuration.addNewConfiguration(scmConfiguration.getKey(), scmConfiguration.getOption(Property.SECURE));
            }
            configuration.getProperty(key).setConfigurationValue(new ConfigurationValue((String) attributes.get(key)));
            configuration.getProperty(key).handleSecureValueConfiguration(scmConfiguration.getOption(Property.SECURE));
        }
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:17,代码来源:SCM.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LanguageDriverRegistry类代码示例发布时间:2022-05-23
下一篇:
Java XSAnnotation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap