Package hudson.plugins.analysis.util.model

Examples of hudson.plugins.analysis.util.model.FileAnnotation


            final AnnotationContainer container, final String defaultEncoding,
            final String fromString, final String toString) {
        long from = Long.parseLong(fromString);
        long to = Long.parseLong(toString);

        FileAnnotation fromAnnotation = container.getAnnotation(from);
        if (fromAnnotation instanceof DuplicateCode) {
            return new SourceDetail(owner, ((DuplicateCode)fromAnnotation).getLink(to), defaultEncoding);
        }
        return null;
    }
View Full Code Here


            return createTabDetail(owner, container.getAnnotations(), createGenericTabUrl(link), defaultEncoding);
        }
        else if (link.startsWith("source.")) {
            owner.checkPermission(Item.WORKSPACE);

            FileAnnotation annotation = container.getAnnotation(StringUtils.substringAfter(link, "source."));
            if (annotation.isInConsoleLog()) {
                LineRange lines = annotation.getLineRanges().iterator().next();
                return new ConsoleDetail(owner, lines.getStart(), lines.getEnd());
            }
            else {
                return new SourceDetail(owner, annotation, defaultEncoding);
            }
View Full Code Here

     *
     * @throws IOException in case of an IO error
     */
    @Test
    public void checkCorrectOffset() throws IOException {
        FileAnnotation annotation = createMock(FileAnnotation.class);

        expect(annotation.getFileName()).andReturn("").anyTimes();
        expect(annotation.getTempName((AbstractBuild<?, ?>)anyObject())).andReturn("").anyTimes();

        replay(annotation);

        SourceDetail source = new SourceDetail(null, annotation, null);

View Full Code Here

     */
    @SuppressWarnings("unchecked")
    private void split(final String fileName, final List<LineRange> lineRanges) throws IOException {
        InputStream stream = SourceDetailTest.class.getResourceAsStream("AbortException.txt");

        FileAnnotation annotation = createMock(FileAnnotation.class);

        expect(annotation.getLineRanges()).andReturn(lineRanges);
        expect(annotation.getFileName()).andReturn("").anyTimes();
        expect(annotation.getTempName((AbstractBuild<?, ?>)anyObject())).andReturn("").anyTimes();
        expect(annotation.getMessage()).andReturn("Message ").anyTimes();
        expect(annotation.getToolTip()).andReturn("Tooltip").anyTimes();

        replay(annotation);

        SourceDetail source = new SourceDetail(null, annotation, null);

View Full Code Here

     *             in case of an error
     */
    @Test
    public void testCountingOfAddAnnotation() {
        ParserResult result = new ParserResult();
        FileAnnotation warning = mockWarning("file.txt");
        assertEquals("Warning correctly added.", 1, result.addAnnotation(warning));
        assertEquals("Warning correctly not added.", 0, result.addAnnotation(warning));
    }
View Full Code Here

    @Test
    public void testSimpleFileNameMapping() throws Exception {
        String[] workspaceFiles = {SCANNED_FILENAME};
        ParserResult result = createParserResult(workspaceFiles);

        FileAnnotation warning = mockWarning("file.txt");
        result.addAnnotation(warning);

        verify(warning).setFileName(FOUND_FILE_NAME);
    }
View Full Code Here

    @Test
    public void testFileNameMappingWithPrefix() throws Exception {
        String[] workspaceFiles = {SCANNED_FILENAME};
        ParserResult result = createParserResult(workspaceFiles);

        FileAnnotation warning = mockWarning("to/file.txt");
        result.addAnnotation(warning);

        verify(warning).setFileName(FOUND_FILE_NAME);
    }
View Full Code Here

    @Test
    public void testWindowsFileNameMappingWithPrefix() throws Exception {
        String[] workspaceFiles = {SCANNED_FILENAME_WINDOWS};
        ParserResult result = createParserResult(workspaceFiles);

        FileAnnotation warning = mockWarning("to/file.txt");
        result.addAnnotation(warning);

        verify(warning).setFileName(FOUND_FILE_NAME);
    }
View Full Code Here

    @Test
    public void testDuplicate() throws Exception {
        String[] workspaceFiles = {SCANNED_FILENAME, OTHER_SCANNED_FILE};
        ParserResult result = createParserResult(workspaceFiles);

        FileAnnotation warning = mockWarning("file.txt");
        result.addAnnotation(warning);

        verify(warning, never()).setFileName(anyString());
    }
View Full Code Here

     */
    @Test
    public void testUniquePrefixDuplicate() throws Exception {
        ParserResult result = createParserResult(new String[] {SCANNED_FILENAME, OTHER_SCANNED_FILE});

        FileAnnotation warning = mockWarning("path/to/file.txt");
        result.addAnnotation(warning);

        verify(warning).setFileName(FOUND_FILE_NAME);
    }
View Full Code Here

TOP

Related Classes of hudson.plugins.analysis.util.model.FileAnnotation

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.