use of org.sonarsource.sonarlint.daemon.proto.SonarlintDaemon.AnalysisReq in project sonarlint-core by SonarSource.
the class StandaloneDaemonTest method test.
@Test
public void test() throws InterruptedException, IOException {
LogCollector logs = new LogCollector();
StandaloneSonarLintBlockingStub sonarlint = StandaloneSonarLintGrpc.newBlockingStub(channel);
AnalysisReq analysisConfig = createAnalysisConfig("sample-javascript");
long start = System.currentTimeMillis();
ClientCall<Void, LogEvent> call = getLogs(logs, channel);
try {
for (int i = 0; i < 10; i++) {
System.out.println("ITERATION: " + i);
Iterator<Issue> issues = sonarlint.analyze(analysisConfig);
assertThat(issues).hasSize(1);
// Give some time for logs to come
Thread.sleep(500);
List<String> logsLines = logs.getLogsAndClear();
// To be sure logs are not flooded by low level logs
assertThat(logsLines.size()).isLessThan(100);
assertThat(logsLines).contains("1 files indexed");
}
} finally {
call.cancel("no more logs needed", null);
}
System.out.println("TIME " + (System.currentTimeMillis() - start));
}
Aggregations