diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-17 10:41:56 +0200 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-09-30 16:27:12 +0200 |
commit | 5af4d8ed1fe0ad9fc75bdf9aaf01410b66c4da5f (patch) | |
tree | ff0b296f7ae1cf3817bd6c82d0bce8ed2388f159 /sonar-batch | |
parent | f728687b5cf55977ce241695097b8e01418988e3 (diff) | |
download | sonarqube-5af4d8ed1fe0ad9fc75bdf9aaf01410b66c4da5f.tar.gz sonarqube-5af4d8ed1fe0ad9fc75bdf9aaf01410b66c4da5f.zip |
SONAR-6823 WS batch/project with protobuf and new behaviors
Diffstat (limited to 'sonar-batch')
5 files changed, 16 insertions, 29 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java b/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java index a3b38ee4ec5..f4720065613 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java @@ -19,17 +19,13 @@ */ package org.sonar.batch.repository; -import org.sonar.batch.cache.WSLoaderResult; - -import org.sonar.batch.analysis.DefaultAnalysisMode; -import org.sonar.batch.cache.WSLoader; - import javax.annotation.Nullable; - import org.apache.commons.lang.mutable.MutableBoolean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.api.utils.MessageException; +import org.sonar.batch.analysis.DefaultAnalysisMode; +import org.sonar.batch.cache.WSLoader; +import org.sonar.batch.cache.WSLoaderResult; import org.sonar.batch.protocol.input.ProjectRepositories; import org.sonar.batch.rule.ModuleQProfiles; import org.sonar.batch.util.BatchUtils; @@ -58,7 +54,6 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad url += "&preview=" + analysisMode.isIssues(); ProjectRepositories projectRepositories = load(url, fromCache); - validateProjectRepositories(projectRepositories); return projectRepositories; } @@ -69,10 +64,4 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad } return ProjectRepositories.fromJson(result.get()); } - - private static void validateProjectRepositories(ProjectRepositories projectRepositories) { - if (projectRepositories.qProfiles().isEmpty()) { - throw MessageException.of("No quality profiles has been found this project, you probably don't have any language plugin suitable for this analysis."); - } - } } diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cache/CacheSyncTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cache/CacheSyncTest.java index 8216eea1323..0e20b4eed9f 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cache/CacheSyncTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cache/CacheSyncTest.java @@ -20,6 +20,7 @@ package org.sonar.batch.mediumtest.cache; import com.google.common.collect.ImmutableMap; +import java.util.Date; import org.junit.After; import org.junit.Rule; import org.junit.Test; @@ -31,8 +32,6 @@ import org.sonar.batch.protocol.input.FileData; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; -import java.util.Date; - public class CacheSyncTest { @Rule public ExpectedException exception = ExpectedException.none(); @@ -49,7 +48,7 @@ public class CacheSyncTest { @Test public void testSyncFirstTime() { - FileData file1 = new FileData("hash", true); + FileData file1 = new FileData("hash", "123456789"); tester = BatchMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES)) @@ -64,10 +63,10 @@ public class CacheSyncTest { tester.start(); tester.syncProject("test-project"); } - + @Test public void testNonAssociated() { - FileData file1 = new FileData("hash", true); + FileData file1 = new FileData("hash", "123456789"); tester = BatchMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES)) @@ -85,7 +84,7 @@ public class CacheSyncTest { @Test public void testNoQProfile() { - FileData file1 = new FileData("hash", true); + FileData file1 = new FileData("hash", "123456789"); tester = BatchMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES)) diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java index 2dfe12c6b34..28a13a38d55 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/scm/ScmMediumTest.java @@ -55,7 +55,7 @@ public class ScmMediumTest { public BatchMediumTester tester = BatchMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") - .addFileData("com.foo.project", "src/sample2.xoo", new FileData(DigestUtils.md5Hex(SAMPLE_XOO_CONTENT), false)) + .addFileData("com.foo.project", "src/sample2.xoo", new FileData(DigestUtils.md5Hex(SAMPLE_XOO_CONTENT), null)) .build(); @Before diff --git a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectSettingsLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectSettingsLoaderTest.java index 9d0388fd6b6..0a4b7b7b340 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectSettingsLoaderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectSettingsLoaderTest.java @@ -54,8 +54,8 @@ public class DefaultProjectSettingsLoaderTest { projectRepositories = new ProjectRepositories(); projectRepositories.setLastAnalysisDate(new Date(1000)); - f1 = new FileData("hash1", true); - f2 = new FileData("hash2", true); + f1 = new FileData("hash1", "123456789"); + f2 = new FileData("hash2", "123456789"); projectRepositories.addFileData("module1", "file1", f1); projectRepositories.addFileData("module1", "file2", f2); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java index 7aa79e5554e..98b17dd6a56 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java @@ -19,15 +19,14 @@ */ package org.sonar.batch.scan.filesystem; -import com.google.common.collect.ImmutableTable; - import com.google.common.collect.HashBasedTable; +import com.google.common.collect.ImmutableTable; import com.google.common.collect.Table; - -import org.sonar.batch.repository.ProjectSettingsRepo; import org.junit.Test; import org.sonar.api.batch.fs.InputFile; import org.sonar.batch.protocol.input.FileData; +import org.sonar.batch.repository.ProjectSettingsRepo; + import static org.assertj.core.api.Assertions.assertThat; public class StatusDetectionTest { @@ -45,8 +44,8 @@ public class StatusDetectionTest { private static Table<String, String, FileData> createTable() { Table<String, String, FileData> t = HashBasedTable.create(); - t.put("foo", "src/Foo.java", new FileData("ABCDE", true)); - t.put("foo", "src/Bar.java", new FileData("FGHIJ", true)); + t.put("foo", "src/Foo.java", new FileData("ABCDE", "12345789")); + t.put("foo", "src/Bar.java", new FileData("FGHIJ", "123456789")); return t; } |