This repository has been archived by the owner. It is now read-only.
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[JENKINS-13969] Update of regexp to support Eclipse 3.8 warnings.
- Loading branch information
Showing
with
126 additions
and 51 deletions.
- +11 −4 src/main/java/hudson/plugins/warnings/parser/EclipseParser.java
- +62 −0 src/test/java/hudson/plugins/warnings/parser/AbstractEclipseParserTest.java
- +1 −1 src/test/java/hudson/plugins/warnings/parser/DynamicDocumentParserTest.java
- +35 −46 src/test/java/hudson/plugins/warnings/parser/EclipseParserTest.java
- +17 −0 src/test/resources/hudson/plugins/warnings/parser/issue13969.txt
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,62 @@ | ||
package hudson.plugins.warnings.parser; | ||
|
||
import static junit.framework.Assert.*; | ||
import hudson.plugins.analysis.util.model.FileAnnotation; | ||
import hudson.plugins.analysis.util.model.Priority; | ||
|
||
import java.io.IOException; | ||
import java.util.Collection; | ||
import java.util.Iterator; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* Basic tests for the Eclipse parser. | ||
* | ||
* @author Ulli Hafner | ||
*/ | ||
public abstract class AbstractEclipseParserTest extends ParserTester { | ||
/** | ||
* Creates the parser under test. | ||
* | ||
* @return the created parser | ||
*/ | ||
protected AbstractWarningsParser createParser() { | ||
return new EclipseParser(); | ||
} | ||
|
||
/** | ||
* Returns the type of the parser. | ||
* | ||
* @return the type of the parser | ||
*/ | ||
protected String getType() { | ||
return new EclipseParser().getGroup(); | ||
} | ||
|
||
@Override | ||
protected String getWarningsFile() { | ||
return "eclipse.txt"; | ||
} | ||
|
||
/** | ||
* Parses a file with two deprecation warnings. | ||
* | ||
* @throws IOException | ||
* if the file could not be read | ||
*/ | ||
@Test | ||
public void parseDeprecation() throws IOException { | ||
Collection<FileAnnotation> warnings = createParser().parse(openFile()); | ||
|
||
assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 8, warnings.size()); | ||
|
||
Iterator<FileAnnotation> iterator = warnings.iterator(); | ||
FileAnnotation annotation = iterator.next(); | ||
checkWarning(annotation, | ||
3, | ||
"The serializable class AttributeException does not declare a static final serialVersionUID field of type long", | ||
"C:/Desenvolvimento/Java/jfg/src/jfg/AttributeException.java", | ||
getType(), "", Priority.NORMAL); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -7,7 +7,7 @@ | ||
* | ||
* @author Ulli Hafner | ||
*/ | ||
public class DynamicDocumentParserTest extends AbstractEclipseParserTest { | ||
private static final String TYPE = "Eclipse Dynamic"; | ||
|
||
@Override | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,17 @@ | ||
[INFO] Compiling 5 source files to /media/ssd/multi-x-processor/workspace/msgPM_Access/com.faktorzehn.pa2msgpm.core/target/classes | ||
[WARNING] /media/ssd/multi-x-processor/workspace/msgPM_Access/com.faktorzehn.pa2msgpm.core/src/com/faktorzehn/pa2msgpm/core/loader/PmModelImporter.java:[369,0] | ||
private boolean compare(List<String> rowTableValues, List<String> allowedValues) { | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
The method compare(List<String>, List<String>) from the type PmModelImporter is never used locally | ||
[WARNING] /media/ssd/multi-x-processor/workspace/msgPM_Access/com.faktorzehn.pa2msgpm.core/src/com/faktorzehn/pa2msgpm/core/loader/PmModelImporter.java:[391,0] | ||
private List<String> getTableValues(PropertyRestrictionType restrictionType) { | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
The method getTableValues(PropertyRestrictionType) from the type PmModelImporter is never used locally | ||
2 problems (2 warnings) | ||
|
||
|
||
[WARNING] /media/ssd/multi-x-processor/workspace/msgPM_Access/com.faktorzehn.pa2msgpm.core.test/src/com/faktorzehn/pa2msgpm/core/importer/PropertyImporterTest.java:[56,0] | ||
private static final OperationResponseType ERROR_RESPONSE = new OperationResponseType(1, "ERROR"); | ||
^^^^^^^^^^^^^^ | ||
The value of the field PropertyImporterTest.ERROR_RESPONSE is not used | ||
1 problem (1 warning) |