Package org.sonar.api.config

Examples of org.sonar.api.config.Settings


    issuable = TestUtils.mockIssuable();
    perspectives = TestUtils.mockPerspectives(issuable);
    fs = TestUtils.mockFileSystem();
    profile = mock(RulesProfile.class);
    context = mock(SensorContext.class);
    settings = new Settings();
    File resourceMock = mock(File.class);
    when(context.getResource((File) anyObject())).thenReturn(resourceMock);
  }
View Full Code Here


    verify(issuable, times(0)).addIssue(any(Issue.class));
  }

  @Test
  public void shouldReportNoViolationsIfNoReportFound() {
    settings = new Settings();
    settings.setProperty(CxxExternalRulesSensor.REPORT_PATH_KEY, "externalrules-reports/noreport.xml");
    sensor = new CxxExternalRulesSensor(perspectives, settings, fs, profile);
    sensor.analyse(project, context);
    verify(issuable, times(0)).addIssue(any(Issue.class));
  }
View Full Code Here

    verify(issuable, times(0)).addIssue(any(Issue.class));
  }

  @Test(expected = SonarException.class)
  public void shouldThrowInCaseOfATrashyReport() {
    settings = new Settings();
    settings.setProperty(CxxExternalRulesSensor.REPORT_PATH_KEY, "externalrules-reports/externalrules-result-invalid.xml");
    sensor = new CxxExternalRulesSensor(perspectives, settings, fs, profile);
    sensor.analyse(project, context);
  }
View Full Code Here

    sensor.analyse(project, context);
  }

  @Test
  public void shouldReportOnlyOneViolationAndRemoveDuplicates() {
    settings = new Settings();
    settings.setProperty(CxxExternalRulesSensor.REPORT_PATH_KEY, "externalrules-reports/externalrules-with-duplicates.xml");
    sensor = new CxxExternalRulesSensor(perspectives, settings, fs, profile);
    sensor.analyse(project, context);
    verify(issuable, times(1)).addIssue(any(Issue.class));
  }
View Full Code Here

          "    </rule></rules>";

  @Test
  public void verifyTemplateRuleIsFound() {
    CxxExternalRuleRepository rulerep = new CxxExternalRuleRepository(
        new XMLRuleParser(), new Settings());
    assertThat(rulerep.createRules()).hasSize(1);
  }
View Full Code Here

    assertThat(rulerep.createRules()).hasSize(1);
  }

  @Test
  public void createNonEmptyRulesTest() {
    Settings settings = new Settings();
    settings.appendProperty(CxxExternalRuleRepository.RULES_KEY, profile);
    CxxExternalRuleRepository rulerep = new CxxExternalRuleRepository(
      new XMLRuleParser(), settings);
    assertThat(rulerep.createRules()).hasSize(3);
  }
View Full Code Here

    assertThat(rulerep.createRules()).hasSize(3);
  }

  @Test
  public void createNullRulesTest() {
    Settings settings = new Settings();
    settings.appendProperty(CxxExternalRuleRepository.RULES_KEY, null);
    CxxExternalRuleRepository rulerep = new CxxExternalRuleRepository(
      new XMLRuleParser(), settings);
    assertThat(rulerep.createRules()).hasSize(1);
  }
View Full Code Here

  @Before
  public void setUp() {
    project = TestUtils.mockProject();
    fs = TestUtils.mockFileSystem();
    sensor = new CxxXunitSensor(new Settings(), fs, TestUtils.mockCxxLanguage());
    context = mock(SensorContext.class);
  }
View Full Code Here

    verify(context, times(4)).saveMeasure((org.sonar.api.resources.File) anyObject(), any(Measure.class));
  }

  @Test
  public void shouldFindTheSourcesOfTheTestfiles() {
    Settings config = new Settings();
    config.setProperty(CxxXunitSensor.REPORT_PATH_KEY, "xunit-report.xml");

    List<File> sourceDirs = new ArrayList<File>();
    File baseDir = TestUtils.loadResource("/org/sonar/plugins/cxx/finding-sources-project");
    sourceDirs.add(baseDir);
View Full Code Here

                     is(new File(baseDir, "tests1/Test6_B.cc").getPath())));
  }

  @Test
  public void shouldReportNothingWhenNoReportFound() {
    Settings config = new Settings();
    config.setProperty(CxxXunitSensor.REPORT_PATH_KEY, "notexistingpath");

    sensor = new CxxXunitSensor(config, TestUtils.mockFileSystem(), TestUtils.mockCxxLanguage());

    sensor.analyse(project, context);
View Full Code Here

TOP

Related Classes of org.sonar.api.config.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.