Search in sources :

Example 11 with FullBuildModel

use of hudson.plugins.violations.model.FullBuildModel in project violations-plugin by jenkinsci.

the class GendarmeParserTest method assertThatSourceFileForTypeDefectsIsAddedFileModel.

@Issue("JENKINS-11227")
@Test
public void assertThatSourceFileForTypeDefectsIsAddedFileModel() throws IOException {
    FullBuildModel model = getFullBuildModel("gendarme-2" + (File.separatorChar == '/' ? "_unix" : "") + ".xml");
    assertEquals("Number of files is incorrect", 7, model.getFileModelMap().size());
}
Also used : FullBuildModel(hudson.plugins.violations.model.FullBuildModel) Issue(org.jvnet.hudson.test.Issue) ViolationsParserTest(hudson.plugins.violations.ViolationsParserTest) Test(org.junit.Test)

Example 12 with FullBuildModel

use of hudson.plugins.violations.model.FullBuildModel in project violations-plugin by jenkinsci.

the class JcReportParserTest method testParseFullBuildModelFileStringStringArray.

@Test
public void testParseFullBuildModelFileStringStringArray() throws Exception {
    FullBuildModel model = getFullBuildModel("jcoderz-report.xml");
    assertEquals("Number of violations is incorrect", 42, model.getCountNumber("jcreport"));
    assertEquals("Number of files is incorrect", 3, model.getFileModelMap().size());
}
Also used : FullBuildModel(hudson.plugins.violations.model.FullBuildModel) ViolationsParserTest(hudson.plugins.violations.ViolationsParserTest) Test(org.junit.Test)

Example 13 with FullBuildModel

use of hudson.plugins.violations.model.FullBuildModel in project violations-plugin by jenkinsci.

the class JsLintParserTest method testParseWithMultipleFile.

@Test
public void testParseWithMultipleFile() throws Exception {
    FullBuildModel model = getFullBuildModel("multi.xml");
    assertEquals(102, model.getCountNumber(JsLintParser.TYPE_NAME));
    assertEquals(2, model.getFileModelMap().size());
    assertScriptaculous(model);
    assertPrototype(model);
}
Also used : FullBuildModel(hudson.plugins.violations.model.FullBuildModel) ViolationsParserTest(hudson.plugins.violations.ViolationsParserTest) Test(org.junit.Test)

Example 14 with FullBuildModel

use of hudson.plugins.violations.model.FullBuildModel in project violations-plugin by jenkinsci.

the class StyleCopParserTest method testViolationCompareTo.

/**
 * Test to catch a NPE in Violation.compareTo() because violation has to little data
 */
@Test
public void testViolationCompareTo() throws Exception {
    FullBuildModel model = getFullBuildModel("onefile.xml");
    Iterator<Violation> iterator = model.getFileModel("MainClass.cs").getTypeMap().get(StyleCopParser.TYPE_NAME).descendingIterator();
    Violation v = iterator.next();
    Violation otherV = iterator.next();
    assertTrue("compareTo() should return false", v.compareTo(otherV) != 0);
}
Also used : Violation(hudson.plugins.violations.model.Violation) FullBuildModel(hudson.plugins.violations.model.FullBuildModel) ViolationsParserTest(hudson.plugins.violations.ViolationsParserTest) Test(org.junit.Test)

Example 15 with FullBuildModel

use of hudson.plugins.violations.model.FullBuildModel in project violations-plugin by jenkinsci.

the class CodenarcParserTest method testParseFullBuildModelFromFileWithSourceDirectory.

@Test
public void testParseFullBuildModelFromFileWithSourceDirectory() throws Exception {
    FullBuildModel model = getFullBuildModel("CodeNarcXmlReportWithSourceDirectory.xml");
    FullFileModel fileModel = model.getFileModel("webapps/testapp/grails-app/controllers/LoginController.groovy");
    assertEquals("Number of violations is incorrect", 10, model.getCountNumber("codenarc"));
    assertEquals("Number of files is incorrect", 7, model.getFileModelMap().size());
    assertNotNull("LoginController model is null", fileModel.getSourceFile());
}
Also used : FullBuildModel(hudson.plugins.violations.model.FullBuildModel) FullFileModel(hudson.plugins.violations.model.FullFileModel) ViolationsParserTest(hudson.plugins.violations.ViolationsParserTest) Test(org.junit.Test)

Aggregations

FullBuildModel (hudson.plugins.violations.model.FullBuildModel)25 ViolationsParserTest (hudson.plugins.violations.ViolationsParserTest)23 Test (org.junit.Test)23 Violation (hudson.plugins.violations.model.Violation)8 FullFileModel (hudson.plugins.violations.model.FullFileModel)3 Issue (org.jvnet.hudson.test.Issue)3 File (java.io.File)2 GenerateXML (hudson.plugins.violations.generate.GenerateXML)1 IOException2 (hudson.util.IOException2)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1