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


Java PackageConfiguration类代码示例

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


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

示例1: latestModificationSince

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

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

示例3: getPackageConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
@Override
@EntryPoint
public PackageConfiguration getPackageConfiguration() {
    PackageConfiguration packageConfig = new PackageConfiguration();
    packageConfig.add(property(MODULE_NAME)
            .withDisplayName("Module Name")
            .withPartOfIdentity(true)
            .withDisplayOrder(0)
            .build());
    packageConfig.add(property(LOWER_VERSION_BOUND_INCLUSIVE)
            .withRequired(false)
            .withDisplayName("Version to poll >=")
            .withPartOfIdentity(false)
            .withDisplayOrder(1)
            .build());
    packageConfig.add(property(UPPER_VERSION_BOUND_EXCLUSIVE)
            .withRequired(false)
            .withDisplayName("Version to poll <")
            .withPartOfIdentity(false)
            .withDisplayOrder(2)
            .build());
    return packageConfig;
}
 
开发者ID:drrb,项目名称:go-puppet-forge-poller,代码行数:24,代码来源:ForgePollerPluginConfig.java

示例4: latestModificationSince

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

示例5: jsonForTagsForRepository

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
private JSONArray jsonForTagsForRepository(PackageConfiguration packageConfiguration) {
    DefaultHttpClient client = new DefaultHttpClient();

    try {
        String urlForTags = MessageFormat.format("https://{0}/v1/repositories/{1}/tags",
                repositoryConfiguration.get("REGISTRY_URL").getValue(),
                packageConfiguration.get("REPOSITORY_NAME").getValue());
        HttpGet google = new HttpGet(urlForTags);
        HttpResponse response = client.execute(google);
        String jsonString = EntityUtils.toString(response.getEntity());
        return new JSONObject("{\"tags\":" + jsonString + "}").getJSONArray("tags");
    } catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}
 
开发者ID:hammerdr,项目名称:go-docker-registry-poller,代码行数:18,代码来源:DockerRegistry.java

示例6: checkConnectionToPackage

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

示例7: validateData

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

示例8: getLatestRevision

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

示例9: shouldGetPackageConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
@Test
public void shouldGetPackageConfiguration() {
    PackageConfiguration configurations = pluginConfig.getPackageConfiguration();
    assertNotNull(configurations.get(PACKAGE_PATH));
    assertThat(configurations.get(PACKAGE_PATH).getOption(DISPLAY_NAME), is("Package Path"));
    assertThat(configurations.get(PACKAGE_PATH).getOption(DISPLAY_ORDER), is(1));
    assertNotNull(configurations.get(PACKAGE_ID));
    assertThat(configurations.get(PACKAGE_ID).getOption(DISPLAY_NAME), is("Package Id"));
    assertThat(configurations.get(PACKAGE_ID).getOption(DISPLAY_ORDER), is(2));
    assertNotNull(configurations.get(POLL_VERSION_FROM));
    assertThat(configurations.get(POLL_VERSION_FROM).getOption(DISPLAY_NAME), is("Version to poll >="));
    assertThat(configurations.get(POLL_VERSION_FROM).getOption(DISPLAY_ORDER), is(3));
    assertThat(configurations.get(POLL_VERSION_FROM).getOption(REQUIRED), is(false));
    assertNotNull(configurations.get(POLL_VERSION_TO));
    assertThat(configurations.get(POLL_VERSION_TO).getOption(DISPLAY_NAME), is("Version to poll <"));
    assertThat(configurations.get(POLL_VERSION_TO).getOption(DISPLAY_ORDER), is(4));
    assertThat(configurations.get(POLL_VERSION_TO).getOption(REQUIRED), is(false));
}
 
开发者ID:varchev,项目名称:go-generic-artifactory-poller,代码行数:19,代码来源:PluginConfigTest.java

示例10: shouldGetPackageConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
@Test
public void shouldGetPackageConfiguration() {
    PackageConfiguration configurations = debRepositoryConfiguration.getPackageConfiguration();
    assertThat(configurations.get(PACKAGE_NAME), is(notNullValue()));
    assertThat(configurations.get(Constants.PACKAGE_NAME).getOption(Property.SECURE), is(false));
    assertThat(configurations.get(Constants.PACKAGE_NAME).getOption(Property.PART_OF_IDENTITY), is(true));
    assertThat(configurations.get(Constants.PACKAGE_NAME).getOption(Property.REQUIRED), is(true));
    assertThat(configurations.get(Constants.PACKAGE_NAME).getOption(Property.DISPLAY_NAME), is("Debian Package Name"));
    assertThat(configurations.get(Constants.PACKAGE_NAME).getOption(Property.DISPLAY_ORDER), is(0));
    assertThat(configurations.get(VERSION_SPEC), is(notNullValue()));
    assertThat(configurations.get(Constants.VERSION_SPEC).getOption(Property.SECURE), is(false));
    assertThat(configurations.get(Constants.VERSION_SPEC).getOption(Property.PART_OF_IDENTITY), is(true));
    assertThat(configurations.get(Constants.VERSION_SPEC).getOption(Property.REQUIRED), is(false));
    assertThat(configurations.get(Constants.VERSION_SPEC).getOption(Property.DISPLAY_NAME), is("Version Spec"));
    assertThat(configurations.get(Constants.VERSION_SPEC).getOption(Property.DISPLAY_ORDER), is(1));
    assertThat(configurations.get(ARCHITECTURE), is(notNullValue()));
    assertThat(configurations.get(Constants.ARCHITECTURE).getOption(Property.SECURE), is(false));
    assertThat(configurations.get(Constants.ARCHITECTURE).getOption(Property.PART_OF_IDENTITY), is(true));
    assertThat(configurations.get(Constants.ARCHITECTURE).getOption(Property.REQUIRED), is(false));
    assertThat(configurations.get(Constants.ARCHITECTURE).getOption(Property.DISPLAY_NAME), is("Architecture"));
    assertThat(configurations.get(Constants.ARCHITECTURE).getOption(Property.DISPLAY_ORDER), is(2));
}
 
