Search in sources :

Example 26 with DefaultSensorDescriptor

use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonarqube by SonarSource.

the class ModuleSensorOptimizerTest method should_run_analyzer_with_no_metadata.

@Test
public void should_run_analyzer_with_no_metadata() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
Also used : DefaultSensorDescriptor(org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor) Test(org.junit.Test)

Example 27 with DefaultSensorDescriptor

use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonar-web by SonarSource.

the class HtmlSensorTest method test_descriptor_sonarqube_9_3.

@Test
public void test_descriptor_sonarqube_9_3() {
    final boolean[] called = { false };
    DefaultSensorDescriptor sensorDescriptor = new DefaultSensorDescriptor() {

        public SensorDescriptor processesFilesIndependently() {
            called[0] = true;
            return this;
        }
    };
    SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 3), SonarQubeSide.SCANNER, SonarEdition.COMMUNITY);
    new HtmlSensor(sonarRuntime, null, null, new CheckFactory(new DefaultActiveRules(Collections.emptyList()))).describe(sensorDescriptor);
    assertThat(sensorDescriptor.name()).isEqualTo("HTML");
    assertThat(sensorDescriptor.languages()).isEmpty();
    assertTrue(called[0]);
}
Also used : DefaultActiveRules(org.sonar.api.batch.rule.internal.DefaultActiveRules) DefaultSensorDescriptor(org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor) SonarRuntime(org.sonar.api.SonarRuntime) CheckFactory(org.sonar.api.batch.rule.CheckFactory) Test(org.junit.Test)

Example 28 with DefaultSensorDescriptor

use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonar-web by SonarSource.

the class HtmlSensorTest method testDescriptor.

@Test
public void testDescriptor() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    sensor.describe(descriptor);
    assertThat(descriptor.name()).isEqualTo("HTML");
    assertThat(descriptor.languages()).isEmpty();
}
Also used : DefaultSensorDescriptor(org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor) Test(org.junit.Test)

Aggregations

DefaultSensorDescriptor (org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor)28 Test (org.junit.Test)26 TestInputFileBuilder (org.sonar.api.batch.fs.internal.TestInputFileBuilder)10 SonarRuntime (org.sonar.api.SonarRuntime)3 ActiveRules (org.sonar.api.batch.rule.ActiveRules)3 CheckFactory (org.sonar.api.batch.rule.CheckFactory)3 ActiveRulesBuilder (org.sonar.api.batch.rule.internal.ActiveRulesBuilder)3 DefaultActiveRules (org.sonar.api.batch.rule.internal.DefaultActiveRules)3 Test (org.junit.jupiter.api.Test)1 NewActiveRule (org.sonar.api.batch.rule.internal.NewActiveRule)1 Sensor (org.sonar.api.batch.sensor.Sensor)1 MapSettings (org.sonar.api.config.internal.MapSettings)1