diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2013-12-04 11:34:34 +0100 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2013-12-04 11:44:23 +0100 |
commit | a8aedf67636d3ca31d0b81130fe78623db0d4b79 (patch) | |
tree | f4cf5852f756b78625facf261bd293ee5a4ef04f /sonar-batch/src | |
parent | dfe512dca580cedc06cf0c1ccee4165bba43c1d1 (diff) | |
download | sonarqube-a8aedf67636d3ca31d0b81130fe78623db0d4b79.tar.gz sonarqube-a8aedf67636d3ca31d0b81130fe78623db0d4b79.zip |
SONAR-4756 Use sonar.log.profilingLevel instead of showSql(Result) for batch
Diffstat (limited to 'sonar-batch/src')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java | 8 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java index 97ffaf0d62f..95fbdbced5f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java @@ -19,6 +19,9 @@ */ package org.sonar.batch.bootstrapper; +import org.sonar.core.profiling.Profiling.Level; + +import org.sonar.core.profiling.Profiling; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; import org.apache.commons.lang.StringUtils; @@ -68,8 +71,9 @@ public final class LoggingConfiguration { } public LoggingConfiguration setProperties(Map<String, String> properties) { - setShowSql("true".equals(properties.get("sonar.showSql"))); - setShowSqlResults("true".equals(properties.get("sonar.showSqlResults"))); + Profiling.Level profilingLevel = Profiling.Level.fromConfigString(properties.get("sonar.log.profilingLevel")); + setShowSql(profilingLevel == Level.FULL); + setShowSqlResults(profilingLevel == Level.FULL); setVerbose("true".equals(properties.get("sonar.verbose"))); return this; } diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java index 1f818ea82e9..79a59642250 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java @@ -85,11 +85,15 @@ public class LoggingConfigurationTest { assertThat(LoggingConfiguration.create(null).setProperties(properties) .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_DEFAULT); - properties.put("sonar.showSql", "true"); + properties.put("sonar.log.profilingLevel", "FULL"); assertThat(LoggingConfiguration.create(null).setProperties(properties) .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_VERBOSE); - properties.put("sonar.showSql", "false"); + properties.put("sonar.log.profilingLevel", "BASIC"); + assertThat(LoggingConfiguration.create(null).setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_DEFAULT); + + properties.put("sonar.log.profilingLevel", "NONE"); assertThat(LoggingConfiguration.create(null).setProperties(properties) .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_DEFAULT); } |