Skip to content

Commit

Permalink
Fix issue racodond#37 - updated Sonar version to 6.0 and changed Batc…
Browse files Browse the repository at this point in the history
…hSide annotation to ScannerSide
  • Loading branch information
Erkki Halme committed Dec 18, 2019
1 parent 84d464b commit cdae9d5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

import com.google.common.collect.ImmutableList;
import org.sonar.api.ExtensionPoint;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.ScannerSide;
import org.sonar.api.server.rule.RulesDefinition;
import org.sonar.squidbridge.annotations.AnnotationBasedRulesDefinition;

/**
* Extension point to create custom rule repository for JSON.
*/
@ExtensionPoint
@BatchSide
@ScannerSide
public abstract class CustomJSONRulesDefinition implements RulesDefinition {

/**
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<license.title>SonarQube JSON Analyzer</license.title>
<license.owner>David RACODON</license.owner>
<license.mailto>david.racodon@gmail.com</license.mailto>
<sonar.version>5.6</sonar.version>
<sonar.version>6.0</sonar.version>
<sslr.version>1.22</sslr.version>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,28 @@
*/
package org.sonar.plugins.json;

import static org.fest.assertions.Assertions.assertThat;

import org.junit.Test;
import org.sonar.api.Plugin;
import org.sonar.api.internal.SonarRuntimeImpl;
import org.sonar.api.utils.Version;

import static org.fest.assertions.Assertions.assertThat;

public class JSONPluginTest {

@Test
public void should_get_the_right_version() {
Plugin.Context context = new Plugin.Context(Version.create(5, 6));
new JSONPlugin().define(context);
assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
@Test
public void should_get_the_right_version() {
Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarLint(Version.create(6, 0)));
new JSONPlugin().define(context);
assertThat(context.getSonarQubeVersion().major()).isEqualTo(6);
assertThat(context.getSonarQubeVersion().minor()).isEqualTo(0);
}

@Test
public void should_get_the_right_number_of_extensions() {
Plugin.Context context = new Plugin.Context(Version.create(5, 6));
new JSONPlugin().define(context);
assertThat(context.getExtensions()).hasSize(4);
}
@Test
public void should_get_the_right_number_of_extensions() {
Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarLint(Version.create(6, 0)));
new JSONPlugin().define(context);
assertThat(context.getExtensions()).hasSize(4);
}

}

0 comments on commit cdae9d5

Please sign in to comment.