aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GenericApplicationHttpClientTest.java15
-rw-r--r--server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GithubApplicationClientImplTest.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStepIT.java6
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImplTest.java3
-rw-r--r--server/sonar-ce/src/it/java/org/sonar/ce/taskprocessor/CeWorkerImplIT.java5
-rw-r--r--server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java7
-rw-r--r--server/sonar-server-common/src/it/java/org/sonar/server/es/BulkIndexerIT.java5
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java13
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartupTest.java3
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java49
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java12
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java13
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scm/git/GitIgnoreCommandTest.java19
13 files changed, 70 insertions, 83 deletions
diff --git a/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GenericApplicationHttpClientTest.java b/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GenericApplicationHttpClientTest.java
index 8accc121408..bbcf2c97014 100644
--- a/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GenericApplicationHttpClientTest.java
+++ b/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GenericApplicationHttpClientTest.java
@@ -42,7 +42,6 @@ import org.sonar.alm.client.DevopsPlatformHeaders;
import org.sonar.alm.client.GenericApplicationHttpClient;
import org.sonar.alm.client.TimeoutConfiguration;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.auth.github.security.AccessToken;
import org.sonar.auth.github.security.UserAccessToken;
@@ -62,7 +61,7 @@ public class GenericApplicationHttpClientTest {
public MockWebServer server = new MockWebServer();
@ClassRule
- public static LogTester logTester = new LogTester().setLevel(LoggerLevel.WARN);
+ public static LogTester logTester = new LogTester().setLevel(Level.WARN);
private GenericApplicationHttpClient underTest;
@@ -185,7 +184,7 @@ public class GenericApplicationHttpClientTest {
public void get_returns_empty_endPoint_when_link_header_does_not_have_next_rel() throws IOException {
server.enqueue(new MockResponse().setBody(randomBody)
.setHeader("link", "<https://api.github.com/installation/repositories?per_page=5&page=4>; rel=\"prev\", " +
- "<https://api.github.com/installation/repositories?per_page=5&page=1>; rel=\"first\""));
+ "<https://api.github.com/installation/repositories?per_page=5&page=1>; rel=\"first\""));
GetResponse response = underTest.get(appUrl, accessToken, randomEndPoint);
@@ -223,7 +222,7 @@ public class GenericApplicationHttpClientTest {
GetResponse response = underTest.get(appUrl, accessToken, randomEndPoint);
assertThat(response.getNextEndPoint()).contains("https://gitlab.com/api/v4/groups?all_available=false"
- + "&order_by=name&owned=false&page=2&per_page=2&sort=asc&statistics=false&with_custom_attributes=false");
+ + "&order_by=name&owned=false&page=2&per_page=2&sort=asc&statistics=false&with_custom_attributes=false");
}
@DataProvider
@@ -232,12 +231,12 @@ public class GenericApplicationHttpClientTest {
return new Object[][] {
{"<" + expected + ">; rel=\"next\""},
{"<" + expected + ">; rel=\"next\", " +
- "<https://api.github.com/installation/repositories?per_page=5&page=1>; rel=\"first\""},
+ "<https://api.github.com/installation/repositories?per_page=5&page=1>; rel=\"first\""},
{"<https://api.github.com/installation/repositories?per_page=5&page=1>; rel=\"first\", " +
- "<" + expected + ">; rel=\"next\""},
+ "<" + expected + ">; rel=\"next\""},
{"<https://api.github.com/installation/repositories?per_page=5&page=1>; rel=\"first\", " +
- "<" + expected + ">; rel=\"next\", " +
- "<https://api.github.com/installation/repositories?per_page=5&page=5>; rel=\"last\""},
+ "<" + expected + ">; rel=\"next\", " +
+ "<https://api.github.com/installation/repositories?per_page=5&page=5>; rel=\"last\""},
};
}
diff --git a/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GithubApplicationClientImplTest.java b/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GithubApplicationClientImplTest.java
index 848dfc49b27..28f3fdb5b93 100644
--- a/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GithubApplicationClientImplTest.java
+++ b/server/sonar-alm-client/src/test/java/org/sonar/alm/client/github/GithubApplicationClientImplTest.java
@@ -44,7 +44,6 @@ import org.sonar.alm.client.github.security.AppToken;
import org.sonar.alm.client.github.security.GithubAppSecurity;
import org.sonar.api.testfixtures.log.LogAndArguments;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.auth.github.AppInstallationToken;
import org.sonar.auth.github.ExpiringAppInstallationToken;
import org.sonar.auth.github.GitHubSettings;
@@ -120,7 +119,7 @@ public class GithubApplicationClientImplTest {
private static final RateLimit RATE_LIMIT = new RateLimit(Integer.MAX_VALUE, Integer.MAX_VALUE, 0L);
@ClassRule
- public static LogTester logTester = new LogTester().setLevel(LoggerLevel.WARN);
+ public static LogTester logTester = new LogTester().setLevel(Level.WARN);
private GithubApplicationHttpClient githubApplicationHttpClient = mock();
private GithubAppSecurity appSecurity = mock();
diff --git a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStepIT.java b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStepIT.java
index ce120b0ec46..3f56baf5515 100644
--- a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStepIT.java
+++ b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/ExtractReportStepIT.java
@@ -32,7 +32,6 @@ import org.sonar.api.testfixtures.log.LogTester;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.ZipUtils;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.ce.task.CeTask;
import org.sonar.ce.task.projectanalysis.batch.BatchReportDirectoryHolderImpl;
import org.sonar.ce.task.projectanalysis.batch.MutableBatchReportDirectoryHolder;
@@ -53,7 +52,6 @@ public class ExtractReportStepIT {
@Rule
public LogTester logTester = new LogTester();
-
@Rule
public DbTester dbTester = DbTester.create(System2.INSTANCE);
@@ -74,7 +72,7 @@ public class ExtractReportStepIT {
@Test
public void unzip_report() throws Exception {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
File reportFile = generateReport();
try (InputStream input = FileUtils.openInputStream(reportFile)) {
dbTester.getDbClient().ceTaskInputDao().insert(dbTester.getSession(), TASK_UUID, input);
@@ -95,7 +93,7 @@ public class ExtractReportStepIT {
@Test
public void unzip_report_should_fail_if_unzip_size_exceed_threshold() throws Exception {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
URL zipBombFile = getClass().getResource("/org/sonar/ce/task/projectanalysis/step/ExtractReportStepIT/zip-bomb.zip");
try (InputStream input = zipBombFile.openStream()) {
dbTester.getDbClient().ceTaskInputDao().insert(dbTester.getSession(), TASK_UUID, input);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImplTest.java
index 80a12949173..236f161dd18 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/ReportMetricValidatorImplTest.java
@@ -26,7 +26,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.slf4j.event.Level;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.core.metric.ScannerMetrics;
import static org.assertj.core.api.Assertions.assertThat;
@@ -38,7 +37,7 @@ import static org.sonar.api.measures.Metric.ValueType;
public class ReportMetricValidatorImplTest {
@Rule
- public LogTester logTester = new LogTester().setLevel(LoggerLevel.DEBUG);
+ public LogTester logTester = new LogTester().setLevel(Level.DEBUG);
static final String METRIC_KEY = "metric_key";
diff --git a/server/sonar-ce/src/it/java/org/sonar/ce/taskprocessor/CeWorkerImplIT.java b/server/sonar-ce/src/it/java/org/sonar/ce/taskprocessor/CeWorkerImplIT.java
index 2569c97e571..69992b3f7bf 100644
--- a/server/sonar-ce/src/it/java/org/sonar/ce/taskprocessor/CeWorkerImplIT.java
+++ b/server/sonar-ce/src/it/java/org/sonar/ce/taskprocessor/CeWorkerImplIT.java
@@ -40,7 +40,6 @@ import org.sonar.api.testfixtures.log.LogAndArguments;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.System2;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.ce.queue.InternalCeQueue;
import org.sonar.ce.task.CeTask;
import org.sonar.ce.task.CeTaskResult;
@@ -357,7 +356,7 @@ class CeWorkerImplIT {
@Test
void display_start_stop_at_debug_level_for_console_if_DEBUG_is_enabled_and_task_successful() throws Exception {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
when(queue.peek(anyString(), anyBoolean())).thenReturn(Optional.of(createCeTask(submitter)));
taskProcessorRepository.setProcessorForTask(CeTaskTypes.REPORT, taskProcessor);
@@ -375,7 +374,7 @@ class CeWorkerImplIT {
@Test
void display_start_at_debug_level_stop_at_error_level_for_console_if_DEBUG_is_enabled_and_task_failed() throws Exception {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
CeTask ceTask = createCeTask(submitter);
when(queue.peek(anyString(), anyBoolean())).thenReturn(Optional.of(ceTask));
diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java
index 60b9805812b..0e4a31058d9 100644
--- a/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java
+++ b/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java
@@ -36,7 +36,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.slf4j.event.Level;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
@@ -53,7 +52,7 @@ public class ProfiledDataSourceTest {
@Test
public void execute_and_log_statement() throws Exception {
- logTester.setLevel(LoggerLevel.TRACE);
+ logTester.setLevel(Level.TRACE);
Connection connection = mock(Connection.class);
when(originDataSource.getConnection()).thenReturn(connection);
@@ -78,7 +77,7 @@ public class ProfiledDataSourceTest {
@Test
public void execute_and_log_prepared_statement_with_parameters() throws Exception {
- logTester.setLevel(LoggerLevel.TRACE);
+ logTester.setLevel(Level.TRACE);
Connection connection = mock(Connection.class);
when(originDataSource.getConnection()).thenReturn(connection);
@@ -115,7 +114,7 @@ public class ProfiledDataSourceTest {
@Test
public void execute_and_log_prepared_statement_without_parameters() throws Exception {
- logTester.setLevel(LoggerLevel.TRACE);
+ logTester.setLevel(Level.TRACE);
Connection connection = mock(Connection.class);
when(originDataSource.getConnection()).thenReturn(connection);
diff --git a/server/sonar-server-common/src/it/java/org/sonar/server/es/BulkIndexerIT.java b/server/sonar-server-common/src/it/java/org/sonar/server/es/BulkIndexerIT.java
index 0efab56e57b..7e6d66546e3 100644
--- a/server/sonar-server-common/src/it/java/org/sonar/server/es/BulkIndexerIT.java
+++ b/server/sonar-server-common/src/it/java/org/sonar/server/es/BulkIndexerIT.java
@@ -36,7 +36,6 @@ import org.junit.Test;
import org.slf4j.event.Level;
import org.sonar.api.impl.utils.TestSystem2;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.db.DbTester;
import org.sonar.server.es.BulkIndexer.Size;
import org.sonar.server.es.newindex.FakeIndexDefinition;
@@ -167,7 +166,7 @@ public class BulkIndexerIT {
@Test
public void log_requests_when_TRACE_level_is_enabled() {
- logTester.setLevel(LoggerLevel.TRACE);
+ logTester.setLevel(Level.TRACE);
BulkIndexer indexer = new BulkIndexer(es.client(), TYPE_FAKE, Size.REGULAR, new FakeListener());
indexer.start();
@@ -205,7 +204,7 @@ public class BulkIndexerIT {
private int replicas() {
try {
GetSettingsResponse settingsResp = es.client().nativeClient().indices()
- .getSettings(new GetSettingsRequest().indices(INDEX), RequestOptions.DEFAULT);
+ .getSettings(new GetSettingsRequest().indices(INDEX), RequestOptions.DEFAULT);
return Integer.parseInt(settingsResp.getSetting(INDEX, IndexMetadata.SETTING_NUMBER_OF_REPLICAS));
} catch (IOException e) {
throw new IllegalStateException("Could not get index settings", e);
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java
index 152c8459698..ca10b5d5aa3 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java
@@ -45,7 +45,6 @@ import org.slf4j.event.Level;
import org.sonar.api.notifications.Notification;
import org.sonar.api.platform.Server;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.server.email.EmailSmtpConfiguration;
import org.sonar.server.issue.notification.EmailMessage;
import org.sonar.server.issue.notification.EmailTemplate;
@@ -72,7 +71,7 @@ public class EmailNotificationChannelTest {
public LogTester logTester = new LogTester();
@Rule
- public final GreenMailRule smtpServer = new GreenMailRule(new ServerSetup[]{ServerSetupTest.SMTP, ServerSetupTest.SMTPS});
+ public final GreenMailRule smtpServer = new GreenMailRule(new ServerSetup[] {ServerSetupTest.SMTP, ServerSetupTest.SMTPS});
private EmailSmtpConfiguration configuration;
private Server server;
@@ -80,7 +79,7 @@ public class EmailNotificationChannelTest {
@Before
public void setUp() {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
configuration = mock(EmailSmtpConfiguration.class);
server = mock(Server.class);
@@ -132,7 +131,7 @@ public class EmailNotificationChannelTest {
@Test
public void sendTestEmailShouldSanitizeLog() throws Exception {
- logTester.setLevel(LoggerLevel.TRACE);
+ logTester.setLevel(Level.TRACE);
configure();
underTest.sendTestEmail("user@nowhere", "Test Message from SonarQube", "This is a message \n containing line breaks \r that should be sanitized when logged.");
@@ -315,7 +314,7 @@ public class EmailNotificationChannelTest {
Set<EmailDeliveryRequest> requests = Stream.of(notification1, notification2, notification3)
.map(t -> new EmailDeliveryRequest(recipientEmail, t))
.collect(toSet());
- EmailNotificationChannel emailNotificationChannel = new EmailNotificationChannel(configuration, server, new EmailTemplate[]{template1, template3}, null,
+ EmailNotificationChannel emailNotificationChannel = new EmailNotificationChannel(configuration, server, new EmailTemplate[] {template1, template3}, null,
mock(OAuthMicrosoftRestClient.class));
int count = emailNotificationChannel.deliverAll(requests);
@@ -349,7 +348,7 @@ public class EmailNotificationChannelTest {
when(template11.format(notification1)).thenReturn(emailMessage11);
when(template12.format(notification1)).thenReturn(emailMessage12);
EmailDeliveryRequest request = new EmailDeliveryRequest(recipientEmail, notification1);
- EmailNotificationChannel emailNotificationChannel = new EmailNotificationChannel(configuration, server, new EmailTemplate[]{template11, template12}, null,
+ EmailNotificationChannel emailNotificationChannel = new EmailNotificationChannel(configuration, server, new EmailTemplate[] {template11, template12}, null,
mock(OAuthMicrosoftRestClient.class));
int count = emailNotificationChannel.deliverAll(Collections.singleton(request));
@@ -362,7 +361,7 @@ public class EmailNotificationChannelTest {
@DataProvider
public static Object[][] emptyStrings() {
- return new Object[][]{
+ return new Object[][] {
{""},
{" "},
{" \n "}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartupTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartupTest.java
index 0d79d31e320..bd145696715 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartupTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/CheckAnyonePermissionsAtStartupTest.java
@@ -28,7 +28,6 @@ import org.slf4j.event.Level;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.testfixtures.log.LogTester;
import org.sonar.api.utils.System2;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.db.DbClient;
import org.sonar.db.DbTester;
import org.sonar.db.component.ComponentDto;
@@ -40,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class CheckAnyonePermissionsAtStartupTest {
@ClassRule
- public static LogTester logTester = new LogTester().setLevel(LoggerLevel.WARN);
+ public static LogTester logTester = new LogTester().setLevel(Level.WARN);
@Rule
public final DbTester dbTester = DbTester.create(System2.INSTANCE);
private final DbClient dbClient = dbTester.getDbClient();
diff --git a/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java b/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java
index ef44632b7fa..8b04598badd 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java
@@ -26,10 +26,9 @@ import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
-import org.slf4j.LoggerFactory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
@@ -56,11 +55,11 @@ public class DefaultProfilerTest {
assertThat(underTest.isDebugEnabled()).isFalse();
assertThat(underTest.isTraceEnabled()).isFalse();
- tester.setLevel(LoggerLevel.DEBUG);
+ tester.setLevel(Level.DEBUG);
assertThat(underTest.isDebugEnabled()).isTrue();
assertThat(underTest.isTraceEnabled()).isFalse();
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
assertThat(underTest.isDebugEnabled()).isTrue();
assertThat(underTest.isTraceEnabled()).isTrue();
}
@@ -69,7 +68,7 @@ public class DefaultProfilerTest {
@UseDataProvider("logTimeLastValues")
public void stop_reuses_start_message(boolean logTimeLast) throws InterruptedException {
underTest.logTimeLast(logTimeLast);
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
// trace
underTest.startTrace("Register rules {}", 1);
@@ -105,7 +104,7 @@ public class DefaultProfilerTest {
@UseDataProvider("logTimeLastValues")
public void different_start_and_stop_messages(boolean logTimeLast) {
underTest.logTimeLast(logTimeLast);
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
// start TRACE and stop DEBUG
underTest.startTrace("Register rules");
@@ -135,7 +134,7 @@ public class DefaultProfilerTest {
@UseDataProvider("logTimeLastValues")
public void log_on_at_stop(boolean logTimeLast) {
underTest.logTimeLast(logTimeLast);
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
// trace
underTest.start();
@@ -179,7 +178,7 @@ public class DefaultProfilerTest {
@Test
public void startDebug_writes_log_with_context_appended_when_there_is_a_message() {
- tester.setLevel(LoggerLevel.DEBUG);
+ tester.setLevel(Level.DEBUG);
addSomeContext(underTest);
underTest.startDebug("Foo");
@@ -188,7 +187,7 @@ public class DefaultProfilerTest {
@Test
public void startTrace_writes_log_with_context_appended_when_there_is_a_message() {
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
addSomeContext(underTest);
underTest.startTrace("Foo");
@@ -219,7 +218,7 @@ public class DefaultProfilerTest {
@Test
public void stopTrace_adds_context_after_time_by_default() {
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
addSomeContext(underTest);
underTest.start().stopTrace("Rules registered");
@@ -255,7 +254,7 @@ public class DefaultProfilerTest {
@Test
public void stopTrace_adds_context_before_time_if_logTimeLast_is_true() {
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
addSomeContext(underTest);
underTest.logTimeLast(true);
underTest.start().stopTrace("Rules registered");
@@ -276,16 +275,16 @@ public class DefaultProfilerTest {
assertThat(tester.logs()).hasSize(2);
List<String> logs = tester.logs(Level.INFO);
assertThat(logs.get(0))
- .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
- .endsWith("ms");
+ .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
+ .endsWith("ms");
assertThat(logs.get(1))
- .startsWith("Bar | time=")
- .endsWith("ms");
+ .startsWith("Bar | time=")
+ .endsWith("ms");
}
@Test
public void stopDebug_clears_context() {
- tester.setLevel(LoggerLevel.DEBUG);
+ tester.setLevel(Level.DEBUG);
addSomeContext(underTest);
underTest.logTimeLast(true);
underTest.start().stopDebug("Foo");
@@ -294,16 +293,16 @@ public class DefaultProfilerTest {
assertThat(tester.logs()).hasSize(2);
List<String> logs = tester.logs(Level.DEBUG);
assertThat(logs.get(0))
- .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
- .endsWith("ms");
+ .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
+ .endsWith("ms");
assertThat(logs.get(1))
- .startsWith("Bar | time=")
- .endsWith("ms");
+ .startsWith("Bar | time=")
+ .endsWith("ms");
}
@Test
public void stopTrace_clears_context() {
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
addSomeContext(underTest);
underTest.logTimeLast(true);
underTest.start().stopTrace("Foo");
@@ -312,11 +311,11 @@ public class DefaultProfilerTest {
assertThat(tester.logs()).hasSize(2);
List<String> logs = tester.logs(Level.TRACE);
assertThat(logs.get(0))
- .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
- .endsWith("ms");
+ .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
+ .endsWith("ms");
assertThat(logs.get(1))
- .startsWith("Bar | time=")
- .endsWith("ms");
+ .startsWith("Bar | time=")
+ .endsWith("ms");
}
private static void addSomeContext(Profiler profiler) {
diff --git a/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java b/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java
index d84ee9cdc8c..df32b5ae49a 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/logs/ProfilerTest.java
@@ -21,9 +21,9 @@ package org.sonar.core.util.logs;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import org.slf4j.LoggerFactory;
+import org.slf4j.event.Level;
+import org.sonar.api.testfixtures.log.LogTester;
import static org.assertj.core.api.Assertions.assertThat;
@@ -39,22 +39,22 @@ public class ProfilerTest {
@Test
public void create_null_profiler_if_trace_level_is_disabled() {
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
Profiler profiler = Profiler.createIfTrace(LoggerFactory.getLogger("foo"));
assertThat(profiler).isInstanceOf(DefaultProfiler.class);
- tester.setLevel(LoggerLevel.DEBUG);
+ tester.setLevel(Level.DEBUG);
profiler = Profiler.createIfTrace(LoggerFactory.getLogger("foo"));
assertThat(profiler).isInstanceOf(NullProfiler.class);
}
@Test
public void create_null_profiler_if_debug_level_is_disabled() {
- tester.setLevel(LoggerLevel.TRACE);
+ tester.setLevel(Level.TRACE);
Profiler profiler = Profiler.createIfDebug(LoggerFactory.getLogger("foo"));
assertThat(profiler).isInstanceOf(DefaultProfiler.class);
- tester.setLevel(LoggerLevel.INFO);
+ tester.setLevel(Level.INFO);
profiler = Profiler.createIfDebug(LoggerFactory.getLogger("foo"));
assertThat(profiler).isInstanceOf(NullProfiler.class);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java
index ab647c6a29d..0d7b061ccb4 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java
@@ -32,11 +32,11 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.slf4j.event.Level;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.api.testfixtures.log.LogTester;
import org.sonar.api.utils.System2;
-import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.core.platform.PluginInfo;
import org.sonar.scanner.bootstrap.GlobalServerSettings;
import org.sonar.scanner.bootstrap.ScannerPluginRepository;
@@ -75,7 +75,7 @@ public class AnalysisContextReportPublisherTest {
@Before
public void prepare() throws IOException {
- logTester.setLevel(LoggerLevel.INFO);
+ logTester.setLevel(Level.INFO);
FileStructure fileStructure = new FileStructure(temp.newFolder());
writer = new ScannerReportWriter(fileStructure);
when(system2.properties()).thenReturn(new Properties());
@@ -100,7 +100,7 @@ public class AnalysisContextReportPublisherTest {
@Test
public void dumpServerSideGlobalProps() throws Exception {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
when(globalServerSettings.properties()).thenReturn(ImmutableMap.of(COM_FOO, "bar", SONAR_SKIP, "true"));
DefaultInputModule rootModule = new DefaultInputModule(ProjectDefinition.create()
.setBaseDir(temp.newFolder())
@@ -118,7 +118,7 @@ public class AnalysisContextReportPublisherTest {
@Test
public void dumpServerSideProjectProps() throws Exception {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
DefaultInputModule rootModule = new DefaultInputModule(ProjectDefinition.create()
.setBaseDir(temp.newFolder())
@@ -208,7 +208,7 @@ public class AnalysisContextReportPublisherTest {
// SONAR-7371
@Test
public void dontDumpParentProps() throws Exception {
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
DefaultInputModule module = new DefaultInputModule(ProjectDefinition.create()
.setBaseDir(temp.newFolder())
@@ -238,8 +238,7 @@ public class AnalysisContextReportPublisherTest {
" - sonar.projectKey=parent",
" - sonar.skip=true",
"Scanner properties of module: foo",
- " - sonar.projectKey=foo"
- );
+ " - sonar.projectKey=foo");
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/GitIgnoreCommandTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/GitIgnoreCommandTest.java
index b559d0622b9..8ede2a9739d 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/GitIgnoreCommandTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/GitIgnoreCommandTest.java
@@ -34,7 +34,6 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.slf4j.event.Level;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardOpenOption.CREATE;
@@ -76,17 +75,17 @@ public class GitIgnoreCommandTest {
int folder_depth = 10;
createFolderStructure(projectDir, child_folders_per_folder, 0, folder_depth);
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
GitIgnoreCommand underTest = new GitIgnoreCommand();
underTest.init(projectDir);
assertThat(underTest
.isIgnored(projectDir.resolve("folder_0_0/folder_1_0/folder_2_0/folder_3_0/folder_4_0/folder_5_0/folder_6_0/folder_7_0/folder_8_0/folder_9_0/Foo.java")))
- .isTrue();
+ .isTrue();
assertThat(underTest
.isIgnored(projectDir.resolve("folder_0_0/folder_1_0/folder_2_0/folder_3_0/folder_4_0/folder_5_0/folder_6_0/folder_7_0/folder_8_0/folder_9_0/Foo.php")))
- .isFalse();
+ .isFalse();
int expectedIncludedFiles = (int) Math.pow(child_folders_per_folder, folder_depth) + 1; // The .gitignore file is indexed
assertThat(logTester.logs(Level.DEBUG)).contains(expectedIncludedFiles + " non excluded files in this Git repository");
@@ -102,7 +101,7 @@ public class GitIgnoreCommandTest {
Files.write(projectDir.resolve(".gitignore"), Arrays.asList("**/*.java"), UTF_8, TRUNCATE_EXISTING, CREATE);
createFolderStructure(projectDir, 1, 0, 1);
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
GitIgnoreCommand underTest = new GitIgnoreCommand();
underTest.init(projectDir);
@@ -128,10 +127,10 @@ public class GitIgnoreCommandTest {
Files.write(projectDir.resolve(".gitignore"), Arrays.asList("**/*.java"), UTF_8, TRUNCATE_EXISTING, CREATE);
createFolderStructure(projectDir, 1, 0, 1);
- //clean submodule
+ // clean submodule
FileUtils.cleanDirectory(new File(projectDir.toString(), "module1"));
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
GitIgnoreCommand underTest = new GitIgnoreCommand();
underTest.init(projectDir);
@@ -154,7 +153,7 @@ public class GitIgnoreCommandTest {
int folder_depth = 10;
createFolderStructure(repoRoot, child_folders_per_folder, 0, folder_depth);
- logTester.setLevel(LoggerLevel.DEBUG);
+ logTester.setLevel(Level.DEBUG);
GitIgnoreCommand underTest = new GitIgnoreCommand();
// Define project baseDir as folder_0_0 so that folder_0_1 is excluded
@@ -163,10 +162,10 @@ public class GitIgnoreCommandTest {
assertThat(underTest
.isIgnored(projectBasedir.resolve("folder_1_0/folder_2_0/folder_3_0/folder_4_0/folder_5_0/folder_6_0/folder_7_0/folder_8_0/folder_9_0/Foo.php")))
- .isFalse();
+ .isFalse();
assertThat(underTest
.isIgnored(repoRoot.resolve("folder_0_1/folder_1_0/folder_2_0/folder_3_0/folder_4_0/folder_5_0/folder_6_0/folder_7_0/folder_8_0/folder_9_0/Foo.php")))
- .isTrue();
+ .isTrue();
int expectedIncludedFiles = (int) Math.pow(child_folders_per_folder, folder_depth - 1);
assertThat(logTester.logs(Level.DEBUG)).contains(expectedIncludedFiles + " non excluded files in this Git repository");