org.sonar.api.internal.SonarRuntimeImpl Java Examples
The following examples show how to use
org.sonar.api.internal.SonarRuntimeImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClojurePluginTest.java From sonar-clojure with MIT License | 5 votes |
@Before public void setUp() { SonarRuntime runtime = SonarRuntimeImpl .forSonarQube(Version.create(7, 9, 3), SonarQubeSide.SERVER, SonarEdition.COMMUNITY); context = new Plugin.Context(runtime); new ClojurePlugin().define(context); }
Example #2
Source File: ColdfusionPluginTest.java From sonar-coldfusion with Apache License 2.0 | 5 votes |
@Test public void testExtensions() { ColdFusionPlugin plugin = new ColdFusionPlugin(); SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(VERSION_7_6, SonarQubeSide.SERVER); Plugin.Context context = new Plugin.Context(runtime); plugin.define(context); Assert.assertEquals(5, context.getExtensions().size()); }
Example #3
Source File: ColdfusionSensorTest.java From sonar-coldfusion with Apache License 2.0 | 5 votes |
@Test public void testBasicCFMAnalysis() { DefaultFileSystem fileSystem = new DefaultFileSystem(tmpFolder.getRoot()); fileSystem.setEncoding(Charsets.UTF_8); fileSystem.setWorkDir(tmpFolder.getRoot().toPath()); context.setFileSystem(fileSystem); context.setRuntime(SonarRuntimeImpl.forSonarQube(Version.create(7, 6), SonarQubeSide.SCANNER)); context.settings().appendProperty("sonar.projectBaseDir", baseDir.getPath()); addFilesToFs(); CommandExecutor commandExecutor = CommandExecutor.create(); String javaHome = System.getProperty("java.home"); Assert.assertTrue(javaHome!=null && !javaHome.equals("")); if(OSValidator.isWindows()) { context.settings().appendProperty(ColdFusionPlugin.CFLINT_JAVA, javaHome + "/bin/java.exe"); } else { context.settings().appendProperty(ColdFusionPlugin.CFLINT_JAVA, javaHome + "/bin/java"); } ColdFusionSensor sensor = new ColdFusionSensor(context.fileSystem(), rulesProfile); sensor.execute(context); Integer nloc = 0; Integer comments = 0; Integer complexity = 0; for (InputFile o : context.fileSystem().inputFiles()) { Measure<Integer> measureNloc = context.measure(o.key(),CoreMetrics.NCLOC.key()); Measure<Integer> measureComment = context.measure(o.key(),CoreMetrics.COMMENT_LINES.key()); Measure<Integer> measureComplexity = context.measure(o.key(),CoreMetrics.COMPLEXITY.key()); nloc+=measureNloc.value(); comments+=measureComment.value(); complexity+=measureComplexity.value(); } assertThat(nloc).isEqualTo(56); assertThat(comments).isEqualTo(9); assertThat(complexity).isEqualTo(10); }
Example #4
Source File: FlowPluginTest.java From sonar-flow-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@Test public void debug() { SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(5, 6), SonarQubeSide.SCANNER); Plugin.Context context = new Plugin.Context(runtime); new FlowPlugin().define(context); logger.debug("Nr of extentions: " + context.getExtensions().size()); assertTrue(context.getExtensions().size() == 13); }
Example #5
Source File: AemRulesSonarPluginTest.java From AEM-Rules-for-SonarQube with Apache License 2.0 | 5 votes |
@Test public void webPluginTester() { Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(6, 7), SonarQubeSide.SERVER, SonarEdition.COMMUNITY)); new AemRulesSonarPlugin().define(context); assertThat(context.getExtensions()).hasSize(7); }
Example #6
Source File: EsqlPluginTest.java From sonar-esql-plugin with Apache License 2.0 | 5 votes |
private List<PropertyDefinition> properties() { List<PropertyDefinition> propertiesList = new ArrayList<>(); List extensions = setupContext(SonarRuntimeImpl.forSonarQube(Version.create(7, 9), SonarQubeSide.SERVER, SonarEdition.COMMUNITY)).getExtensions(); for (Object extension : extensions) { if (extension instanceof PropertyDefinition) { propertiesList.add((PropertyDefinition) extension); } } return propertiesList; }
Example #7
Source File: CloverPluginTest.java From sonar-clover with Apache License 2.0 | 5 votes |
@Test public void test_define() { final Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube( Version.parse("6.7.4"), SonarQubeSide.SCANNER)); new CloverPlugin().define(context); assertThat(context.getExtensions()).hasSize(1); }
Example #8
Source File: AbstractAnsibleExtrasPluginTest.java From sonar-ansible with Apache License 2.0 | 4 votes |
public void testExtensionCounts() { Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(6, 2), SonarQubeSide.SERVER)); new MyExtrasPlugin().define(context); assertEquals(2, context.getExtensions().size()); }
Example #9
Source File: AnsiblePluginTest.java From sonar-ansible with Apache License 2.0 | 4 votes |
public void testExtensionCounts() { Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(6, 2), SonarQubeSide.SERVER)); new AnsiblePlugin().define(context); assertEquals(4, context.getExtensions().size()); }
Example #10
Source File: AuthOidcPluginTest.java From sonar-auth-oidc with Apache License 2.0 | 4 votes |
MockContext() { super(SonarRuntimeImpl.forSonarQube(Version.create(7, 6), SonarQubeSide.SERVER)); }
Example #11
Source File: EsqlPluginTest.java From sonar-esql-plugin with Apache License 2.0 | 4 votes |
@Test public void count_extensions() throws Exception { Plugin.Context context = setupContext(SonarRuntimeImpl.forSonarQube(Version.create(7, 9), SonarQubeSide.SERVER, SonarEdition.COMMUNITY)); assertThat(context.getExtensions()).hasSize(10); }