diff options
author | Stephane Gamard <stephane.gamard@sonarsource.com> | 2014-10-08 14:01:17 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@sonarsource.com> | 2014-10-08 14:01:17 +0200 |
commit | d5d20d0f777ba89b49575846c8f96afd316829f4 (patch) | |
tree | 257a0341add4bf8a00a20af45e623a548b357255 /sonar-batch/src | |
parent | 0a890a7a3069e79bc1029f17ddc59c8fb4409274 (diff) | |
parent | 7eb13c86cafb14b8d7afbb3737a27fb3c6fe9d51 (diff) | |
download | sonarqube-d5d20d0f777ba89b49575846c8f96afd316829f4.tar.gz sonarqube-d5d20d0f777ba89b49575846c8f96afd316829f4.zip |
Merge remote-tracking branch 'origin/branch-4.5'
Conflicts:
server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContextFactory.java
Diffstat (limited to 'sonar-batch/src')
7 files changed, 10 insertions, 57 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceNotIndexedException.java b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceNotIndexedException.java deleted file mode 100644 index 16b5ee32a90..00000000000 --- a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceNotIndexedException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.batch.index; - -import org.sonar.api.resources.Resource; -import org.sonar.api.utils.SonarException; - -/** - * @since 2.6 - */ -public class ResourceNotIndexedException extends SonarException { - - public ResourceNotIndexedException(final Resource reference) { - super(reference.toString()); - } -} diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java index 437d778b7fd..61a6a062867 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java @@ -96,7 +96,7 @@ public class BatchMediumTester { public static class BatchMediumTesterBuilder { private final FakeGlobalReferentialsLoader globalRefProvider = new FakeGlobalReferentialsLoader(); private final FakeProjectReferentialsLoader projectRefProvider = new FakeProjectReferentialsLoader(); - private final FackPluginsReferential pluginsReferential = new FackPluginsReferential(); + private final FakePluginsReferential pluginsReferential = new FakePluginsReferential(); private final Map<String, String> bootstrapProperties = new HashMap<String, String>(); public BatchMediumTester build() { @@ -472,7 +472,7 @@ public class BatchMediumTester { } } - private static class FackPluginsReferential implements PluginsReferential { + private static class FakePluginsReferential implements PluginsReferential { private List<RemotePlugin> pluginList = new ArrayList<RemotePlugin>(); private Map<RemotePlugin, File> pluginFiles = new HashMap<RemotePlugin, File>(); @@ -488,15 +488,15 @@ public class BatchMediumTester { return pluginFiles.get(remote); } - public FackPluginsReferential addPlugin(String pluginKey, File location) { + public FakePluginsReferential addPlugin(String pluginKey, File location) { RemotePlugin plugin = new RemotePlugin(pluginKey, false); pluginList.add(plugin); pluginFiles.put(plugin, location); return this; } - public FackPluginsReferential addPlugin(String pluginKey, SonarPlugin pluginInstance) { - localPlugins.put(DefaultPluginMetadata.create(null).setKey(pluginKey), pluginInstance); + public FakePluginsReferential addPlugin(String pluginKey, SonarPlugin pluginInstance) { + localPlugins.put(DefaultPluginMetadata.create(pluginKey), pluginInstance); return this; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java index 772f773cb5f..59f1e667edd 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java @@ -21,7 +21,6 @@ package org.sonar.batch.scan.filesystem; import org.sonar.api.BatchComponent; import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.resources.Project; import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.batch.bootstrap.AnalysisMode; @@ -33,17 +32,9 @@ public class InputFileBuilderFactory implements BatchComponent { private final StatusDetectionFactory statusDetectionFactory; private final AnalysisMode analysisMode; - public InputFileBuilderFactory(Project module, ProjectDefinition def, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory, - StatusDetectionFactory statusDetectionFactory, AnalysisMode analysisMode) { - this(module.getEffectiveKey(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode); - } - - /** - * Used by scan2 - */ public InputFileBuilderFactory(ProjectDefinition def, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory, StatusDetectionFactory statusDetectionFactory, AnalysisMode analysisMode) { - this(def.getKey(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode); + this(def.getKeyWithBranch(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode); } private InputFileBuilderFactory(String effectiveKey, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory, diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContextFactory.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContextFactory.java index 8b268b14be9..3ea69cad781 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContextFactory.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContextFactory.java @@ -20,7 +20,6 @@ package org.sonar.batch.scan2; import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.measure.MetricFinder; import org.sonar.api.batch.sensor.SensorStorage; @@ -36,7 +35,7 @@ public class DefaultFileLinesContextFactory implements FileLinesContextFactory { private final ProjectDefinition def; private final InputPathCache fileCache; - public DefaultFileLinesContextFactory(InputPathCache fileCache, FileSystem fs, MetricFinder metricFinder, SensorStorage sensorStorage, + public DefaultFileLinesContextFactory(InputPathCache fileCache, MetricFinder metricFinder, SensorStorage sensorStorage, ProjectDefinition def) { this.fileCache = fileCache; this.metricFinder = metricFinder; diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java index 67e2a37908d..41a2cda0390 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java @@ -139,7 +139,7 @@ public class ModuleScanContainer extends ComponentContainer { @Override protected void doAfterStart() { - getComponentByType(ModuleScanExecutor.class).execute(moduleDefinition); + getComponentByType(ModuleScanExecutor.class).execute(); } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java index 8611bd3b26a..088125818df 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java @@ -20,7 +20,6 @@ package org.sonar.batch.scan2; import com.google.common.collect.Lists; -import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader; import org.sonar.batch.rule.QProfileVerifier; @@ -60,7 +59,7 @@ public final class ModuleScanExecutor { /** * Executed on each module */ - public void execute(ProjectDefinition moduleDefinition) { + public void execute() { fsLogger.log(); // Index and lock the filesystem diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java index e38081b62be..bb78a170c84 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java @@ -22,7 +22,6 @@ package org.sonar.batch.scan.filesystem; import org.junit.Test; import org.mockito.Mockito; import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.resources.Project; import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.batch.bootstrap.AnalysisMode; @@ -33,14 +32,12 @@ public class InputFileBuilderFactoryTest { @Test public void create_builder() throws Exception { PathResolver pathResolver = new PathResolver(); - Project project = new Project("struts"); LanguageDetectionFactory langDetectionFactory = mock(LanguageDetectionFactory.class, Mockito.RETURNS_MOCKS); StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS); DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class); AnalysisMode analysisMode = mock(AnalysisMode.class); - InputFileBuilderFactory factory = new InputFileBuilderFactory( - project, ProjectDefinition.create(), pathResolver, langDetectionFactory, + InputFileBuilderFactory factory = new InputFileBuilderFactory(ProjectDefinition.create().setKey("struts"), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode); InputFileBuilder builder = factory.create(fs); |