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

Java RepositoryConfiguration类代码示例

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

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



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

示例1: latestModificationSince

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Override
public PackageRevision latestModificationSince(PackageConfiguration packageConfiguration,
                                               RepositoryConfiguration repositoryConfiguration,
                                               PackageRevision previouslyKnownRevision) {
    LOGGER.debug("latestModificationSince called with previous revision " + previouslyKnownRevision);

    PackageRevision latestRevision = getLatestRevision(packageConfiguration, repositoryConfiguration);

    if (latestRevision != null &&
            latestRevision.getTimestamp().after(previouslyKnownRevision.getTimestamp()))
    {
        LOGGER.info("Latest revision later than previous known.");
        return latestRevision;
    } else {
        return previouslyKnownRevision;
    }
}
 
开发者ID:Sounie,项目名称:springer-gocd-cloudfoundry-plugin,代码行数:18,代码来源:CloudFoundryPoller.java


示例2: getClient

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
private CloudFoundryClient getClient(RepositoryConfiguration repositoryConfiguration) {
    String api = repositoryConfiguration.get("REPO_URL").getValue();
    String username = repositoryConfiguration.get("USERNAME").getValue();
    String password = repositoryConfiguration.get("PASSWORD").getValue();

    LOGGER.debug("Cloud Foundry connection details: api: " + api + ", username " + username);

    ConnectionContext connectionContext = DefaultConnectionContext.builder()
            .apiHost(api)
            .skipSslValidation(true)
            .build();

    ReactorCloudFoundryClient client = ReactorCloudFoundryClient.builder()
            .connectionContext(connectionContext)
            .tokenProvider(PasswordGrantTokenProvider.builder()
                    .username(username)
                    .password(password)
                    .build())
            .build();

    return client;
}
 
开发者ID:Sounie,项目名称:springer-gocd-cloudfoundry-plugin,代码行数:23,代码来源:CloudFoundryPoller.java


示例3: latestModificationSince

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
public PackageRevision latestModificationSince(PackageConfiguration packageConfig, RepositoryConfiguration repoConfig, PackageRevision previouslyKnownRevision) {
    LOGGER.info(String.format("latestModificationSince called with packageId %s, for repo: %s",
            packageConfig.get(NpmPackageConfig.PACKAGE_ID).getValue(), repoConfig.get(RepoUrl.REPO_URL).getValue()));
    validateConfig(repoConfig, packageConfig);
    NpmPackageConfig npmPackageConfig = new NpmPackageConfig(packageConfig);
    NpmParams params = new NpmParams(
            new NpmRepoConfig(repoConfig).getRepoUrl(),
            npmPackageConfig.getPackageId(),
            npmPackageConfig.getPollVersionFrom(),
            npmPackageConfig.getPollVersionTo(),
            previouslyKnownRevision);
    PackageRevision updatedPackage = poll(params);
    if (updatedPackage == null) {
        LOGGER.info(String.format("no modification since %s", previouslyKnownRevision.getRevision()));
        return null;
    }
    LOGGER.info(String.format("latestModificationSince returning with %s, %s",
            updatedPackage.getRevision(), updatedPackage.getTimestamp()));
    if (updatedPackage.getTimestamp().getTime() < previouslyKnownRevision.getTimestamp().getTime())
        LOGGER.warn(String.format("Updated Package %s published earlier (%s) than previous (%s, %s)",
                updatedPackage.getRevision(), updatedPackage.getTimestamp(), previouslyKnownRevision.getRevision(), previouslyKnownRevision.getTimestamp()));
    return updatedPackage;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:24,代码来源:NpmPoller.java


示例4: checkConnectionToRepository

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Override
public Result checkConnectionToRepository(RepositoryConfiguration repoConfigs) {
    Result response = new Result();
    NpmRepoConfig npmRepoConfig = new NpmRepoConfig(repoConfigs);
    RepoUrl repoUrl = npmRepoConfig.getRepoUrl();
    if (repoUrl.isHttp()) {
        try {
            repoUrl.checkConnection(((HttpRepoURL) repoUrl).getUrlStrWithTrailingSlash());
        } catch (Exception e) {
            response.withErrorMessages(e.getMessage());
        }
    } else {
        repoUrl.checkConnection();
    }
    LOGGER.info(response.getMessagesForDisplay());
    return response;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:18,代码来源:NpmPoller.java


示例5: shouldGetRepositoryConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Test
public void shouldGetRepositoryConfiguration() {
    RepositoryConfiguration configurations = pluginConfig.getRepositoryConfiguration();
    assertThat(configurations.get(RepoUrl.REPO_URL), is(notNullValue()));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(SECURE), is(false));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(REQUIRED), is(true));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(DISPLAY_NAME), is("Npm server API root"));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(DISPLAY_ORDER), is(0));
    assertThat(configurations.get(RepoUrl.USERNAME), is(notNullValue()));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(SECURE), is(false));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(REQUIRED), is(false));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(DISPLAY_NAME), is("UserName"));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(DISPLAY_ORDER), is(1));
    assertThat(configurations.get(RepoUrl.PASSWORD), is(notNullValue()));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(SECURE), is(true));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(REQUIRED), is(false));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(DISPLAY_NAME), is("Password"));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(DISPLAY_ORDER), is(2));
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:20,代码来源:PluginConfigTest.java