开发者ID:gocd-contrib,项目名称:deb-repo-poller,代码行数:23,代码来源:DebRepositoryConfigurationTest.java

示例11: shouldFailValidationIfSpuriousPropertiesAreConfigured

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
@Test
public void shouldFailValidationIfSpuriousPropertiesAreConfigured() {
    ValidationResult validationResult = new ValidationResult();
    PackageConfiguration packageConfigurations = new PackageConfiguration();
    RepositoryConfiguration repositoryConfiguration = new RepositoryConfiguration();
    packageConfigurations.add(new PackageMaterialProperty("PACKAGE_NAME", "foo"));
    packageConfigurations.add(new PackageMaterialProperty("foo1", "foo"));
    packageConfigurations.add(new PackageMaterialProperty("foo2", "foo"));
    repositoryConfiguration.add(new PackageMaterialProperty("bar1", "bar"));
    repositoryConfiguration.add(new PackageMaterialProperty("bar2", "bar"));
    repositoryConfiguration.add(new PackageMaterialProperty("REPO_URL", "http://asdsa"));
    new DebRepositoryConfiguration().validate(packageConfigurations, repositoryConfiguration, validationResult);
    assertThat(validationResult.isSuccessful(), is(false));
    assertThat(validationResult.getErrors().contains(new ValidationError("", "Unsupported key(s) found : bar1, bar2. Allowed key(s) are : REPO_URL")), is(true));
    assertThat(validationResult.getErrors().contains(new ValidationError("", "Unsupported key(s) found : foo1, foo2. Allowed key(s) are : PACKAGE_NAME, VERSION_SPEC, ARCHITECTURE")), is(true));
}
 
开发者ID:gocd-contrib,项目名称:deb-repo-poller,代码行数:17,代码来源:DebRepositoryConfigurationTest.java

示例12: shouldThrowExceptionGivenEmptyRepo_getLatestRevision

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
@Test
public void shouldThrowExceptionGivenEmptyRepo_getLatestRevision() throws Exception {
    RepositoryConfiguration repositoryPackageConfigurations = new RepositoryConfiguration();
    File emptyRepo = new File(getClass().getResource("/repos/emptyrepo").toURI());
    repositoryPackageConfigurations.add(new PackageMaterialProperty(Constants.REPO_URL, "file://" + emptyRepo.getAbsolutePath()));
    PackageConfiguration packagePackageConfigurations = new PackageConfiguration();
    packagePackageConfigurations.add(new PackageMaterialProperty(Constants.PACKAGE_NAME, "crap-artifact"));
    try {
        poller.getLatestRevision(packagePackageConfigurations, repositoryPackageConfigurations);
        fail("");
    } catch (RuntimeException e) {
        String expectedMessage = "Invalid file path.";
        String actualMessage = e.getMessage();
        assertThat(actualMessage.startsWith(expectedMessage), is((true)));
    }
}
 
开发者ID:gocd-contrib,项目名称:deb-repo-poller,代码行数:17,代码来源:DebRepositoryPollerTest.java

示例13: getPackageConfiguration

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
@Override
public PackageConfiguration getPackageConfiguration() {
    LOGGER.debug("getPackageConfiguration called.");
    PackageConfiguration packageConfig = new PackageConfiguration();

    packageConfig.add(space);
    packageConfig.add(appName);
    packageConfig.add(orgName);
    return packageConfig;
}
 
开发者ID:Sounie,项目名称:springer-gocd-cloudfoundry-plugin,代码行数:11,代码来源:CloudFoundryConfig.java

示例14: checkConnectionToPackage

import com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration; //导入依赖的package包/类
@Override
public Result checkConnectionToPackage(PackageConfiguration packageConfiguration, RepositoryConfiguration repositoryConfiguration) {
    CloudFoundryClient client = getClient(repositoryConfiguration);

    Result result = new Result();

    final String appNamePrefix = packageConfiguration.get("APP_NAME").getValue();
        if (lookupAppNames(client, appNamePrefix).isEmpty()) {
            LOGGER.warn("No app found.");
            result = ExecutionResult.failure("No such app found in CloudFoundry.");
        }

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

示例15: getLatestRevision

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


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