History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CC-493
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Rollo
Reporter: Allan Wick
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
CruiseControl

Expose isLastBuildSuccessful

Created: 09/Jul/06 10:52 PM   Updated: 19/Nov/08 06:28 PM
Component/s: Core Application, Reporting Application
Affects Version/s: None
Fix Version/s: 2.7.3

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: 1. Text File cruisecontrol_271_jmx.patch (5 kb)
2. Text File jmx.patch (8 kb)
3. Text File jmx.patch (31 kb)
4. Text File patch.txt (1 kb)



 Description  « Hide
I would like to have the isLastBuildSuccessful attribute exposed via JMX to allow for monitoring applications to determine if the last build is successful.

 All   Comments   Work Log   Change History      Sort Order:
Allan Wick [09/Jul/06 10:53 PM]
Here is the code I have created and tested.

James Wilson [25/Feb/07 04:47 AM]
I will attach my larger patch that includes this change, as well as exposing the list of Project names as an array. This will extend the level of information exposed to JMX applications that do not include the CruiseControl classes. I then use this array of project names to query each project (via it's ObjectName) to find the build status. This is were my patch and this existing CC-493 overlap.

These additions are in support of a Java SaverBeans screen saver I wrote to have a screen saver that shows the status of each project. My next step will be to setup a home on sourceforge or java.net

Included in the patch are the unit tests to cover the source.

-James

James Wilson [25/Feb/07 04:51 AM]
source and unit tests

Jeffrey Fredrick [25/Feb/07 02:36 PM]
the jmx.patch file isn't right. the patch for the test is fine but for the actual product code it just has a lot of deleted files.

James Wilson [06/Mar/07 06:13 AM]
In response to Jeffrey's comments on 25-Feb, I created a new (jmx.patch) patch file. I also confirmed that the trunk still contains all four source files modified (two interfaces and two classes)
  CruiseControlControllerJMXAdaptor.java
  CruiseControlMBean.java
  ProjectController.java
  ProjectMBean.java

Am I not supposed to be working from the trunk but rather a particular branch? If the patch file is still not right, please be as specific as possible regarding any problems so that I may correct them.

-James

James Wilson [25/Mar/07 04:32 AM]
I've published the SaverBeans screen saver -- "CruiseSaver" -- that relies on this patch to SourceForge -- https://sourceforge.net/projects/cruisesaver/. I know this is a shameless plug, but hopefully it will be seen as a worthy contribution in the CruiseControl community.

-James

James Wilson [27/Mar/08 06:31 AM]
I have updated the patch to match the 2.7.1 release branch. It includes the two jmx changes for additional functions and basic unit tests.

Dan Rollo [12/Jun/08 03:18 AM]
I'm hoping to get a chance to apply the isLastBuildSuccessful changes, but I'm not sure a new array of project name is really needed.
Related to this, I recently committed changes that add toString() to ProjectConfig, which will now cause JMX to return lists of Projects that I think will be more useful. Please give the latest from svn a whirl and let me know if we can skip a new Project list method.

Dan Rollo

James Wilson [12/Jun/08 07:22 PM]
I pulled the trunk svn co https://cruisecontrol.svn.sourceforge.net/svnroot/cruisecontrol/trunk/cruisecontrol cruisecontrol
I'm getting a test failure failing the build (ant build). The failure report is below. I'm used to these all passing.

Testcase: testShouldReturnAllArtifactsForTheBuild(net.sourceforge.cruisecontrol.dashboard.BuildDetailTest):FAILED
    [junit] expected:<3> but was:<0>
    [junit] junit.framework.AssertionFailedError: expected:<3> but was:<0>
    [junit] at net.sourceforge.cruisecontrol.dashboard.BuildDetailTest.testShouldReturnAllArtifactsForTheBuild(BuildDetailTest.java:167)
    [junit] at org.jmock.core.VerifyingTestCase.runBare(VerifyingTestCase.java:39)

Dan Rollo [12/Jun/08 09:33 PM]
Hi James,

Not sure why the dashboard test is failing. Did you try doing a get into a new tree (just to rule out svn oddities).
Also, does it fail if you exec "ant" in the dashboard dir? (You should probably follow up on this on the devs list).
FWIW, my CC tree is building fine...

Anyway, to the Jira issue: I'm thinking the jmx method below (AllProjectStatus) should give you what you needed regarding a list or all projects.
Assuming that works for you, I'm planning to add the original isLastBuildSuccessful requested in this Jira issue.

Dan


Dan Rollo [12/Jun/08 09:39 PM]
The jms url above is NOT new.

The one below also existed before, but now returns meaningful strings instead of raw java object ids. That said, the one below would probably require a bit more parsing by any client...

http://-cchost:jmxport-/getattribute?objectname=CruiseControl%20Manager:id=unique&attribute=Projects&format=collection&template=viewcollection

James Wilson [14/Jun/08 08:11 AM]
Thanks Dan. The AllProjectsStatus method is definitely just as useful for me as my ProjectNames method. I'm a bit embarrassed that I missed that method. I found it's addition back in May 2007 (rev 3071) -- after I first sort of took over this jira, but still... I did not want to do any toString() parsing, so that will be a great solution of the options you've pointed out.

I'll appreciate you exposing isLastBuildSuccessful.

Dan Rollo [14/Jun/08 09:46 PM]
Cool.

Done: Expose isLastBuildSuccessful via jmx (CC-493). Patch by Allan Wick, James Wilson.

Please let me know if I've missed anything, otherwise I'll plan to close this issue shortly.

Dan