}
private void verifyQGStatusInPostTask(BuildResult buildResult, String taskStatus, String qgStatus) throws IOException {
- List<String> logsLines = FileUtils.readLines(orchestrator.getServer().getLogs(), Charsets.UTF_8);
+ List<String> logsLines = FileUtils.readLines(orchestrator.getServer().getCeLogs(), Charsets.UTF_8);
List<String> postTaskLogLines = extractPosttaskPluginLogs(extractCeTaskId(buildResult), logsLines);
assertThat(postTaskLogLines).hasSize(1);
// verify that datastores are populated by requesting rules
assertThat(newWsClient(orchestrator).rules().search(new SearchWsRequest()).getTotal()).isGreaterThan(0);
- FileUtils.write(orchestrator.getServer().getLogs(), "", false);
+ FileUtils.write(orchestrator.getServer().getWebLogs(), "", false);
updateSonarPropertiesFile(orchestrator, ImmutableMap.of("sonar.cluster.web.startupLeader", "false"));
orchestrator.restartServer();
.build();
elasticsearch.start();
assertThat(esWatcher.port).isGreaterThan(0);
- assertThat(FileUtils.readFileToString(elasticsearch.getServer().getLogs())).doesNotContain("Process[web]");
+ assertThat(FileUtils.readFileToString(elasticsearch.getServer().getAppLogs())).doesNotContain("Process[web]");
web = Orchestrator.builderEnv()
.setServerProperty("sonar.cluster.enabled", "true")
String coreId = getPropertyValue(web, "sonar.core.id");
String startTime = getPropertyValue(web, "sonar.core.startTime");
- assertThat(FileUtils.readFileToString(elasticsearch.getServer().getLogs())).doesNotContain("Process[es]");
+ assertThat(FileUtils.readFileToString(elasticsearch.getServer().getAppLogs())).doesNotContain("Process[es]");
// call a web service that requires Elasticsearch
Issues.SearchWsResponse wsResponse = ItUtils.newWsClient(web).issues().search(new org.sonarqube.ws.client.issue.SearchWsRequest());
assertThat(wsResponse.getIssuesCount()).isEqualTo(0);
}
private static void expectLog(Orchestrator orchestrator, String expectedLog) throws IOException {
- File logFile = orchestrator.getServer().getLogs();
+ File logFile = orchestrator.getServer().getWebLogs();
try (Stream<String> lines = Files.lines(logFile.toPath())) {
assertThat(lines.anyMatch(s -> StringUtils.containsIgnoreCase(s, expectedLog))).isTrue();
}
}
private static void expectWriteOperations(Orchestrator orchestrator, boolean expected) throws IOException {
- try (Stream<String> lines = Files.lines(orchestrator.getServer().getLogs().toPath())) {
+ try (Stream<String> lines = Files.lines(orchestrator.getServer().getWebLogs().toPath())) {
List<String> writeOperations = lines.filter(ClusterTest::isWriteOperation).collect(Collectors.toList());
if (expected) {
assertThat(writeOperations).isNotEmpty();
// we just wait five seconds, for a lack of a better approach to waiting for the restart process to start in SQ
Thread.sleep(5000);
- assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs()))
+ assertThat(FileUtils.readFileToString(orchestrator.getServer().getWebLogs()))
.contains("SonarQube restart requested by big");
}
}
orchestrator.start();
newAdminWsClient(orchestrator).system().restart();
- assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs()))
+ assertThat(FileUtils.readFileToString(orchestrator.getServer().getWebLogs()))
.contains("Fast restarting WebServer...")
.contains("WebServer restarted");
}
orchestrator.start();
fail();
} catch (Exception e) {
- assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs())).contains(
+ assertThat(FileUtils.readFileToString(orchestrator.getServer().getWebLogs())).contains(
"Plugin incompatible-plugin [incompatibleplugin] requires at least SonarQube 100");
}
}
File tempDir = new File(orchestrator.getServer().getHome(), "temp/tmp");
- String logs = FileUtils.readFileToString(orchestrator.getServer().getLogs());
+ String logs = FileUtils.readFileToString(orchestrator.getServer().getWebLogs());
assertThat(logs).contains("Creating temp directory: " + tempDir.getAbsolutePath() + File.separator + "sonar-it");
assertThat(logs).contains("Creating temp file: " + tempDir.getAbsolutePath() + File.separator + "sonar-it");
private static void waitForComputeEngineToBeUp(Orchestrator orchestrator) throws IOException {
for (int i = 0; i < 10_000; i++) {
- File logs = orchestrator.getServer().getLogs();
+ File logs = orchestrator.getServer().getCeLogs();
if (FileUtils.readFileToString(logs).contains("Compute Engine is up")) {
return;
}
@Test
public void global_property_change_extension_point() throws IOException {
SETTINGS.set(SetRequest.builder().setKey("globalPropertyChange.received").setValue("NEWVALUE").build());
- assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs())).contains("Received change: [key=globalPropertyChange.received, newValue=NEWVALUE]");
+ assertThat(FileUtils.readFileToString(orchestrator.getServer().getWebLogs()))
+ .contains("Received change: [key=globalPropertyChange.received, newValue=NEWVALUE]");
}
@Test
new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("fail_to_authenticate_when_not_allowed_to_sign_up",
"/user/BaseIdentityProviderTest/fail_to_authenticate_when_not_allowed_to_sign_up.html").build()).runOn(ORCHESTRATOR);
- File logFile = ORCHESTRATOR.getServer().getLogs();
+ File logFile = ORCHESTRATOR.getServer().getWebLogs();
assertThat(FileUtils.readFileToString(logFile)).doesNotContain("A functional error has happened");
assertThat(FileUtils.readFileToString(logFile)).doesNotContain("UnauthorizedException");
assertThat(response.code()).isEqualTo(200);
assertThat(response.body().string()).contains("You're not authorized to access this page. Please contact the administrator");
- List<String> logsLines = FileUtils.readLines(orchestrator.getServer().getLogs(), Charsets.UTF_8);
+ List<String> logsLines = FileUtils.readLines(orchestrator.getServer().getWebLogs(), Charsets.UTF_8);
assertThat(logsLines).doesNotContain("org.sonar.server.exceptions.BadRequestException: user.bad_login");
USER_RULE.verifyUserDoesNotExist(USER_LOGIN);
}
*/
package util;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.sonar.orchestrator.Orchestrator;
import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
import javax.annotation.Nullable;
import org.apache.commons.io.FileUtils;
import org.json.simple.JSONArray;
import org.sonarqube.ws.client.setting.SetRequest;
import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.FluentIterable.from;
import static com.sonar.orchestrator.container.Server.ADMIN_LOGIN;
import static com.sonar.orchestrator.container.Server.ADMIN_PASSWORD;
-import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
if (properties == null || properties.length == 0) {
return str;
}
- return from(Iterables.concat(asList(properties), asList(str))).toArray(String.class);
+ return Stream.concat(Arrays.stream(properties), Arrays.stream(str))
+ .toArray(String[]::new);
}
public static void verifyHttpException(Exception e, int expectedCode) {
public static List<String> extractCeTaskIds(BuildResult buildResult) {
String logs = buildResult.getLogs();
- return from(LINE_SPLITTER.split(logs))
- .filter(new Predicate<String>() {
- @Override
- public boolean apply(String s) {
- return s.contains("More about the report processing at");
- }
- }).transform(new Function<String, String>() {
- @Nullable
- @Override
- public String apply(String s) {
- return s.substring(s.length() - 20, s.length());
- }
- }).toList();
+ return StreamSupport.stream(LINE_SPLITTER.split(logs).spliterator(), false)
+ .filter(s -> s.contains("More about the report processing at"))
+ .map(s -> s.substring(s.length() - 20, s.length()))
+ .collect(Collectors.toList());
}
public static Map<String, Object> jsonToMap(String json) {
<slf4j.version>1.7.21</slf4j.version>
<tomcat.version>8.0.32</tomcat.version>
<elasticsearch.version>2.3.5</elasticsearch.version>
- <orchestrator.version>3.13-build640</orchestrator.version>
+ <orchestrator.version>3.13-build783</orchestrator.version>
<okhttp.version>3.3.1</okhttp.version>
<jackson.version>2.6.6</jackson.version>
}
public static void clear(Orchestrator orch) throws IOException {
- if (orch.getServer() != null && orch.getServer().getLogs() != null) {
- FileUtils.write(orch.getServer().getLogs(), "", false);
+ if (orch.getServer() != null && orch.getServer().getCeLogs() != null) {
+ FileUtils.write(orch.getServer().getCeLogs(), "", false);
}
}
* 2015.09.29 16:57:45 INFO ce[o.s.s.c.q.CeWorkerRunnableImpl] Executed task | project=com.github.kevinsawicki:http-request-parent | id=AVAZm9oHIXrp54OmOeQe | time=2283ms
*/
public static Long extractComputationTotalTime(Orchestrator orchestrator) throws IOException {
- File report = orchestrator.getServer().getLogs();
+ File report = orchestrator.getServer().getCeLogs();
List<String> logsLines = FileUtils.readLines(report, Charsets.UTF_8);
return extractComputationTotalTime(logsLines);
}
}
private static List<String> readLogLines(Orchestrator orchestrator) throws IOException {
- return FileUtils.readLines(orchestrator.getServer().getLogs());
+ return FileUtils.readLines(orchestrator.getServer().getCeLogs());
}
}