示例6: isRepositoryConfigurationValid

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Override
@EntryPoint
public ValidationResult isRepositoryConfigurationValid(RepositoryConfiguration repositoryConfiguration) {
    SaferConfiguration configuration = new SaferConfiguration(repositoryConfiguration);
    String forgeUrl = configuration.get(FORGE_URL);
    LOG.info("Validating configuration for forge (URL = %s)", forgeUrl);

    ValidationResult validationResult = new ValidationResult();
    if (forgeUrl.isEmpty()) {
        validationResult.addError(new ValidationError(FORGE_URL, "Forge URL is mandatory"));
    } else {
        try {
            URL url = new URL(forgeUrl);
            if (!url.getProtocol().matches("^https?$")) {
                validationResult.addError(new ValidationError(FORGE_URL, "Forge URL must be an HTTP(S) URL"));
            }
        } catch (MalformedURLException e) {
            validationResult.addError(new ValidationError(FORGE_URL, "Forge URL must be a URL"));
        }
    }
    return validationResult;
}
 
开发者ID:drrb,项目名称:go-puppet-forge-poller,代码行数:23,代码来源:ForgePollerPluginConfig.java


示例7: latestModificationSince

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Override
@EntryPoint
public PackageRevision latestModificationSince(PackageConfiguration packageConfiguration, RepositoryConfiguration repositoryConfiguration, PackageRevision lastKnownRevision) {
    ModuleSpec module = moduleSpecFactory.build(packageConfiguration);
    Forge forge = forgeFactory.build(repositoryConfiguration);
    Version lastKnownReleaseVersion = Version.of(lastKnownRevision.getRevision());

    LOG.info("Looking up latest release of module %s in forge %s since version %s", module, forge, lastKnownReleaseVersion);
    try {
        ModuleVersion latestRelease = forge.getLatestVersion(module);
        if (latestRelease.getVersion().isGreaterThan(lastKnownReleaseVersion)) {
            //TODO: warn if this release is earlier than lastKnownRevision
            return latestRelease.toPackageRevision();
        } else {
            return null;
        }
    } catch (Forge.ModuleNotFound moduleNotFound) {
        LOG.info("Module %s not found in forge %s: %s", module, forge, moduleNotFound);
        return null;
    }
}
 
开发者ID:drrb,项目名称:go-puppet-forge-poller,代码行数:22,代码来源:ForgePoller.java


