summaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-02-23 22:32:31 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-02-23 23:14:33 +0100
commit2bc4e191083b996abf80bcbc535064bce6881bed (patch)
tree4a02095468a96e08ff6fa1bba3ff8a869a223546 /server/sonar-server
parent0654ad1cdeb80e447b050bc0b8d67724d1d2531c (diff)
downloadsonarqube-2bc4e191083b996abf80bcbc535064bce6881bed.tar.gz
sonarqube-2bc4e191083b996abf80bcbc535064bce6881bed.zip
Fix quality flaws
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java16
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java2
2 files changed, 10 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
index 2f8f2cce6ca..77ee77fb272 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
@@ -22,11 +22,11 @@ package org.sonar.server.computation;
import com.google.common.base.Throwables;
import org.apache.commons.lang.ArrayUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.sonar.api.ServerComponent;
import org.sonar.api.utils.System2;
-import org.sonar.api.utils.TimeProfiler;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+import org.sonar.api.utils.log.Profiler;
import org.sonar.core.activity.Activity;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.computation.db.AnalysisReportDto;
@@ -39,7 +39,7 @@ import org.sonar.server.db.DbClient;
public class ComputationService implements ServerComponent {
- private static final Logger LOG = LoggerFactory.getLogger(ComputationService.class);
+ private static final Logger LOG = Loggers.get(ComputationService.class);
private final DbClient dbClient;
private final ComputationSteps steps;
@@ -52,7 +52,7 @@ public class ComputationService implements ServerComponent {
}
public void process(AnalysisReportDto report) {
- TimeProfiler profiler = new TimeProfiler(LOG).start(String.format(
+ Profiler profiler = Profiler.create(LOG).startInfo(String.format(
"#%s - %s - processing analysis report", report.getId(), report.getProjectKey()));
ComponentDto project = loadProject(report);
@@ -60,9 +60,9 @@ public class ComputationService implements ServerComponent {
ComputationContext context = new ComputationContext(report, project);
for (ComputationStep step : steps.orderedSteps()) {
if (ArrayUtils.contains(step.supportedProjectQualifiers(), context.getProject().qualifier())) {
- TimeProfiler stepProfiler = new TimeProfiler(LOG).start(step.getDescription());
+ Profiler stepProfiler = Profiler.create(LOG).startInfo(step.getDescription());
step.execute(context);
- stepProfiler.stop();
+ stepProfiler.stopInfo();
}
}
report.succeed();
@@ -73,7 +73,7 @@ public class ComputationService implements ServerComponent {
} finally {
logActivity(report, project);
- profiler.stop();
+ profiler.stopInfo();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java
index 1e3eebf1e43..e983b901cef 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.computation;
+import org.apache.commons.lang.RandomStringUtils;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
@@ -107,6 +108,7 @@ public class ComputationServiceTest {
private ComputationStep mockStep(String... qualifiers) {
ComputationStep step = mock(ComputationStep.class);
when(step.supportedProjectQualifiers()).thenReturn(qualifiers);
+ when(step.getDescription()).thenReturn(RandomStringUtils.randomAscii(5));
return step;
}
}