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


Java Result.withErrorMessages方法代码示例

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


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

示例1: checkConnectionToRepository

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

示例2: checkConnectionToRepository

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

示例3: shouldHandleErrorDuringPluginNotificationCorrectly

import com.thoughtworks.go.plugin.api.response.Result; //导入方法依赖的package包/类
@Test
public void shouldHandleErrorDuringPluginNotificationCorrectly() throws Exception {
    Result result = new Result();
    result.withErrorMessages(asList(new String[]{"message 1", "message 2"}));

    when(notificationPluginRegistry.getPluginsInterestedIn(PIPELINE_STATUS)).thenReturn(new LinkedHashSet<>(asList(PLUGIN_ID_1)));

    when(notificationExtension.notify(PLUGIN_ID_1, PIPELINE_STATUS, REQUEST_BODY)).thenReturn(result);
    when(serverHealthService.update(serverHealthState.capture())).thenReturn(null);

    PluginNotificationService pluginNotificationService = new PluginNotificationService(notificationExtension, notificationPluginRegistry, serverHealthService);
    pluginNotificationService.notifyPlugins(new PluginNotificationMessage(PIPELINE_STATUS, REQUEST_BODY));

    verify(notificationExtension).notify(PLUGIN_ID_1, PIPELINE_STATUS, REQUEST_BODY);
    assertThat(serverHealthState.getValue().getMessage(), is("Notification update failed for plugin: plugin-id-1"));
    assertThat(serverHealthState.getValue().getDescription(), is("message 1, message 2"));
    verify(serverHealthService, never()).removeByScope(any(HealthStateScope.class));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:19,代码来源:PluginNotificationServiceTest.java


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