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