Skip to content

Commit

Permalink
Merge branch 'JENKINS-48932/jep-200' of git://github.com/oleg-nenashe…
Browse files Browse the repository at this point in the history
…v/build-failure-analyzer-plugin into oleg-nenashev-JENKINS-48932/jep-200
  • Loading branch information
rsandell committed Jan 15, 2018
2 parents 9919eae + e20dd7d commit ec1aaeb
Show file tree
Hide file tree
Showing 29 changed files with 153 additions and 88 deletions.
1 change: 1 addition & 0 deletions Jenkinsfile
@@ -1,5 +1,6 @@
buildPlugin(
platforms: ['linux'],
jenkinsVersions: [null],
findbugs: [run: true, archive: true],
checkstyle: [archive: true, unstableTotalAll: 0]
)
65 changes: 37 additions & 28 deletions pom.xml
Expand Up @@ -11,15 +11,15 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.580.1</version>
<version>3.2</version>
<!--<relativePath>../pom.xml</relativePath>-->
</parent>

<properties>
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<powermock.version>1.5.6</powermock.version>
<mockito.version>1.9.5</mockito.version>
<findbugs.version>3.0.1</findbugs.version>
<powermock.version>1.6.6</powermock.version>
<checkstyle.version>2.13</checkstyle.version>
</properties>

