本文整理汇总了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;
}
示例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);
}
}
示例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()));
}
}
示例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.");
}
}
示例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;
}
示例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");
}
示例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()));
}
}
示例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
}
示例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()));
}
}