-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add successful and skipped tests to payload. (#3)
* Add successful and skipped tests to payload. This commit adds a BuildCompleteListener that listens on the PostBuildCompletedEvent. The testcases provided in the BuildContext get saved into a Map and can be accessed from the ChainCompletedNotification. See the comment above the Map cachedTestResults in the class ServerNotificationRecipient for more information. Updated Bamboo-api-version. Updated sample payload shown on README. * Use ConcurrentHashMap. Multiple build could finish at the same time, therefor we have to make sure it won't cause any unwanted behaviour. * Ensure backwards-compatibility.
- Loading branch information
Showing
7 changed files
with
288 additions
and
96 deletions.
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
20 changes: 20 additions & 0 deletions
20
src/main/java/de/tum/in/www1/bamboo/server/BuildCompleteListener.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.tum.in.www1.bamboo.server; | ||
|
||
import com.atlassian.bamboo.v2.build.CurrentBuildResult; | ||
import com.atlassian.bamboo.v2.build.events.PostBuildCompletedEvent; | ||
import com.atlassian.event.api.EventListener; | ||
|
||
public class BuildCompleteListener { | ||
|
||
@EventListener | ||
public void onPostBuildComplete(final PostBuildCompletedEvent postBuildCompletedEvent) { | ||
CurrentBuildResult currentBuildResult = postBuildCompletedEvent.getContext().getBuildResult(); | ||
|
||
TestResultsContainer testResultsContainer = new TestResultsContainer(postBuildCompletedEvent.getPlanResultKey(), currentBuildResult.getSuccessfulTestResults(), currentBuildResult.getSkippedTestResults(), currentBuildResult.getFailedTestResults()); | ||
ServerNotificationRecipient.getCachedTestResults().put(postBuildCompletedEvent.getPlanResultKey().toString(), testResultsContainer); | ||
|
||
// Remove old TestResultsContainer based on their initialization timestamp | ||
ServerNotificationRecipient.clearOldTestResultsContainer(); | ||
} | ||
|
||
} |
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
Oops, something went wrong.