Package org.sonar.api.rules

Examples of org.sonar.api.rules.XMLRuleParser


import org.sonar.api.config.Settings;

public class CxxValgrindRuleRepositoryTest {
  @Test
  public void shouldContainProperNumberOfRules() {
    CxxValgrindRuleRepository repo = new CxxValgrindRuleRepository(mock(ServerFileSystem.class), new XMLRuleParser(), new Settings());
    assertEquals(repo.createRules().size(), 16);
  }
View Full Code Here


  public void containsValidFormatInExtensionRulesOldFormat() {
    ServerFileSystem filesystem = mock(ServerFileSystem.class);
    ArrayList<File> extensionFile = new ArrayList<File>();
    extensionFile.add(TestUtils.loadResource("/org/sonar/plugins/cxx/rules-repository/CustomRulesOldFormat.xml"));
    when(filesystem.getExtensions(CxxValgrindRuleRepository.KEY, "xml")).thenReturn(extensionFile);
    CxxValgrindRuleRepository repo = new CxxValgrindRuleRepository(filesystem, new XMLRuleParser(), new Settings());
    assertEquals(repo.createRules().size(), 18);
  }
View Full Code Here

  public void containsValidFormatInExtensionRulesNewFormat() {
    ServerFileSystem filesystem = mock(ServerFileSystem.class);
    ArrayList<File> extensionFile = new ArrayList<File>();
    extensionFile.add(TestUtils.loadResource("/org/sonar/plugins/cxx/rules-repository/CustomRulesNewFormat.xml"));
    when(filesystem.getExtensions(CxxValgrindRuleRepository.KEY, "xml")).thenReturn(extensionFile);
    CxxValgrindRuleRepository repo = new CxxValgrindRuleRepository(filesystem, new XMLRuleParser(), new Settings());
    assertEquals(repo.createRules().size(), 17);
  }
View Full Code Here

  public void containsInvalidFormatInExtensionRulesNewFormat() {
    ServerFileSystem filesystem = mock(ServerFileSystem.class);
    ArrayList<File> extensionFile = new ArrayList<File>();
    extensionFile.add(TestUtils.loadResource("/org/sonar/plugins/cxx/rules-repository/CustomRulesInvalid.xml"));
    when(filesystem.getExtensions(CxxValgrindRuleRepository.KEY, "xml")).thenReturn(extensionFile);
    CxxValgrindRuleRepository repo = new CxxValgrindRuleRepository(filesystem, new XMLRuleParser(), new Settings());
    repo.createRules();
  }
View Full Code Here

  public void containsEmptyExtensionRulesFile() {
    ServerFileSystem filesystem = mock(ServerFileSystem.class);
    ArrayList<File> extensionFile = new ArrayList<File>();
    extensionFile.add(TestUtils.loadResource("/org/sonar/plugins/cxx/rules-repository/CustomRulesEmptyFile.xml"));
    when(filesystem.getExtensions(CxxValgrindRuleRepository.KEY, "xml")).thenReturn(extensionFile);
    CxxValgrindRuleRepository repo = new CxxValgrindRuleRepository(filesystem, new XMLRuleParser(), new Settings());
    repo.createRules();
  }
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

  @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

  @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

public class CxxCppCheckRuleRepositoryTest {
  @Test
  public void createRulesTest() {
    CxxCppCheckRuleRepository rulerep = new CxxCppCheckRuleRepository(
        mock(ServerFileSystem.class), new XMLRuleParser(), new Settings());
    assertEquals(323, rulerep.createRules().size());
  }
View Full Code Here

  @Test
  public void createRulesTest() {
    CxxVeraxxRuleRepository rulerep = new CxxVeraxxRuleRepository(
        mock(ServerFileSystem.class),
        new XMLRuleParser(), new Settings());
    assertThat(rulerep.createRules()).hasSize(28);
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.rules.XMLRuleParser

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.