示例8: checkConnectionToRepository

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
/**
 * Check the validation of the fields and then check the real connection
 *
 * @param repositoryConfiguration
 * @return
 */
@Override
public Result checkConnectionToRepository(
        final RepositoryConfiguration repositoryConfiguration) {

    Result result = this.validateRepository(repositoryConfiguration);
    if (!result.isSuccessful()) {
        return result;
    }

    DockerRegistry instance = DockerRegistry.getInstance(repositoryConfiguration);

    try {
        instance.checkConnection();
        result = new Result().withSuccessMessages(String.format("Successfully connected to %s", instance.getUrl()));
    } catch (Exception e) {
        LOG.warn(String.format("Check connection for %s failed with exception - %s", instance.getUrl(), e));
        result = new Result().withErrorMessages(String.format("Check connection failed for %s", instance.getUrl()));
    }

    return result;
}
 
开发者ID:decoomanj,项目名称:gocd-docker-material-poller,代码行数:28,代码来源:DockerMaterialPoller.java


示例9: checkConnectionToPackage

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
/**
 * Check if the package is valid.
 *
 * @param packageConfiguration
 * @param repositoryConfiguration
 * @return
 */
@Override
public Result checkConnectionToPackage(
        final PackageConfiguration packageConfiguration, 
        final RepositoryConfiguration repositoryConfiguration) {
    
    Result checkConnectionResult = this.checkConnectionToRepository(repositoryConfiguration);
    if (!checkConnectionResult.isSuccessful()) {
        return checkConnectionResult;
    }

    try {
        Result packageConfigurationValidationResult = packageValidation(packageConfiguration, repositoryConfiguration);
        if (!packageConfigurationValidationResult.isSuccessful()) {
            return packageConfigurationValidationResult;
        }

        PackageRevision latestRevision = this.getLatestRevision(packageConfiguration, repositoryConfiguration);
        return new Result().withSuccessMessages(String.format("Found package '%s'.", latestRevision.getRevision()));
    } catch (Exception e) {
        String message = String.format("Could not find any package that matched '%s'.", packageConfiguration.get(Constants.REPOSITORY).getValue());
        LOG.warn(message);
        return new Result().withErrorMessages(message);
    }
}
 
开发者ID:decoomanj,项目名称:gocd-docker-material-poller,代码行数:32,代码来源:DockerMaterialPoller.java


示例10: validateData

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
/**
 * Validate the data of both configuration.
 * 
 * @param repositoryConfigurations
 * @param packageConfigurations 
 */
private void validateData(
        final RepositoryConfiguration repositoryConfigurations, 
        final PackageConfiguration packageConfigurations) {
    
    ValidationResult validationResult = new ValidationResult();
    new DockerMaterialConfiguration().validate(packageConfigurations, repositoryConfigurations, validationResult);
    if (!validationResult.isSuccessful()) {
        StringBuilder stringBuilder = new StringBuilder();
        for (ValidationError validationError : validationResult.getErrors()) {
            stringBuilder.append(validationError.getMessage()).append("; ");
        }
        String errorString = stringBuilder.toString();
        String message = errorString.substring(0, errorString.length() - 2);
        LOG.warn(String.format("Data validation failed: %s", message));
        throw new RuntimeException(message);
    }
}
 
开发者ID:decoomanj,项目名称:gocd-docker-material-poller,代码行数:24,代码来源:DockerMaterialPoller.java


示例11: isRepositoryConfigurationValid

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的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


