aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-06-01 13:23:23 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-06-01 13:23:23 +0200
commitdf86e9c9059cfa03065c435dbaa55232cf0ccf89 (patch)
tree3e8d6318131c063f0331d177c01340dbb503d97e /sonar-batch
parent1b4f9761cc393a70aa7c8557f0a60ee217b81ca0 (diff)
downloadsonarqube-df86e9c9059cfa03065c435dbaa55232cf0ccf89.tar.gz
sonarqube-df86e9c9059cfa03065c435dbaa55232cf0ccf89.zip
Use ImmutableProjectReactor when possible
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java20
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ImmutableProjectReactor.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java15
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java6
5 files changed, 23 insertions, 26 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
index 79bedb1c112..bcf8fe66538 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
@@ -20,30 +20,28 @@
package org.sonar.batch.issue.tracking;
import com.google.common.base.Function;
-import org.sonar.api.batch.BatchSide;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.Nullable;
import org.sonar.api.batch.AnalysisMode;
+import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.InputFile.Status;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
import org.sonar.batch.index.BatchComponent;
+import org.sonar.batch.index.BatchComponentCache;
import org.sonar.batch.index.Cache;
import org.sonar.batch.index.Caches;
-import org.sonar.batch.index.BatchComponentCache;
import org.sonar.batch.protocol.input.BatchInput.ServerIssue;
import org.sonar.batch.repository.ServerIssuesLoader;
+import org.sonar.batch.scan.ImmutableProjectReactor;
import org.sonar.batch.scan.filesystem.InputPathCache;
import org.sonar.core.component.ComponentKeys;
-import javax.annotation.Nullable;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
@BatchSide
public class ServerIssueRepository {
@@ -53,12 +51,12 @@ public class ServerIssueRepository {
private final Caches caches;
private Cache<ServerIssue> issuesCache;
private final ServerIssuesLoader previousIssuesLoader;
- private final ProjectReactor reactor;
+ private final ImmutableProjectReactor reactor;
private final BatchComponentCache resourceCache;
private final AnalysisMode analysisMode;
private final InputPathCache inputPathCache;
- public ServerIssueRepository(Caches caches, ServerIssuesLoader previousIssuesLoader, ProjectReactor reactor, BatchComponentCache resourceCache,
+ public ServerIssueRepository(Caches caches, ServerIssuesLoader previousIssuesLoader, ImmutableProjectReactor reactor, BatchComponentCache resourceCache,
AnalysisMode analysisMode, InputPathCache inputPathCache) {
this.caches = caches;
this.previousIssuesLoader = previousIssuesLoader;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
index 64dc492ef5e..5660e8fc23f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
@@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.Server;
import org.sonar.api.utils.TempFolder;
@@ -40,6 +39,7 @@ import org.sonar.api.utils.ZipUtils;
import org.sonar.batch.bootstrap.DefaultAnalysisMode;
import org.sonar.batch.bootstrap.ServerClient;
import org.sonar.batch.protocol.output.BatchReportWriter;
+import org.sonar.batch.scan.ImmutableProjectReactor;
@BatchSide
public class ReportPublisher implements Startable {
@@ -50,7 +50,7 @@ public class ReportPublisher implements Startable {
private final ServerClient serverClient;
private final Server server;
private final Settings settings;
- private final ProjectReactor projectReactor;
+ private final ImmutableProjectReactor projectReactor;
private final DefaultAnalysisMode analysisMode;
private final TempFolder temp;
@@ -60,7 +60,7 @@ public class ReportPublisher implements Startable {
private BatchReportWriter writer;
public ReportPublisher(Settings settings, ServerClient serverClient, Server server,
- ProjectReactor projectReactor, DefaultAnalysisMode analysisMode, TempFolder temp, ReportPublisherStep[] publishers) {
+ ImmutableProjectReactor projectReactor, DefaultAnalysisMode analysisMode, TempFolder temp, ReportPublisherStep[] publishers) {
this.serverClient = serverClient;
this.server = server;
this.projectReactor = projectReactor;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ImmutableProjectReactor.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ImmutableProjectReactor.java
index 687fb639b94..b28bea91d20 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/ImmutableProjectReactor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ImmutableProjectReactor.java
@@ -27,7 +27,7 @@ import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
/**
- * Immutable copy of project reactor after all modifications have been applied (see {@link MutableProjectReactorProvider}).
+ * Immutable copy of project reactor after all modifications have been applied (see {@link ImmutableProjectReactorProvider}).
*/
@BatchSide
public class ImmutableProjectReactor {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java
index 397a2c4d2f1..a0b767e5c71 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java
@@ -20,22 +20,21 @@
package org.sonar.batch.scm;
import com.google.common.base.Joiner;
+import java.util.LinkedHashMap;
+import java.util.Map;
import org.picocontainer.Startable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.batch.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.Properties;
import org.sonar.api.Property;
import org.sonar.api.PropertyType;
import org.sonar.api.batch.AnalysisMode;
+import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.batch.scm.ScmProvider;
import org.sonar.api.config.Settings;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
+import org.sonar.batch.scan.ImmutableProjectReactor;
@Properties({
@Property(
@@ -57,14 +56,14 @@ public final class ScmConfiguration implements Startable {
public static final String FORCE_RELOAD_KEY = "sonar.scm.forceReloadAll";
- private final ProjectReactor projectReactor;
+ private final ImmutableProjectReactor projectReactor;
private final Settings settings;
private final Map<String, ScmProvider> providerPerKey = new LinkedHashMap<>();
private final AnalysisMode analysisMode;
private ScmProvider provider;
- public ScmConfiguration(ProjectReactor projectReactor, AnalysisMode analysisMode, Settings settings, ScmProvider... providers) {
+ public ScmConfiguration(ImmutableProjectReactor projectReactor, AnalysisMode analysisMode, Settings settings, ScmProvider... providers) {
this.projectReactor = projectReactor;
this.analysisMode = analysisMode;
this.settings = settings;
@@ -73,7 +72,7 @@ public final class ScmConfiguration implements Startable {
}
}
- public ScmConfiguration(ProjectReactor projectReactor, AnalysisMode analysisMode, Settings settings) {
+ public ScmConfiguration(ImmutableProjectReactor projectReactor, AnalysisMode analysisMode, Settings settings) {
this(projectReactor, analysisMode, settings, new ScmProvider[0]);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
index dcb0438619f..8d2bdf973c7 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
@@ -24,13 +24,13 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.Server;
import org.sonar.api.utils.TempFolder;
import org.sonar.batch.bootstrap.DefaultAnalysisMode;
import org.sonar.batch.bootstrap.ServerClient;
import org.sonar.batch.index.BatchComponentCache;
+import org.sonar.batch.scan.ImmutableProjectReactor;
import org.sonar.jpa.test.AbstractDbUnitTestCase;
import static org.mockito.Mockito.mock;
@@ -43,12 +43,12 @@ public class ReportPublisherTest extends AbstractDbUnitTestCase {
BatchComponentCache resourceCache = mock(BatchComponentCache.class);
- private ProjectReactor reactor;
+ private ImmutableProjectReactor reactor;
@Before
public void setUp() {
mode = mock(DefaultAnalysisMode.class);
- reactor = mock(ProjectReactor.class);
+ reactor = mock(ImmutableProjectReactor.class);
when(reactor.getRoot()).thenReturn(ProjectDefinition.create().setKey("struts"));
}