From 00a71853b7b223005c429e7582ee01b59f5ff50f Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 8 Oct 2014 10:32:49 +0200 Subject: Fix some quality flaws --- .../java/org/sonar/batch/mediumtest/BatchMediumTester.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sonar-batch/src') 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 be3185f7b6d..cc0d2577e82 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 @@ -89,7 +89,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 bootstrapProperties = new HashMap(); public BatchMediumTester build() { @@ -378,7 +378,7 @@ public class BatchMediumTester { } } - private static class FackPluginsReferential implements PluginsReferential { + private static class FakePluginsReferential implements PluginsReferential { private List pluginList = new ArrayList(); private Map pluginFiles = new HashMap(); @@ -394,15 +394,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; } -- cgit v1.2.3 From b0c0624706cdaf22a6d4c966ad69693e13430e74 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 8 Oct 2014 11:35:55 +0200 Subject: Fix some quality flaws --- .../sonar/batch/scan/filesystem/InputFileBuilderFactory.java | 11 +---------- .../org/sonar/batch/scan2/DefaultFileLinesContextFactory.java | 3 +-- .../main/java/org/sonar/batch/scan2/ModuleScanContainer.java | 2 +- .../main/java/org/sonar/batch/scan2/ModuleScanExecutor.java | 3 +-- .../batch/scan/filesystem/InputFileBuilderFactoryTest.java | 5 +---- 5 files changed, 5 insertions(+), 19 deletions(-) (limited to 'sonar-batch/src') 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 603cf47bb3f..8805ac83d89 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.measures.FileLinesContext; @@ -35,7 +34,7 @@ public class DefaultFileLinesContextFactory implements FileLinesContextFactory { private final ProjectDefinition def; private InputPathCache fileCache; - public DefaultFileLinesContextFactory(InputPathCache fileCache, FileSystem fs, MetricFinder metricFinder, AnalyzerMeasureCache measureCache, + public DefaultFileLinesContextFactory(InputPathCache fileCache, MetricFinder metricFinder, AnalyzerMeasureCache measureCache, 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); -- cgit v1.2.3 From 286f8d1b1942d293a8411944479e14dd54f920d5 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 7 Oct 2014 14:59:30 +0200 Subject: Fix quality flaw --- sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sonar-batch/src') diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 088a0fbda43..c0c5d2c9215 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -494,10 +494,6 @@ public class DefaultIndex extends SonarIndex { @Override public List getChildren(Resource resource) { - return getChildren(resource, false); - } - - public List getChildren(Resource resource, boolean acceptExcluded) { List children = Lists.newLinkedList(); Bucket bucket = getBucket(resource); if (bucket != null) { -- cgit v1.2.3 From 31a65f34968937d01a7e6c64a117409f150b5c0f Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 8 Oct 2014 11:52:59 +0200 Subject: Fix quality flaws --- .../sonar/server/activity/ws/ActivityMapping.java | 4 +-- .../batch/index/ResourceNotIndexedException.java | 33 ---------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 sonar-batch/src/main/java/org/sonar/batch/index/ResourceNotIndexedException.java (limited to 'sonar-batch/src') diff --git a/server/sonar-server/src/main/java/org/sonar/server/activity/ws/ActivityMapping.java b/server/sonar-server/src/main/java/org/sonar/server/activity/ws/ActivityMapping.java index e2910b6c4ea..668b072dad9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/activity/ws/ActivityMapping.java +++ b/server/sonar-server/src/main/java/org/sonar/server/activity/ws/ActivityMapping.java @@ -19,14 +19,12 @@ */ package org.sonar.server.activity.ws; -import org.sonar.api.resources.Languages; import org.sonar.api.utils.text.JsonWriter; import org.sonar.core.activity.Activity; import org.sonar.server.activity.index.ActivityDoc; import org.sonar.server.activity.index.ActivityNormalizer; import org.sonar.server.search.ws.BaseMapping; import org.sonar.server.search.ws.SearchOptions; -import org.sonar.server.text.MacroInterpreter; import java.util.Map; @@ -35,7 +33,7 @@ import java.util.Map; */ public class ActivityMapping extends BaseMapping { - public ActivityMapping(Languages languages, MacroInterpreter macroInterpreter) { + public ActivityMapping() { map("type", ActivityNormalizer.LogFields.TYPE.field()); map("action", ActivityNormalizer.LogFields.ACTION.field()); mapDateTime("createdAt", ActivityNormalizer.LogFields.CREATED_AT.field()); 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()); - } -} -- cgit v1.2.3