示例12: getLatestRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
public PackageRevision getLatestRevision(PackageConfiguration packageConfig, RepositoryConfiguration repoConfig) {
    LOGGER.info(String.format("getLatestRevision called with packageName %s, for repo: %s",
            packageConfig.get(GenericArtifactoryPackageConfig.PACKAGE_ID).getValue(), repoConfig.get(RepoUrl.REPO_URL).getValue()));

    validateConfig(repoConfig, packageConfig);

    GenericArtifactoryPackageConfig artifactoryPackageConfig = new GenericArtifactoryPackageConfig(packageConfig);
    GenericArtifactoryRepoConfig artifactoryRepoConfig = new GenericArtifactoryRepoConfig(repoConfig);

    GenericArtifactoryParams params = GenericArtifactoryParams.createFrom(
            artifactoryRepoConfig.getRepoUrl(),
            artifactoryPackageConfig,
            null);

    PackageRevision packageRevision = poll(params);

    LOGGER.info(String.format("getLatestRevision returning with %s, %s",
            packageRevision.getRevision(),
            packageRevision.getTimestamp()));

    return packageRevision;
}
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:23,代码来源:GenericArtifactoryPoller.java


示例13: checkConnectionToRepository

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Override
public Result checkConnectionToRepository(RepositoryConfiguration repoConfigs) {
    Result response = new Result();
    GenericArtifactoryRepoConfig genericArtifactoryRepoConfig = new GenericArtifactoryRepoConfig(repoConfigs);
    RepoUrl repoUrl = genericArtifactoryRepoConfig.getRepoUrl();
    if (repoUrl.isHttp()) {
        try {
            repoUrl.checkConnection(((HttpRepoURL) repoUrl).getUrlStrWithTrailingSlash());
        } catch (Exception e) {
            response.withErrorMessages(e.getMessage());
        }
    } else {
        repoUrl.checkConnection();
    }
    LOGGER.info(response.getMessagesForDisplay());
    return response;
}
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:18,代码来源:GenericArtifactoryPoller.java


示例14: shouldGetRepositoryConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Test
public void shouldGetRepositoryConfiguration() {
    RepositoryConfiguration configurations = pluginConfig.getRepositoryConfiguration();
    assertThat(configurations.get(RepoUrl.REPO_URL), is(notNullValue()));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(SECURE), is(false));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(REQUIRED), is(true));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(DISPLAY_NAME), is("Artifactory server API root"));
    assertThat(configurations.get(RepoUrl.REPO_URL).getOption(DISPLAY_ORDER), is(0));
    assertThat(configurations.get(RepoUrl.USERNAME), is(notNullValue()));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(SECURE), is(false));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(REQUIRED), is(false));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(DISPLAY_NAME), is("UserName"));
    assertThat(configurations.get(RepoUrl.USERNAME).getOption(DISPLAY_ORDER), is(1));
    assertThat(configurations.get(RepoUrl.PASSWORD), is(notNullValue()));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(SECURE), is(true));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(REQUIRED), is(false));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(DISPLAY_NAME), is("Password"));
    assertThat(configurations.get(RepoUrl.PASSWORD).getOption(DISPLAY_ORDER), is(2));
}
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:20,代码来源:PluginConfigTest.java


示例15: shouldConstructPackageConfigurationFromApiRepositoryConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的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


示例16: fetchRepositoryAndPackageMetaData

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
void fetchRepositoryAndPackageMetaData(GoPluginDescriptor pluginDescriptor) {
    try {
        RepositoryConfiguration repositoryConfiguration = packageRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id());
        com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = packageRepositoryExtension.getPackageConfiguration(pluginDescriptor.id());
        if (repositoryConfiguration == null) {
            throw new RuntimeException(format("Plugin[%s] returned null repository configuration", pluginDescriptor.id()));
        }
        if (packageConfiguration == null) {
            throw new RuntimeException(format("Plugin[%s] returned null package configuration", pluginDescriptor.id()));
        }
        repositoryMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(repositoryConfiguration));
        packageMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(packageConfiguration));
    } catch (GoPluginFrameworkException e) {
        LOGGER.error("Failed to fetch package metadata for plugin : {}", pluginDescriptor.id(), e);
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:17,代码来源:PackageMaterialMetadataLoader.java


示例17: setUp

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的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


示例18: setUp

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    initMocks(this);
    extension = new PackageRepositoryExtension(pluginManager);

    pluginSettingsConfiguration = new PluginSettingsConfiguration();

    repositoryConfiguration = new RepositoryConfiguration();
    repositoryConfiguration.add(new PackageMaterialProperty("key-one", "value-one"));
    repositoryConfiguration.add(new PackageMaterialProperty("key-two", "value-two"));

    packageConfiguration = new com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration();
    packageConfiguration.add(new PackageMaterialProperty("key-three", "value-three"));
    packageConfiguration.add(new PackageMaterialProperty("key-four", "value-four"));

    requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
    when(pluginManager.resolveExtensionVersion(PLUGIN_ID, asList("1.0"))).thenReturn("1.0");
}
 
