aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-01-11 10:55:27 +0100
committerJulien HENRY <henryju@yahoo.fr>2017-01-12 11:26:48 +0100
commitc82f3ab5c6e65a6ab65c743e2645d3c5345fffe6 (patch)
tree57704793481b5201e0f5d38f19db79b7bbc4ffa4 /sonar-scanner-engine
parent82852ffe4457fce2a57aa25c468f0b75645cc848 (diff)
downloadsonarqube-c82f3ab5c6e65a6ab65c743e2645d3c5345fffe6.tar.gz
sonarqube-c82f3ab5c6e65a6ab65c743e2645d3c5345fffe6.zip
Rename BatchUtils -> ScannerUtils
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java8
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ScannerUtils.java (renamed from sonar-scanner-engine/src/main/java/org/sonar/scanner/util/BatchUtils.java)7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java (renamed from sonar-scanner-engine/src/test/java/org/sonar/scanner/util/BatchUtilsTest.java)18
12 files changed, 35 insertions, 34 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java
index ed0d6551fea..6ac10d73760 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java
@@ -30,7 +30,7 @@ import org.apache.commons.io.IOUtils;
import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
import org.sonar.scanner.bootstrap.ScannerWsClient;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
public class DefaultServerLineHashesLoader implements ServerLineHashesLoader {
private ScannerWsClient wsClient;
@@ -50,7 +50,7 @@ public class DefaultServerLineHashesLoader implements ServerLineHashesLoader {
.addContext("file", fileKey)
.startDebug("Load line hashes");
- GetRequest getRequest = new GetRequest("/api/sources/hash?key=" + BatchUtils.encodeForUrl(fileKey));
+ GetRequest getRequest = new GetRequest("/api/sources/hash?key=" + ScannerUtils.encodeForUrl(fileKey));
Reader reader = wsClient.call(getRequest).contentReader();
try {
return IOUtils.toString(reader);
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java
index a9783251372..db924b9f474 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java
@@ -26,7 +26,7 @@ import org.sonar.api.batch.events.SensorsPhaseHandler;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
public class PhasesTimeProfiler implements SensorExecutionHandler, SensorsPhaseHandler {
@@ -44,7 +44,7 @@ public class PhasesTimeProfiler implements SensorExecutionHandler, SensorsPhaseH
@Override
public void onSensorExecution(SensorExecutionEvent event) {
if (event.isStart()) {
- profiler.startInfo("Sensor " + BatchUtils.describe(event.getSensor()));
+ profiler.startInfo("Sensor " + ScannerUtils.describe(event.getSensor()));
} else {
profiler.stopInfo();
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java
index ce5863ecc1b..23fe945516f 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java
@@ -30,7 +30,7 @@ import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary;
import org.sonar.scanner.events.EventBus;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
@ScannerSide
public class PostJobsExecutor {
@@ -58,7 +58,7 @@ public class PostJobsExecutor {
logPostJobs(postJobs);
for (PostJob postJob : postJobs) {
- LOG.info("Executing post-job {}", BatchUtils.describe(postJob));
+ LOG.info("Executing post-job {}", ScannerUtils.describe(postJob));
eventBus.fireEvent(new PostJobExecutionEvent(postJob, true));
postJob.executeOn(project, context);
eventBus.fireEvent(new PostJobExecutionEvent(postJob, false));
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java
index 5ecfbbbfd37..8906535df07 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java
@@ -48,7 +48,7 @@ import org.sonar.api.utils.System2;
import org.sonar.api.utils.TimeUtils;
import org.sonar.scanner.bootstrap.GlobalProperties;
import org.sonar.scanner.events.BatchStepHandler;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
import static org.sonar.scanner.profiling.AbstractTimeProfiling.sortByDescendingTotalTime;
import static org.sonar.scanner.profiling.AbstractTimeProfiling.truncate;
@@ -113,7 +113,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx
println(" -------- End of profiling of module " + module.getName() + " --------");
println("");
String fileName = module.getKey() + "-profiler.properties";
- dumpToFile(props, BatchUtils.cleanKeyForFilename(fileName));
+ dumpToFile(props, ScannerUtils.cleanKeyForFilename(fileName));
totalProfiling.merge(currentModuleProfiling);
if (module.isRoot() && !module.getModules().isEmpty()) {
dumpTotalExecutionSummary();
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java
index 2ccfb6c8a7f..578f3b61baf 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java
@@ -32,7 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.bootstrap.ScannerWsClient;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
import org.sonarqube.ws.WsBatch;
import org.sonarqube.ws.WsBatch.WsProjectResponse;
import org.sonarqube.ws.WsBatch.WsProjectResponse.FileDataByPath;
@@ -70,7 +70,7 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad
StringBuilder builder = new StringBuilder();
builder.append(BATCH_PROJECT_URL)
- .append("?key=").append(BatchUtils.encodeForUrl(projectKey));
+ .append("?key=").append(ScannerUtils.encodeForUrl(projectKey));
if (issuesMode) {
builder.append("&issues_mode=true");
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java
index 148f7ee0c82..d56cd5c4961 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java
@@ -21,7 +21,7 @@ package org.sonar.scanner.repository;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.bootstrap.ScannerWsClient;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
import org.apache.commons.io.IOUtils;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
@@ -45,16 +45,16 @@ public class DefaultQualityProfileLoader implements QualityProfileLoader {
public List<QualityProfile> loadDefault(@Nullable String profileName) {
String url = WS_URL + "?defaults=true";
if (profileName != null) {
- url += "&profileName=" + BatchUtils.encodeForUrl(profileName);
+ url += "&profileName=" + ScannerUtils.encodeForUrl(profileName);
}
return loadResource(url);
}
@Override
public List<QualityProfile> load(String projectKey, @Nullable String profileName) {
- String url = WS_URL + "?projectKey=" + BatchUtils.encodeForUrl(projectKey);
+ String url = WS_URL + "?projectKey=" + ScannerUtils.encodeForUrl(projectKey);
if (profileName != null) {
- url += "&profileName=" + BatchUtils.encodeForUrl(profileName);
+ url += "&profileName=" + ScannerUtils.encodeForUrl(profileName);
}
return loadResource(url);
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java
index 02e8ff57a47..6c796eae544 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java
@@ -25,7 +25,7 @@ import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.sonar.scanner.bootstrap.ScannerWsClient;
import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
import org.sonarqube.ws.client.GetRequest;
public class DefaultServerIssuesLoader implements ServerIssuesLoader {
@@ -38,7 +38,7 @@ public class DefaultServerIssuesLoader implements ServerIssuesLoader {
@Override
public void load(String componentKey, Function<ServerIssue, Void> consumer) {
- GetRequest getRequest = new GetRequest("/batch/issues.protobuf?key=" + BatchUtils.encodeForUrl(componentKey));
+ GetRequest getRequest = new GetRequest("/batch/issues.protobuf?key=" + ScannerUtils.encodeForUrl(componentKey));
InputStream is = wsClient.call(getRequest).contentStream();
parseIssues(is, consumer);
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java
index 42d6fca9840..54dabf622ff 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java
@@ -24,7 +24,7 @@ import com.google.common.collect.Lists;
import com.google.common.base.Joiner;
import org.sonar.scanner.bootstrap.ScannerWsClient;
import org.sonar.scanner.protocol.input.ScannerInput;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
import org.sonarqube.ws.client.GetRequest;
import com.google.common.base.Function;
import java.io.IOException;
@@ -63,7 +63,7 @@ public class UserRepositoryLoader {
private static class UserEncodingFunction implements Function<String, String> {
@Override
public String apply(String input) {
- return BatchUtils.encodeForUrl(input);
+ return ScannerUtils.encodeForUrl(input);
}
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java
index 4a6db254ed9..2f8b518cb04 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java
@@ -28,7 +28,7 @@ import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.sonar.api.rule.RuleKey;
import org.sonar.scanner.bootstrap.ScannerWsClient;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
import org.sonarqube.ws.Rules;
import org.sonarqube.ws.Rules.Active;
import org.sonarqube.ws.Rules.Active.Param;
@@ -72,7 +72,7 @@ public class DefaultActiveRulesLoader implements ActiveRulesLoader {
private static String getUrl(String qualityProfileKey, int page, int pageSize) {
StringBuilder builder = new StringBuilder(1024);
builder.append(RULES_SEARCH_URL);
- builder.append("&qprofile=").append(BatchUtils.encodeForUrl(qualityProfileKey));
+ builder.append("&qprofile=").append(ScannerUtils.encodeForUrl(qualityProfileKey));
builder.append("&p=").append(page);
builder.append("&ps=").append(pageSize);
return builder.toString();
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java
index f3da9c37976..f87dfddd78e 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java
@@ -46,7 +46,7 @@ import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
import org.sonar.scanner.analysis.AnalysisProperties;
import org.sonar.scanner.bootstrap.DroppedPropertyChecker;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
/**
* Class that creates a project definition based on a set of properties.
@@ -206,7 +206,7 @@ public class ProjectReactorBuilder {
protected File initModuleWorkDir(File moduleBaseDir, Map<String, String> moduleProperties) {
String workDir = moduleProperties.get(CoreProperties.WORKING_DIRECTORY);
if (StringUtils.isBlank(workDir)) {
- return new File(rootProjectWorkDir, BatchUtils.cleanKeyForFilename(moduleProperties.get(CoreProperties.PROJECT_KEY_PROPERTY)));
+ return new File(rootProjectWorkDir, ScannerUtils.cleanKeyForFilename(moduleProperties.get(CoreProperties.PROJECT_KEY_PROPERTY)));
}
File customWorkDir = new File(workDir);
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/BatchUtils.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ScannerUtils.java
index 40813b9a028..12f959c0c91 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/BatchUtils.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ScannerUtils.java
@@ -25,9 +25,9 @@ import java.net.URLEncoder;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
-public class BatchUtils {
- private BatchUtils() {
- // prevent instantiation
+public class ScannerUtils {
+
+ private ScannerUtils() {
}
/**
@@ -62,4 +62,5 @@ public class BatchUtils {
return o.getClass().getName();
}
+
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/BatchUtilsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
index f0f0085b897..150dc109670 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/BatchUtilsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
@@ -20,18 +20,18 @@
package org.sonar.scanner.util;
import org.junit.Test;
-import org.sonar.scanner.util.BatchUtils;
+import org.sonar.scanner.util.ScannerUtils;
import static org.assertj.core.api.Assertions.assertThat;
-public class BatchUtilsTest {
+public class ScannerUtilsTest {
@Test
public void encodeForUrl() throws Exception {
- assertThat(BatchUtils.encodeForUrl(null)).isEqualTo("");
- assertThat(BatchUtils.encodeForUrl("")).isEqualTo("");
- assertThat(BatchUtils.encodeForUrl("foo")).isEqualTo("foo");
- assertThat(BatchUtils.encodeForUrl("foo&bar")).isEqualTo("foo%26bar");
+ assertThat(ScannerUtils.encodeForUrl(null)).isEqualTo("");
+ assertThat(ScannerUtils.encodeForUrl("")).isEqualTo("");
+ assertThat(ScannerUtils.encodeForUrl("foo")).isEqualTo("foo");
+ assertThat(ScannerUtils.encodeForUrl("foo&bar")).isEqualTo("foo%26bar");
}
private class MyClass {
@@ -51,8 +51,8 @@ public class BatchUtilsTest {
Object withoutToString = new Object();
- assertThat(BatchUtils.describe(withToString)).isEqualTo(("desc"));
- assertThat(BatchUtils.describe(withoutToString)).isEqualTo("java.lang.Object");
- assertThat(BatchUtils.describe(new MyClass())).endsWith("MyClass");
+ assertThat(ScannerUtils.describe(withToString)).isEqualTo(("desc"));
+ assertThat(ScannerUtils.describe(withoutToString)).isEqualTo("java.lang.Object");
+ assertThat(ScannerUtils.describe(new MyClass())).endsWith("MyClass");
}
}