本文整理汇总了Java中org.sonarqube.ws.client.WsClientFactories类的典型用法代码示例。如果您正苦于以下问题:Java WsClientFactories类的具体用法?Java WsClientFactories怎么用?Java WsClientFactories使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WsClientFactories类属于org.sonarqube.ws.client包,在下文中一共展示了WsClientFactories类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forEachIssue
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
/**
* Loop over issues.
*
* @param localConnector
* local connector
* @param searchIssuesRequest
* search request
* @param consumer
* callback called for each issues
*/
public static void forEachIssue(final LocalConnector localConnector, final SearchWsRequest searchIssuesRequest,
final BiConsumer<SearchWsResponse, Issue> consumer) {
// Loop through all issues of the project
final WsClient wsClient = WsClientFactories.getLocal().newClient(localConnector);
boolean doNextPage = true;
while (doNextPage) {
LOGGER.debug("Listing issues for project {}; page {}", searchIssuesRequest.getProjectKeys(),
searchIssuesRequest.getPage());
final SearchWsResponse searchIssuesResponse = wsClient.issues().search(searchIssuesRequest);
for (final Issue issue : searchIssuesResponse.getIssuesList()) {
consumer.accept(searchIssuesResponse, issue);
}
doNextPage = searchIssuesResponse.getPaging().getTotal() > (searchIssuesResponse.getPaging().getPageIndex()
* searchIssuesResponse.getPaging().getPageSize());
searchIssuesRequest.setPage(searchIssuesResponse.getPaging().getPageIndex() + 1);
searchIssuesRequest.setPageSize(searchIssuesResponse.getPaging().getPageSize());
}
}
示例2: resolveIssues
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
/**
* Resolve issues.
*
* @param localConnector
* local connector
* @param importResult
* result
* @param preview
* true if issues should not be actually resolved.
* @param skipAssign
* if true, no assignments will be done
* @param skipComments
* if true, no comments will be added
* @param projectKey
* project key
* @param issues
* issues
*/
public static void resolveIssues(final LocalConnector localConnector, final ImportResult importResult,
final boolean preview, final boolean skipAssign, final boolean skipComments, final String projectKey,
final Map<IssueKey, IssueData> issues) {
// Read issues from project, match and resolve
importResult.setPreview(preview);
final WsClient wsClient = WsClientFactories.getLocal().newClient(localConnector);
// Loop through all issues of the project
final SearchWsRequest searchIssuesRequest = SearchHelper.findIssuesForImport(projectKey);
forEachIssue(localConnector, searchIssuesRequest, (searchIssuesResponse, issue) -> {
final IssueKey key = IssueKey.fromIssue(issue, searchIssuesResponse.getComponentsList());
LOGGER.debug("Try to match issue: {}", key);
// Match with issue from data
final IssueData data = issues.remove(key);
if (data != null) {
importResult.registerMatchedIssue();
// Handle issue, if data is found
handleTransition(wsClient.wsConnector(), issue, data.getStatus(), data.getResolution(), preview,
importResult);
if (!skipAssign) {
handleAssignee(wsClient.wsConnector(), issue, data.getAssignee(), preview, importResult);
}
if (!skipComments) {
handleComments(wsClient.wsConnector(), issue, data.getComments(), preview, importResult);
}
}
});
}
示例3: TestMetricsIntegrationJUnit2Test
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
public TestMetricsIntegrationJUnit2Test(Orchestrator orchestrator) {
orchestrator.executeBuild(build);
wsClient = new TestSonarClient(
WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(orchestrator.getServer().getUrl())
.build()), PROJECT_KEY);
}
示例4: ProjectMetricsIntegrationTest
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
public ProjectMetricsIntegrationTest(Orchestrator orchestrator) {
orchestrator.executeBuild(build);
wsClient = new TestSonarClient(
WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(orchestrator.getServer().getUrl())
.build()), PROJECT_KEY);
}
示例5: PerlCriticIntegrationTest
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
public PerlCriticIntegrationTest(Orchestrator orchestrator) {
orchestrator.executeBuild(build);
wsClient = new TestSonarClient(
WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(orchestrator.getServer().getUrl())
.build()), PROJECT_KEY);
}
示例6: TestMetricsIntegrationTest
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
public TestMetricsIntegrationTest(Orchestrator orchestrator) {
orchestrator.executeBuild(build);
wsClient = new TestSonarClient(
WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(orchestrator.getServer().getUrl())
.build()), PROJECT_KEY);
}
示例7: TestMetricsIntegrationJUnit1Test
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
public TestMetricsIntegrationJUnit1Test(Orchestrator orchestrator) {
orchestrator.executeBuild(build);
wsClient = new TestSonarClient(
WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(orchestrator.getServer().getUrl())
.build()), PROJECT_KEY);
}
示例8: newAdminWsClient
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
public static WsClient newAdminWsClient(Orchestrator orchestrator) {
Server server = orchestrator.getServer();
return WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(server.getUrl())
.credentials(Server.ADMIN_LOGIN, Server.ADMIN_PASSWORD)
.build());
}
示例9: handle
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
@Override
public void handle(final Request request, final Response response) throws Exception {
if (this.settings.getBoolean(BadgesPluginProperties.GATE_BADGES_ACTIVATION_KEY)) {
final String key = request.mandatoryParam("key");
final SVGImageTemplate template = request.mandatoryParamAsEnum("template", SVGImageTemplate.class);
final boolean blinkingValueBackgroundColor = request.mandatoryParamAsBoolean("blinking");
final WsClient wsClient = WsClientFactories.getLocal()
.newClient(request.localConnector());
LOGGER.debug("Retrieving quality gate status for key '{}'.", key);
QualityGateBadge status = QualityGateBadge.NOT_FOUND;
try {
final ProjectStatusWsRequest wsRequest = new ProjectStatusWsRequest();
wsRequest.setProjectKey(key);
final ProjectStatusWsResponse wsResponse = wsClient.qualityGates()
.projectStatus(wsRequest);
status = QualityGateBadge.valueOf(wsResponse.getProjectStatus()
.getStatus()
.toString());
} catch (final HttpException e) {
LOGGER.debug("No project found with key '{}': {}", key, e);
}
// we prepare the response OutputStream
final OutputStream responseOutputStream = response.stream()
.setMediaType("image/svg+xml")
.output();
LOGGER.debug("Retrieving SVG image for for quality gate status '{}'.", status);
final InputStream svgImageInputStream = this.qualityGateBadgeGenerator.svgImageInputStreamFor(status, template, blinkingValueBackgroundColor);
LOGGER.debug("Writing SVG image to response OutputStream.");
IOUtils.copy(svgImageInputStream, responseOutputStream);
responseOutputStream.close();
// don't close svgImageInputStream, we want it to be reusable
} else {
LOGGER.warn("Received a gate badge request, but webservice is turned off.");
response.noContent();
}
}
开发者ID:QualInsight,项目名称:qualinsight-plugins-sonarqube-badges,代码行数:38,代码来源:QualityGateBadgeRequestHandler.java
示例10: handle
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
@Override
public void handle(final Request request, final Response response) throws Exception {
if (this.settings.getBoolean(BadgesPluginProperties.MEASURE_BADGES_ACTIVATION_KEY)) {
final String key = request.mandatoryParam("key");
final String metric = request.mandatoryParam("metric");
final SVGImageTemplate template = request.mandatoryParamAsEnum("template", SVGImageTemplate.class);
final boolean blinkingValueBackgroundColor = request.mandatoryParamAsBoolean("blinking");
final WsClient wsClient = WsClientFactories.getLocal()
.newClient(request.localConnector());
LOGGER.debug("Retrieving measure for key '{}' and metric {}.", key, metric);
MeasureHolder measureHolder;
try {
measureHolder = retrieveMeasureHolder(wsClient, key, metric);
measureHolder = applyQualityGateTreshold(wsClient, key, metric, measureHolder);
} catch (final HttpException e) {
LOGGER.debug("No project found with key '{}': {}", key, e);
measureHolder = new MeasureHolder(metric);
}
// we prepare the response OutputStream
final OutputStream responseOutputStream = response.stream()
.setMediaType("image/svg+xml")
.output();
LOGGER.debug("Retrieving SVG image for metric holder '{}'.", measureHolder);
final InputStream svgImageInputStream = this.measureBadgeGenerator.svgImageInputStreamFor(measureHolder, template, blinkingValueBackgroundColor);
LOGGER.debug("Writing SVG image to response OutputStream.");
IOUtils.copy(svgImageInputStream, responseOutputStream);
responseOutputStream.close();
// don't close svgImageInputStream, we want it to be reusable
} else {
LOGGER.warn("Received a measure badge request, but webservice is turned off.");
response.noContent();
}
}
开发者ID:QualInsight,项目名称:qualinsight-plugins-sonarqube-badges,代码行数:34,代码来源:MeasureBadgeRequestHandler.java
示例11: retrieveCeActivityBadge
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
private CeActivityBadge retrieveCeActivityBadge(final Request request, final String key) {
CeActivityBadge ceActivityBadge = CeActivityBadge.NOT_FOUND;
try {
final WsClient wsClient = WsClientFactories.getLocal()
.newClient(request.localConnector());
final ActivityWsRequest wsRequest = new ActivityWsRequest();
wsRequest.setQuery(key);
wsRequest.setOnlyCurrents(true);
final CeService ceService = wsClient.ce();
final ActivityResponse activityResponse = ceService.activity(wsRequest);
if (activityResponse.getTasksCount() >= 1) {
// The task are ordered by date. 0 is the most recent.
final Task task = activityResponse.getTasks(0);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("CeActivity Task Information");
LOGGER.debug("CeActivity Task - id: " + task.getId());
LOGGER.debug("CeActivity Task - type: " + task.getType());
LOGGER.debug("CeActivity Task - componentId: " + task.getComponentId());
LOGGER.debug("CeActivity Task - componentKey: " + task.getComponentKey());
LOGGER.debug("CeActivity Task - componentName: " + task.getComponentName());
LOGGER.debug("CeActivity Task - componentQualifier: " + task.getComponentQualifier());
LOGGER.debug("CeActivity Task - analysisId: " + task.getAnalysisId());
LOGGER.debug("CeActivity Task - status: " + task.getStatus());
LOGGER.debug("CeActivity Task - submittedAt: " + task.getSubmittedAt());
LOGGER.debug("CeActivity Task - submitterLogin: " + task.getSubmitterLogin());
LOGGER.debug("CeActivity Task - startedAt: " + task.getStartedAt());
LOGGER.debug("CeActivity Task - executedAt: " + task.getExecutedAt());
LOGGER.debug("CeActivity Task - executionTimeMs: " + task.getExecutionTimeMs());
}
// status of the activity
ceActivityBadge = CeActivityBadge.valueOf(task.getStatus()
.toString());
}
} catch (final HttpException e) {
LOGGER.debug("No project found with key '{}': {}", key, e);
}
return ceActivityBadge;
}
开发者ID:QualInsight,项目名称:qualinsight-plugins-sonarqube-badges,代码行数:39,代码来源:CeActivityBadgeRequestHandler.java
示例12: newWsClient
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
static WsClient newWsClient() {
return WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(ORCHESTRATOR.getServer().getUrl())
.build());
}
示例13: newWsClient
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
static WsClient newWsClient() {
return WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(orchestrator.getServer().getUrl())
.build());
}
示例14: newWsClient
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
private static WsClient newWsClient() {
return WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(ORCHESTRATOR.getServer().getUrl())
.build());
}
示例15: newWsClient
import org.sonarqube.ws.client.WsClientFactories; //导入依赖的package包/类
protected static WsClient newWsClient(@Nullable String login, @Nullable String password) {
return WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
.url(ORCHESTRATOR.getServer().getUrl())
.credentials(login, password)
.build());
}