org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor Java Examples

The following examples show how to use org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor. 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: RubocopSensorTest.java    From sonar-ruby-plugin with MIT License 5 votes vote down vote up
@Test
public void testDescribe() {
    RubocopExecutor executor = new RubocopExecutor(System2.INSTANCE, new JUnitTempFolder());

    RubocopSensor sensor = new RubocopSensor(new PathResolver(), executor, new RubocopParser());

    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    sensor.describe(descriptor);

    assertThat(descriptor.name()).isEqualTo("Linting sensor for Ruby files");
    assertThat(descriptor.languages()).containsExactly(Ruby.LANGUAGE_KEY);
}
 
Example #2
Source File: CoberturaSensorTest.java    From sonar-lua with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testDescriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  sensor.describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Lua Cobertura");
  assertThat(descriptor.languages()).containsOnly("lua");
}
 
Example #3
Source File: LuaSquidSensorTest.java    From sonar-lua with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testDescriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  sensor.describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Lua");
  assertThat(descriptor.languages()).containsOnly("lua");
}
 
Example #4
Source File: CloverSensorTest.java    From sonar-clover with Apache License 2.0 5 votes vote down vote up
@Test
public void should_describe() {
  final DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();

  final CloverSensor sensor = new CloverSensor(new ConfigurationBridge(new MapSettings()), context.fileSystem(), new PathResolver());
  sensor.describe(descriptor);

  assertThat(descriptor.name()).isNotNull();
  assertThat(descriptor.languages()).hasSize(2);
}
 
Example #5
Source File: CombinedCoverageSensorTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void describe_setsLanguage() {
    DefaultSensorDescriptor desc = new DefaultSensorDescriptor();
    
    this.sensor.describe(desc);
    
    assertEquals(TypeScriptLanguage.LANGUAGE_KEY, desc.languages().iterator().next());
}
 
Example #6
Source File: CombinedCoverageSensorTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void describe_setsName() {
    DefaultSensorDescriptor desc = new DefaultSensorDescriptor();
    
    this.sensor.describe(desc);
    
    assertEquals(desc.name(), "Combined LCOV and LOC sensor");
}
 
Example #7
Source File: TsLintSensorTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void describe_setsLanguage() {
    DefaultSensorDescriptor desc = new DefaultSensorDescriptor();
    this.sensor.describe(desc);

    assertEquals(TypeScriptLanguage.LANGUAGE_KEY, desc.languages().iterator().next());
}
 
Example #8
Source File: TsLintSensorTest.java    From SonarTsPlugin with MIT License 5 votes vote down vote up
@Test
public void describe_setsName() {
    DefaultSensorDescriptor desc = new DefaultSensorDescriptor();
    this.sensor.describe(desc);

    assertNotNull(desc.name());
}
 
Example #9
Source File: HtlSensorTest.java    From AEM-Rules-for-SonarQube with Apache License 2.0 5 votes vote down vote up
@Test
public void checkDescriptorConfiguration() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    sensor.describe(descriptor);
    assertThat(descriptor.name()).isEqualTo("HTL");
    assertThat(descriptor.languages()).isEmpty();
}
 
Example #10
Source File: GherkinSquidSensorTest.java    From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createGherkinSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Gherkin Squid Sensor");
  assertThat(descriptor.languages()).containsOnly("gherkin");
  assertThat(descriptor.type()).isEqualTo(InputFile.Type.MAIN);
}
 
Example #11
Source File: CheckstyleSensorTest.java    From sonar-checkstyle with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void shouldDescribePluginCorrectly() {
    final DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    final CheckstyleSensor sensor = new CheckstyleSensor(null);

    sensor.describe(descriptor);
    assertThat(descriptor.languages()).containsOnly(Java.KEY);
    assertThat(descriptor.name()).isNotEmpty();
}
 
Example #12
Source File: CloverageSensorTest.java    From sonar-clojure with MIT License 5 votes vote down vote up
@Test
public void shouldConfigureSensor() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    cloverageSensor.describe(descriptor);
    assertThat(descriptor.name(), is("Cloverage"));
    assertTrue(descriptor.languages().contains("clj"));
    assertThat(descriptor.languages().size(), is(1));
}
 
Example #13
Source File: CombinedCoverageSensorTest.java    From sonar-ruby-plugin with MIT License 5 votes vote down vote up
@Test
public void testDescribe() {
    CombinedCoverageSensor sensor = new CombinedCoverageSensor(locSensor, coverageSensor);

    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    sensor.describe(descriptor);

    assertThat(descriptor.name()).isEqualTo("Combined SimpleCov and LOC sensor");
    assertThat(descriptor.languages()).containsExactly(Ruby.LANGUAGE_KEY);

}
 
Example #14
Source File: ScssAnalyzerSensorTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createScssSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("SCSS Analyzer Sensor");
  assertThat(descriptor.languages()).containsOnly("scss");
  assertThat(descriptor.type()).isEqualTo(InputFile.Type.MAIN);
}
 
Example #15
Source File: LessAnalyzerSensorTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createLessSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Less Analyzer Sensor");
  assertThat(descriptor.languages()).containsOnly("less");
  assertThat(descriptor.type()).isEqualTo(InputFile.Type.MAIN);
}
 
Example #16
Source File: EmbeddedCssAnalyzerSensorTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createEmbeddedCssSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Embedded CSS Analyzer Sensor");
  assertThat(descriptor.languages()).isEmpty();
  assertThat(descriptor.type()).isNull();
}
 
Example #17
Source File: CssAnalyzerSensorTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createCssSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("CSS Analyzer Sensor");
  assertThat(descriptor.languages()).containsOnly("css");
  assertThat(descriptor.type()).isEqualTo(InputFile.Type.MAIN);
}
 
Example #18
Source File: KibitSensorTest.java    From sonar-clojure with MIT License 5 votes vote down vote up
@Test
public void shouldConfigureSensor() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    kibitSensor.describe(descriptor);
    assertThat(descriptor.name(), is("Kibit"));
    assertTrue(descriptor.languages().contains("clj"));
    assertThat(descriptor.languages().size(), is(1));
}
 
Example #19
Source File: LeinNvdSensorTest.java    From sonar-clojure with MIT License 5 votes vote down vote up
@Test
public void shouldConfigureSensor() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    leinNvdSensor.describe(descriptor);
    assertThat(descriptor.name(), is("NVD"));
    assertTrue(descriptor.languages().contains("clj"));
    assertThat(descriptor.languages().size(), is(1));
}
 
Example #20
Source File: AncientSensorTest.java    From sonar-clojure with MIT License 5 votes vote down vote up
@Test
public void shouldConfigureSensor() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    ancientSensor.describe(descriptor);
    assertThat(descriptor.name(), is("Ancient"));
    assertTrue(descriptor.languages().contains("clj"));
    assertThat(descriptor.languages().size(), is(1));
}
 
Example #21
Source File: EastwoodSensorTest.java    From sonar-clojure with MIT License 5 votes vote down vote up
@Test
public void shouldConfigureSensor() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    eastwoodSensor.describe(descriptor);
    assertThat(descriptor.name(), is("Eastwood"));
    assertTrue(descriptor.languages().contains("clj"));
    assertThat(descriptor.languages().size(), is(1));
}