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


Java Result.isSuccessful方法代码示例

本文整理汇总了Java中com.thoughtworks.go.plugin.api.response.Result.isSuccessful方法的典型用法代码示例。如果您正苦于以下问题:Java Result.isSuccessful方法的具体用法?Java Result.isSuccessful怎么用?Java Result.isSuccessful使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thoughtworks.go.plugin.api.response.Result的用法示例。


在下文中一共展示了Result.isSuccessful方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkConnectionToRepository

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的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

示例2: checkConnectionToPackage

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的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

示例3: checkConnection

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
public void checkConnection(final PackageDefinition packageDefinition, final LocalizedOperationResult result) {
    try {
        String pluginId = packageDefinition.getRepository().getPluginConfiguration().getId();


        Result checkConnectionResult = packageRepositoryExtension.checkConnectionToPackage(pluginId, buildPackageConfigurations(packageDefinition), buildRepositoryConfigurations(packageDefinition.getRepository()));
        String messages = checkConnectionResult.getMessagesForDisplay();
        if (!checkConnectionResult.isSuccessful()) {
            result.connectionError(LocalizedMessage.string("PACKAGE_CHECK_FAILED", messages));
            return;
        }
        result.setMessage(LocalizedMessage.string("PACKAGE_CHECK_OK", messages));
        return;
    } catch (Exception e) {
        result.internalServerError(LocalizedMessage.string("PACKAGE_CHECK_FAILED", e.getMessage()));
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:PackageDefinitionService.java

示例4: checkConnectionToPackage

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
public Result checkConnectionToPackage(PackageConfiguration packageConfigurations, RepositoryConfiguration repositoryPackageConfigurations) {
    Result checkConnectionResult = checkConnectionToRepository(repositoryPackageConfigurations);
    if (!checkConnectionResult.isSuccessful()) {
        return checkConnectionResult;
    }
    try {
        Result packageConfigurationValidationResult = packageValidation(packageConfigurations, repositoryPackageConfigurations);
        if (!packageConfigurationValidationResult.isSuccessful()) {
            return packageConfigurationValidationResult;
        }
        PackageRevision latestRevision = getLatestRevision(packageConfigurations, repositoryPackageConfigurations);
        return new Result().withSuccessMessages(String.format("Found package '%s'.", latestRevision.getRevision()));
    } catch (Exception e) {
        LOGGER.warn(String.format("[Deb Repo Check Connection] Check connection to package failed with exception - %s", e));
        return new Result().withErrorMessages("Could not find any package that matched requirements.");
    }
}
 
开发者ID:gocd-contrib,项目名称:deb-repo-poller,代码行数:18,代码来源:DebRepositoryPoller.java

示例5: checkConnectionToPackage

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
@Override
public Result checkConnectionToPackage(PackageConfiguration packageConfigs, RepositoryConfiguration repoConfigs) {
    Result response = checkConnectionToRepository(repoConfigs);
    if (!response.isSuccessful()) {
        LOGGER.info(response.getMessagesForDisplay());
        return response;
    }
    PackageRevision packageRevision = getLatestRevision(packageConfigs, repoConfigs);
    response.withSuccessMessages("Found " + packageRevision.getRevision());
    return response;
}
 
开发者ID:varchev,项目名称:go-npm-poller,代码行数:12,代码来源:NpmPoller.java

示例6: checkout

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
@Override
public void checkout(PluggableSCMMaterial material, File baseDir, Revision revision, SubprocessExecutionContext execCtx) {
    SCMPropertyConfiguration scmPropertyConfiguration = buildSCMPropertyConfigurations(material.getScmConfig());
    MaterialInstance materialInstance = materialRepository.findMaterialInstance(material);
    PluggableSCMMaterialRevision pluggableSCMMaterialRevision = (PluggableSCMMaterialRevision) revision;
    SCMRevision scmRevision = new SCMRevision(
            pluggableSCMMaterialRevision.getRevision(),
            pluggableSCMMaterialRevision.getTimestamp(), null, null,
            pluggableSCMMaterialRevision.getData(), null);
    Result result = scmExtension.checkout(material.getPluginId(), scmPropertyConfiguration, baseDir.getAbsolutePath(), scmRevision);
    if(!result.isSuccessful())
        throw new RuntimeException("Failed to perform checkout on pluggable SCM");
}
 
开发者ID:gocd,项目名称:gocd,代码行数:14,代码来源:PluggableSCMMaterialPoller.java

示例7: checkConnection

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
public void checkConnection(final PackageRepository packageRepository, final LocalizedOperationResult result) {
    try {
        Result checkConnectionResult = packageRepositoryExtension.checkConnectionToRepository(packageRepository.getPluginConfiguration().getId(), populateConfiguration(packageRepository.getConfiguration()));
        String messages = checkConnectionResult.getMessagesForDisplay();
        if (!checkConnectionResult.isSuccessful()) {
            result.connectionError(LocalizedMessage.string("CHECK_CONNECTION_FAILED", "package repository", messages));
            return;
        }
        result.setMessage(LocalizedMessage.string("CONNECTION_OK", messages));
        return;
    } catch (Exception e) {
        result.internalServerError(LocalizedMessage.string("CHECK_CONNECTION_FAILED", "package repository", e.getMessage()));
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:15,代码来源:PackageRepositoryService.java

示例8: prepare

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
@Override
public void prepare() {
    PluggableSCMMaterial material = (PluggableSCMMaterial) revision.getMaterial();
    Modification latestModification = revision.getLatestModification();
    SCMRevision scmRevision = new SCMRevision(latestModification.getRevision(), latestModification.getModifiedTime(), null, null, latestModification.getAdditionalDataMap(), null);
    File destinationFolder = material.workingDirectory(workingDirectory);
    Result result = scmExtension.checkout(material.getScmConfig().getPluginConfiguration().getId(), buildSCMPropertyConfigurations(material.getScmConfig()), destinationFolder.getAbsolutePath(), scmRevision);
    if (!result.isSuccessful()) {
        // handle
    }
    // handle messages
}
 
开发者ID:gocd,项目名称:gocd,代码行数:13,代码来源:PluggableSCMMaterialAgent.java

示例9: checkConnectionToRepository

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
public Result checkConnectionToRepository(RepositoryConfiguration repositoryPackageConfiguration) {
    Result repositoryValidationResult = repositoryValidation(repositoryPackageConfiguration);
    if (!repositoryValidationResult.isSuccessful()) {
        return repositoryValidationResult;
    }
    RepoUrl url = repoUrl(repositoryPackageConfiguration);
    try {
        url.checkConnection();
        return new Result().withSuccessMessages(String.format("Successfully accessed repository metadata at %s", url.getRepoMetadataUrl()));
    } catch (Exception e) {
        LOGGER.warn(String.format("[Deb Repo Check Connection] Check connection for %s failed with exception - %s", url.getRepoMetadataUrl(), e));
        return new Result().withErrorMessages(String.format("Could not access file - %s. %s", url.getRepoMetadataUrl(), e.getMessage()));
    }
}
 
开发者ID:gocd-contrib,项目名称:deb-repo-poller,代码行数:15,代码来源:DebRepositoryPoller.java


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