开发者ID:gocd,项目名称:gocd,代码行数:19,代码来源:PackageRepositoryExtensionTest.java


示例19: shouldTalkToPluginToGetRepositoryConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Test
public void shouldTalkToPluginToGetRepositoryConfiguration() throws Exception {
    String expectedRequestBody = null;

    String expectedResponseBody = "{" +
            "\"key-one\":{}," +
            "\"key-two\":{\"default-value\":\"two\",\"part-of-identity\":true,\"secure\":true,\"required\":true,\"display-name\":\"display-two\",\"display-order\":\"1\"}," +
            "\"key-three\":{\"default-value\":\"three\",\"part-of-identity\":false,\"secure\":false,\"required\":false,\"display-name\":\"display-three\",\"display-order\":\"2\"}" +
            "}";

    when(pluginManager.isPluginOfType(PACKAGE_MATERIAL_EXTENSION, PLUGIN_ID)).thenReturn(true);
    when(pluginManager.submitTo(eq(PLUGIN_ID), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(expectedResponseBody));

    RepositoryConfiguration repositoryConfiguration = extension.getRepositoryConfiguration(PLUGIN_ID);

    assertRequest(requestArgumentCaptor.getValue(), PACKAGE_MATERIAL_EXTENSION, "1.0", PackageRepositoryExtension.REQUEST_REPOSITORY_CONFIGURATION, expectedRequestBody);
    assertPropertyConfiguration((PackageMaterialProperty) repositoryConfiguration.get("key-one"), "key-one", null, true, true, false, "", 0);
    assertPropertyConfiguration((PackageMaterialProperty) repositoryConfiguration.get("key-two"), "key-two", "two", true, true, true, "display-two", 1);
    assertPropertyConfiguration((PackageMaterialProperty) repositoryConfiguration.get("key-three"), "key-three", "three", false, false, false, "display-three", 2);
}
 
开发者ID:gocd,项目名称:gocd,代码行数:21,代码来源:PackageRepositoryExtensionTest.java


示例20: setup

import com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration; //导入依赖的package包/类
@Before
public void setup() {
    //setup material
    material = new PackageMaterial();
    PackageRepository packageRepository = PackageRepositoryMother.create("id", "name", "plugin-id", "plugin-version",
            new Configuration(ConfigurationPropertyMother.create("url", false, "http://some-url")));
    PackageDefinition packageDefinition = create("id", "package",
            new Configuration(ConfigurationPropertyMother.create("name", false, "go-agent"), ConfigurationPropertyMother.create("secure", true, "value")), packageRepository);
    material.setPackageDefinition(packageDefinition);

    packageRepositoryExtension = mock(PackageRepositoryExtension.class);


    poller = new com.thoughtworks.go.server.service.materials.PackageMaterialPoller(packageRepositoryExtension);

    packageConfiguration = ArgumentCaptor.forClass(com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration.class);
    repositoryConfiguration = ArgumentCaptor.forClass(RepositoryConfiguration.class);

}
 
开发者ID:gocd,项目名称:gocd,代码行数:20,代码来源:PackageMaterialPollerTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java StringInterner类代码示例发布时间:2022-05-23
下一篇:
Java Proxy类代码示例发布时间: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