Search in sources :

Example 6 with FullBuildModel

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

the class ViolationsParserTest method getFullBuildModel.

protected FullBuildModel getFullBuildModel(ViolationsParser parser, String filename) throws IOException {
    URL url = getClass().getResource(filename);
    File xmlFile;
    try {
        xmlFile = new File(url.toURI());
    } catch (URISyntaxException e) {
        xmlFile = new File(url.getPath());
    }
    FullBuildModel model = new FullBuildModel();
    parser.parse(model, xmlFile.getParentFile(), xmlFile.getName(), null);
    model.cleanup();
    return model;
}
Also used : FullBuildModel(hudson.plugins.violations.model.FullBuildModel) URISyntaxException(java.net.URISyntaxException) File(java.io.File) URL(java.net.URL)

Example 7 with FullBuildModel

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

the class CodenarcParserTest method testParser2.

@Test
public void testParser2() throws Exception {
    FullBuildModel model = getFullBuildModel("CodeNarcReport2.xml");
    assertEquals("Number of violations is incorrect", 11, model.getCountNumber("codenarc"));
    assertEquals("Number of files is incorrect", 1, model.getFileModelMap().size());
}
Also used : FullBuildModel(hudson.plugins.violations.model.FullBuildModel) ViolationsParserTest(hudson.plugins.violations.ViolationsParserTest) Test(org.junit.Test)

Example 8 with FullBuildModel

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

the class CodenarcParserTest method testParseFullBuildModelFromFile.

@Test
public void testParseFullBuildModelFromFile() throws Exception {
    FullBuildModel model = getFullBuildModel("CodeNarcXmlReport.xml");
    FullFileModel fileModel = model.getFileModel("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)

Example 9 with FullBuildModel

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

the class FxCopParserTest method testParseFullBuildModelFileStringStringArray.

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

Example 10 with FullBuildModel

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

the class GendarmeParserTest method assertThatCriticalIssuesAreMarkedAsHigh.

@Issue("JENKINS-11227")
@Test
public void assertThatCriticalIssuesAreMarkedAsHigh() throws IOException {
    FullBuildModel model = getFullBuildModel("gendarme-2" + (File.separatorChar == '/' ? "_unix" : "") + ".xml");
    SortedSet<Violation> set = model.getFileModel(getOsDependentFilename("workspaceLeave\\Leave.Gui\\Views\\LeaveGanttView\\Column\\LeaveFooter.cs")).getTypeMap().get(GendarmeParser.TYPE_NAME);
    assertEquals("The severity is incorrect", Severity.HIGH, set.first().getSeverity());
}
Also used : Violation(hudson.plugins.violations.model.Violation) FullBuildModel(hudson.plugins.violations.model.FullBuildModel) Issue(org.jvnet.hudson.test.Issue) 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