Expand Down Expand Up @@ -66,7 +66,7 @@
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public</url>
<url>https://repo.jenkins-ci.org/public</url>
</repository>
<repository>
<id>powermock-repo</id>
Expand All @@ -77,21 +77,26 @@
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public</url>
<url>https://repo.jenkins-ci.org/public</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>com.sonyericsson.hudson.plugins.gerrit</groupId>
<artifactId>gerrit-trigger</artifactId>
<version>2.15.0</version>
<version>2.27.2</version>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
</exclusion>
<exclusion>
<!-- Provided by the plugin -->
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -116,6 +121,11 @@
<artifactId>junit</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>apache-httpcomponents-client-4-api</artifactId>
<version>4.5.3-2.0</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
Expand All @@ -142,6 +152,13 @@
<artifactId>guava</artifactId>
<version>11.0.1</version>
</dependency>
<dependency>
<!-- Dependency bound conflict between MQ notifier and JTH -->
<!-- TODO: remove once MQ Notifier is updated -->
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.cloudbees.plugins</groupId>
<artifactId>build-flow-plugin</artifactId>
Expand Down Expand Up @@ -186,12 +203,6 @@
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
Expand All @@ -201,7 +212,13 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>2.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -216,6 +233,12 @@
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
Expand All @@ -233,18 +256,6 @@
<reuseForks>false</reuseForks>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -287,7 +298,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.version}</version>
<configuration>
<xmlOutput>true</xmlOutput>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
Expand Down Expand Up @@ -341,7 +351,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.version}</version>
<configuration>
<xmlOutput>true</xmlOutput>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
Expand Down
Expand Up @@ -89,7 +89,8 @@ public abstract class BfaGraphAction implements RootAction {
protected static final int DEFAULT_GRAPH_HEIGHT = 500;

/**
* Constant for "ABORTED"-cause (used to exclude such {@link FailureCause}s).
* Constant for "ABORTED"-cause (used to exclude such
* {@link com.sonyericsson.jenkins.plugins.bfa.model.FailureCause}s).
*/
protected static final String EXCLUDE_ABORTED = "ABORTED";

Expand Down
Expand Up @@ -503,7 +503,7 @@ public static boolean needToAnalyze(Result result) {
*
* @param build the build
* @return true if it should be scanned.
* @see {@link #shouldScan(Job)}
* @see #shouldScan(Job)
*/
public static boolean shouldScan(Run build) {
return shouldScan(build.getParent());
Expand Down
Expand Up @@ -119,7 +119,7 @@ public static int getExpirationTime() {
* Get the Graph corresponding to the specified key.
* If there is no cached graph for the specified key
* (or it has been invalidated) the specified
* Callable<Graph> will be called.
* {@code Callable<Graph>} will be called.
* @param key The key for the graph
* @param callable A callback to construct the graph that wasn't cached
* @return A cached graph, or a new graph if there was no cached instance
Expand Down
Expand Up @@ -39,7 +39,7 @@ public enum GraphType {
BAR_CHART_CAUSES_SMALL(1),

/**
* Constant for bar chart with {@link FailureCause}s.
* Constant for bar chart with {@link com.sonyericsson.jenkins.plugins.bfa.model.FailureCause}s.
*/
BAR_CHART_CAUSES(2),

Expand All @@ -54,7 +54,7 @@ public enum GraphType {
BAR_CHART_BUILD_NBRS(4),

/**
* Constant for pie chart with {@link FailureCause}s.
* Constant for pie chart with {@link com.sonyericsson.jenkins.plugins.bfa.model.FailureCause}s.
*/
PIE_CHART_CAUSES(5),

Expand All @@ -64,7 +64,7 @@ public enum GraphType {
PIE_CHART_CATEGORIES(6),

/**
* Constant for time series chart with {@link FailureCause}s.
* Constant for time series chart with {@link com.sonyericsson.jenkins.plugins.bfa.model.FailureCause}s.
*/
TIME_SERIES_CHART_CAUSES(7),

Expand Down
Expand Up @@ -166,7 +166,7 @@ public FailureCause() {

/**
* Validates this FailureCause. Checks for: {@link #doCheckName(String)}, {@link #doCheckDescription(String)},
* Indications.size > 0. and {@link com.sonyericsson.jenkins.plugins.bfa.model.indication.Indication#validate()}.
* Indications.size &gt; 0. and {@link com.sonyericsson.jenkins.plugins.bfa.model.indication.Indication#validate()}.
*
* @param newName the name to validate
* @param newDescription the description
Expand Down
Expand Up @@ -38,7 +38,6 @@
/**
* There is no general way to find downstream build in Jenkins Core. Different
* plugin have there own way of keeping this information.
* <p/>
* Extend this class and implement
* {@link #getDownstreamBuilds(hudson.model.Run)}
* in a way suitable for the plugin
Expand Down
Expand Up @@ -36,7 +36,6 @@

/**
* Get downstream builds for the Parameterized Trigger Plugin.
* <p/>
* We want to avoid having dependencies to other plugins thus using reflection.
*
* @author Jan-Olof Sivtoft
Expand Down
Expand Up @@ -122,8 +122,8 @@ public void queueTask(ScanOnDemandTask task) {

/**
* Shuts down the executor(s).
* Gracefully waits for {@link #WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT} seconds for all jobs to finish
* before forcefully shutting them down.
* Gracefully waits for {@link ScanOnDemandVariables#getSodWaitForJobShutdownTimeout()}
* seconds for all jobs to finish before forcefully shutting them down.
*/
public static void shutdown() {
if (instance != null && instance.executor != null) {
Expand Down
Expand Up @@ -31,7 +31,7 @@
import hudson.matrix.MatrixRun;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import java.util.logging.Logger;

import java.io.IOException;
import java.util.List;
Expand Down
Expand Up @@ -22,6 +22,7 @@
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
<f:section title="${%Build failure analyzer}">
<f:entry title="${%Enabled}"
Expand Down
Expand Up @@ -21,7 +21,7 @@
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">

</j:jelly>
Expand Up @@ -21,6 +21,7 @@
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:entry title="${%Host}">
<f:textbox name="host" value="${instance.host}"
Expand Down
Expand Up @@ -21,7 +21,7 @@
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">

<f:entry title="${%Show text}" field="showText">
Expand Down
Expand Up @@ -21,7 +21,7 @@
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:optionalBlock field="doNotScan" title="${%Do not Scan failed builds}" inline="true">
<f:description>
Expand Down
Expand Up @@ -22,7 +22,7 @@
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">


Expand Down
Expand Up @@ -22,7 +22,7 @@
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">


Expand Down
Expand Up @@ -24,6 +24,7 @@

package com.sonyericsson.jenkins.plugins.bfa;

import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.ToGerritRunListener;
Expand Down Expand Up @@ -137,7 +138,7 @@ public void testOneIndicationFound() throws Exception {
assertEquals(FORMATTED_DESCRIPTION, foundFailureCause.getDescription());
FoundIndication foundIndication = foundFailureCause.getIndications().get(0);
String id = foundIndication.getMatchingHash() + foundFailureCause.getId();
HtmlElement focus = document.getElementById(id);
DomElement focus = page.getElementById(id);
assertNotNull(focus);

List<HtmlElement> errorElements = document.getElementsByAttribute("span", "title", foundFailureCause.getName());
Expand Down Expand Up @@ -176,7 +177,7 @@ public void testOneMultilineIndicationFound() throws Exception {
assertEquals(FORMATTED_DESCRIPTION, foundFailureCause.getDescription());
FoundIndication foundIndication = foundFailureCause.getIndications().get(0);
String id = foundIndication.getMatchingHash() + foundFailureCause.getId();
HtmlElement focus = document.getElementById(id);
DomElement focus = page.getElementById(id);
assertNotNull(focus);

List<HtmlElement> errorElements = document.getElementsByAttribute("span", "title", foundFailureCause.getName());
Expand Down Expand Up @@ -228,15 +229,15 @@ public void testTwoIndicationsSameLine() throws Exception {
assertTrue(causeDescriptions.remove(description));
FoundIndication foundIndication = foundFailureCause.getIndications().get(0);
String id = foundIndication.getMatchingHash() + foundFailureCause.getId();
HtmlElement focus = document.getElementById(id);
DomElement focus = page.getElementById(id);
assertNotNull(focus);

foundFailureCause = causeListFromAction.get(1);
description = foundFailureCause.getDescription();
assertTrue(causeDescriptions.remove(description));
foundIndication = foundFailureCause.getIndications().get(0);
id = foundIndication.getMatchingHash() + foundFailureCause.getId();
focus = document.getElementById(id);
focus = page.getElementById(id);
assertNotNull(focus);
assertTrue(causeDescriptions.isEmpty());

Expand Down
Expand Up @@ -24,6 +24,7 @@

package com.sonyericsson.jenkins.plugins.bfa;

import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
Expand Down Expand Up @@ -241,7 +242,7 @@ public void testMakeModificationUpdatesModificationList() throws Exception {
HtmlAnchor firstCauseLink = (HtmlAnchor)table.getCellAt(1, 0).getFirstChild();
HtmlPage editPage = firstCauseLink.click();

HtmlElement modList = editPage.getElementById("modifications");
DomElement modList = editPage.getElementById("modifications");
int firstNbrOfModifications = modList.getChildNodes().size();

editPage.getElementByName("_.comment").setTextContent("new comment");
Expand Down Expand Up @@ -270,7 +271,7 @@ public void testNoMongoDB() throws Exception {
Whitebox.setInternalState(PluginImpl.getInstance(), kb);
WebClient web = createWebClient();
HtmlPage page = web.goTo(CauseManagement.URL_NAME);
HtmlElement element = page.getElementById("errorMessage");
DomElement element = page.getElementById("errorMessage");
assertNotNull(element);
}

Expand Down

0 comments on commit ec1aaeb

Please sign in to comment.