use of org.sonarqube.ws.client.rule.SearchWsRequest in project sonarqube by SonarSource.
the class SearchAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
try (DbSession dbSession = dbClient.openSession(false)) {
SearchWsRequest searchWsRequest = toSearchWsRequest(request);
SearchOptions context = buildSearchOptions(searchWsRequest);
RuleQuery query = ruleQueryFactory.createRuleQuery(request);
SearchResult searchResult = doSearch(dbSession, query, context);
SearchResponse responseBuilder = buildResponse(dbSession, searchWsRequest, context, searchResult, query);
writeProtobuf(responseBuilder, request, response);
}
}
use of org.sonarqube.ws.client.rule.SearchWsRequest in project sonarqube by SonarSource.
the class ClusterTest method secondary_nodes_do_not_write_to_datastores_at_startup.
/**
* SONAR-7899
*/
@Test
public void secondary_nodes_do_not_write_to_datastores_at_startup() throws Exception {
// start "startup leader", which creates and populates datastores
Orchestrator orchestrator = Orchestrator.builderEnv().setServerProperty("sonar.cluster.enabled", "true").setServerProperty("sonar.cluster.name", "secondary_nodes_do_not_write_to_datastores_at_startup").setServerProperty("sonar.cluster.web.startupLeader", "true").setServerProperty("sonar.log.level", "TRACE").addPlugin(ItUtils.xooPlugin()).build();
orchestrator.start();
expectLog(orchestrator, "Cluster enabled (startup leader)");
expectWriteOperations(orchestrator, true);
// verify that datastores are populated by requesting rules
assertThat(newWsClient(orchestrator).rules().search(new SearchWsRequest()).getTotal()).isGreaterThan(0);
FileUtils.write(orchestrator.getServer().getWebLogs(), "", false);
updateSonarPropertiesFile(orchestrator, ImmutableMap.of("sonar.cluster.web.startupLeader", "false"));
orchestrator.restartServer();
expectLog(orchestrator, "Cluster enabled (startup follower)");
expectWriteOperations(orchestrator, false);
orchestrator.stop();
}
Aggregations