diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-07-27 22:57:19 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-07-27 22:57:19 +0200 |
commit | b710ae53feba2a4d8d2c181a26d5d1163e407d1b (patch) | |
tree | b6c485dd46d35115a0100dbe25d594a4dca8733d /plugins | |
parent | e4ba85fe304aaad519e574b8f4e172b733389752 (diff) | |
parent | 85bfbe28689b4276a04eeeed91b205ab76e81d06 (diff) | |
download | sonarqube-b710ae53feba2a4d8d2c181a26d5d1163e407d1b.tar.gz sonarqube-b710ae53feba2a4d8d2c181a26d5d1163e407d1b.zip |
Fix merge of branch-6.0
Diffstat (limited to 'plugins')
3 files changed, 16 insertions, 12 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java index 7cc594aa958..06925832258 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java @@ -23,6 +23,7 @@ import org.sonar.api.Plugin; import org.sonar.api.SonarProduct; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; +import org.sonar.api.utils.Version; import org.sonar.xoo.coverage.ItCoverageSensor; import org.sonar.xoo.coverage.OverallCoverageSensor; import org.sonar.xoo.coverage.UtCoverageSensor; @@ -65,8 +66,6 @@ import org.sonar.xoo.scm.XooScmProvider; import org.sonar.xoo.test.CoveragePerTestSensor; import org.sonar.xoo.test.TestExecutionSensor; -import static org.sonar.api.SonarRuntime.V5_5; - /** * Plugin entry-point, as declared in pom.xml. */ @@ -140,12 +139,12 @@ public class XooPlugin implements Plugin { XooProjectBuilder.class, XooPostJob.class); - if (context.getRuntimeProduct() != SonarProduct.SONARLINT) { + if (context.getRuntime().getProduct() != SonarProduct.SONARLINT) { context.addExtensions(MeasureSensor.class, DeprecatedResourceApiSensor.class); } - if (context.getSonarQubeVersion().isGreaterThanOrEqual(V5_5)) { + if (context.getRuntime().getApiVersion().isGreaterThanOrEqual(Version.create(5, 5))) { context.addExtension(CpdTokenizerSensor.class); } } diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java index 3d72a69bd42..03d8f037c4b 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java @@ -21,9 +21,9 @@ package org.sonar.xoo; import org.junit.Test; import org.sonar.api.Plugin; -import org.sonar.api.SonarProduct; import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarRuntime; +import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.utils.Version; import org.sonar.xoo.lang.CpdTokenizerSensor; @@ -32,13 +32,18 @@ import static org.assertj.core.api.Assertions.assertThat; public class XooPluginTest { @Test - public void provide_extensions_for_5_5() { - Plugin.Context context = new Plugin.Context(new SonarRuntime(Version.parse("5.5"), SonarProduct.SONARQUBE, SonarQubeSide.SCANNER)); + public void provide_extensions_for_5_4() { + SonarRuntime runtime = SonarRuntimeImpl.forSonarLint(Version.parse("5.4")); + Plugin.Context context = new Plugin.Context(runtime); new XooPlugin().define(context); - assertThat(context.getExtensions()).hasSize(44).contains(CpdTokenizerSensor.class); + assertThat(context.getExtensions()).hasSize(41).doesNotContain(CpdTokenizerSensor.class); + } - context = new Plugin.Context(new SonarRuntime(Version.parse("5.4"), SonarProduct.SONARLINT, null)); + @Test + public void provide_extensions_for_5_5() { + SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.parse("5.5"), SonarQubeSide.SCANNER); + Plugin.Context context = new Plugin.Context(runtime); new XooPlugin().define(context); - assertThat(context.getExtensions()).hasSize(41).doesNotContain(CpdTokenizerSensor.class); + assertThat(context.getExtensions()).hasSize(44).contains(CpdTokenizerSensor.class); } } diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java index e709e31831f..263eb23f625 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java @@ -23,13 +23,13 @@ import java.io.IOException; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.api.SonarProduct; import org.sonar.api.SonarQubeSide; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.rule.Severity; import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; import org.sonar.api.batch.sensor.internal.SensorContextTester; import org.sonar.api.batch.sensor.issue.Issue; +import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.utils.Version; import org.sonar.xoo.Xoo; @@ -106,7 +106,7 @@ public class OneIssuePerLineSensorTest { SensorContextTester context = SensorContextTester.create(temp.newFolder()); context.fileSystem().add(inputFile); context.settings().setProperty(OneIssuePerLineSensor.EFFORT_TO_FIX_PROPERTY, "1.2"); - context.setRuntime(Version.parse("5.4"), SonarProduct.SONARQUBE, SonarQubeSide.SCANNER); + context.setRuntime(SonarRuntimeImpl.forSonarQube(Version.parse("5.4"), SonarQubeSide.SCANNER)); sensor.execute(context); |