Skip to content

Commit

Permalink
[FIXED JENKINS-27086] Use aggregated warnings in analysis collector.
Browse files Browse the repository at this point in the history
Also refactored the acceptance tests for analysis collector in order to get the warnings plugin integrated. Note that this requires analysis-core 1.71.
  • Loading branch information
uhafner committed Mar 15, 2015
1 parent d8a06ee commit da918c3
Show file tree
Hide file tree
Showing 9 changed files with 1,178 additions and 190 deletions.
Expand Up @@ -177,9 +177,9 @@ protected String asTrimmedString(final WebElement webElement) {
}

/**
* Returns a list of trimmed contens of a list of {@link org.openqa.selenium.WebElement}s.
* Returns a list of trimmed contents of a list of {@link org.openqa.selenium.WebElement}s.
*
* @param elems the list whose contens shall be trimmed
* @param elems the list whose contents shall be trimmed
* @return the trimmed strings as list
*/
protected List<String> asTrimmedStringList(final List<WebElement> elems) {
Expand Down
Expand Up @@ -245,4 +245,15 @@ protected void ensureAdvancedClicked() {
advanced.click();
}
}

/**
* Returns the repeatable add button for the specified property.
*
* @param propertyName the name of the repeatable property
* @return the selected repeatable add button
* @since 1.71 (analysis-core)
*/
protected Control repeatableAddButton(final String propertyName) {
return control(by.xpath("//div[@id='" + propertyName + "']//button[contains(@path,'repeatable-add')]"));
}
}
Expand Up @@ -12,44 +12,55 @@
*/
@Describable("Scan for compiler warnings")
public class WarningsBuildSettings extends AnalysisFreestyleSettings {
private Control addConsoleLogScanner = control("repeatable-add");
private Control addWorkspaceFileScanner = control("repeatable-add[1]");
private static final String CONSOLE_PARSERS = "consoleParsers";
private static final String FILE_PARSERS = "parserConfigurations";

public WarningsBuildSettings(Job parent, String path) {
private Control consoleParsers = repeatableAddButton(CONSOLE_PARSERS);
private Control fileParsers = repeatableAddButton(FILE_PARSERS);

/**
* Creates a new instance of {@code WarningsBuildSettings}.
*
* @param parent the job containing the publisher
* @param path the path to the page area
*/
public WarningsBuildSettings(final Job parent, final String path) {
super(parent, path);
}

public void addConsoleScanner(String caption) {
addConsoleLogScanner.click();
public void addConsoleScanner(final String caption) {
consoleParsers.click();
elasticSleep(1000);
String path = last(by.xpath("//div[@name='consoleParsers']")).getAttribute("path");

PageArea a = new PageAreaImpl(getPage(), path) {
};
a.control("parserName").select(caption);
PageArea repeatable = getRepeatableAreaOf(CONSOLE_PARSERS);
repeatable.control("parserName").select(caption);
}

public void addWorkspaceFileScanner(String caption, String pattern) {
addWorkspaceFileScanner.click();
public void addWorkspaceFileScanner(final String caption, final String pattern) {
fileParsers.click();
elasticSleep(1000);
String path = last(by.xpath("//div[@name='parserConfigurations']")).getAttribute("path");

PageArea a = new PageAreaImpl(getPage(), path) {
};
a.control("pattern").set(pattern);
a.control("parserName").select(caption);
PageArea repeatable = getRepeatableAreaOf(FILE_PARSERS);
repeatable.control("pattern").set(pattern);
repeatable.control("parserName").select(caption);
}

public void addWarningsToInclude(String pattern){
ensureAdvancedClicked();
private PageArea getRepeatableAreaOf(final String propertyName) {
String path = last(by.xpath("//div[@name='" + propertyName + "']")).getAttribute("path");

find(by.xpath("//input[@name='_.includePattern']")).sendKeys(pattern);
return new PageAreaImpl(WarningsBuildSettings.this.getPage(), path) {};
}

public void addWarningsToInclude(final String value) {
setPattern("include", value);
}

public void addWarningsToIgnore(final String value) {
setPattern("exclude", value);
}

public void addWarningsToIgnore(String pattern){
private void setPattern(final String name, final String value) {
ensureAdvancedClicked();

find(by.xpath("//input[@name='_.excludePattern']")).sendKeys(pattern);
find(by.xpath("//input[@name='_." + name + "Pattern']")).sendKeys(value);
}
}

0 comments on commit da918c3

Please sign in to comment.