continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jzurb...@apache.org
Subject svn commit: r950521 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-store/src/main/java/org/apache/c...
Date Wed, 02 Jun 2010 12:18:30 GMT
Author: jzurbano
Date: Wed Jun  2 12:18:29 2010
New Revision: 950521

URL: http://svn.apache.org/viewvc?rev=950521&view=rev
Log:
[CONTINUUM-2521] builds report page
* added project group filter
* added unit test for searching builds with group id


Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java
    continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java
Wed Jun  2 12:18:29 2010
@@ -101,5 +101,5 @@ public interface BuildResultDao
 
     List<BuildResult> getAllBuildsForAProjectByDate( int projectId );
 
-    List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int state,
String triggeredBy );
+    List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int state,
String triggeredBy, int projectGroupId );
 }

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Wed Jun  2 12:18:29 2010
@@ -210,7 +210,7 @@ public interface Continuum
     void removeBuildResult( int buildId )
         throws ContinuumException;
 
-    List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int state,
String triggeredBy );
+    List<BuildResult> getBuildResultsInRange( int projectGroupId, long fromDate, long
toDate, int state, String triggeredBy );
 
     // ----------------------------------------------------------------------
     // Projects

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Jun  2 12:18:29 2010
@@ -587,9 +587,9 @@ public class DefaultContinuum
         return ( builds.isEmpty() ? null : builds.get( 0 ) );
     }
 
-    public List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int
state, String triggeredBy )
+    public List<BuildResult> getBuildResultsInRange( int projectGroupId, long fromDate,
long toDate, int state, String triggeredBy )
     {
-        return buildResultDao.getBuildResultsInRange( fromDate, toDate, state, triggeredBy
);
+        return buildResultDao.getBuildResultsInRange( fromDate, toDate, state, triggeredBy,
projectGroupId );
     }
 
     // ----------------------------------------------------------------------

Modified: continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java
(original)
+++ continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java
Wed Jun  2 12:18:29 2010
@@ -748,9 +748,9 @@ public class BuildResultDaoImpl
 
         return null;
     }
-
+    
     @SuppressWarnings( "unchecked" )
-    public List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int
state, String triggeredBy )
+    public List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int
state, String triggeredBy, int projectGroupId )
     {
         PersistenceManager pm = getPersistenceManager();
 
@@ -772,6 +772,7 @@ public class BuildResultDaoImpl
             Map params = new HashMap();
 
             int ctr = 0;
+            
             if ( state > 0 )
             {
                 params.put( "state", state );
@@ -780,6 +781,14 @@ public class BuildResultDaoImpl
                 filter += "this.state == state && ";
             }
 
+            if ( projectGroupId > 0 )
+            {
+                params.put( "projectGroupId", projectGroupId );
+                ctr++;
+                parameters += "int projectGroupId, ";
+                filter += "this.project.projectGroup.id == projectGroupId && ";
+            }
+
             if ( triggeredBy != null && !triggeredBy.equals( "" ) )
             {
                 params.put( "triggeredBy", triggeredBy );
@@ -804,11 +813,11 @@ public class BuildResultDaoImpl
                 parameters += "long toDate";
                 filter += "this.startTime <= toDate";
             }
-
+            
             if ( filter.endsWith( "&& " ) )
             {
-                filter = filter.substring( 0, filter.length() - 3 );
-                parameters = parameters.substring( 0, parameters.length() - 2 );
+               filter = filter.substring( 0, filter.length() - 3 );
+               parameters = parameters.substring( 0, parameters.length() - 2 );
             }
 
             query.declareParameters( parameters );

Modified: continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
(original)
+++ continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
Wed Jun  2 12:18:29 2010
@@ -1402,29 +1402,35 @@ public class ContinuumStoreTest
     public void testGetBuildResultsInRange()
         throws Exception
     {
-        List<BuildResult> results = buildResultDao.getBuildResultsInRange( 0, 0, 0,
null );	    
+        List<BuildResult> results = buildResultDao.getBuildResultsInRange( 0, 0, 0,
null, 0 );	    
         assertEquals( "check number of build results returned", 3, results.size() );
 
-        results = buildResultDao.getBuildResultsInRange( 0, 0, 2, null );
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 2, null, 0 );
         assertEquals( "check number of build results returned with state == OK", 2, results.size()
);
 
-        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, "user" );
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, "user", 0 );
         assertEquals( "check number of build results returned with triggeredBy == user",
1, results.size() );
 	    
-        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, "schedule" );
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, "schedule", 0 );
         assertEquals( "check number of build results returned with triggeredBy == schedule",
2, results.size() );
         
-        results = buildResultDao.getBuildResultsInRange( 0, 0, 2, "schedule" );
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 2, "schedule", 0 );
         assertEquals( "check number of build results returned with state == Ok and triggeredBy
== schedule", 1, results.size() );
 
-        results = buildResultDao.getBuildResultsInRange( 0, 0, 3, "user" );
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 3, "user", 0 );
         assertEquals( "check number of build results returned with state == Failed and triggeredBy
== user", 0, results.size() );
 
-        results = buildResultDao.getBuildResultsInRange( baseTime, baseTime + 2000, 0, null
);
+        results = buildResultDao.getBuildResultsInRange( baseTime, baseTime + 2000, 0, null,
0 );
         assertEquals( "check number of build results returned with startDate and endDate",
2, results.size() );
 
-        results = buildResultDao.getBuildResultsInRange( baseTime, baseTime, 0, null );
+        results = buildResultDao.getBuildResultsInRange( baseTime, baseTime, 0, null, 0 );
         assertEquals( "check number of build results returned with the same startDate and
endDate", 1, results.size() );
+        
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, null, 1 );
+        assertEquals( "check number of build results returned with an existing group id",
3, results.size() );
+        
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, null, 2 );
+        assertEquals( "check number of build results returned with non-existing group id",
0, results.size() );
     }
     // ----------------------------------------------------------------------
     //  HELPER METHODS

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java
Wed Jun  2 12:18:29 2010
@@ -32,6 +32,7 @@ import org.apache.commons.lang.StringUti
 import org.apache.commons.lang.time.DateUtils;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
@@ -50,6 +51,8 @@ public class ViewBuildsReportAction
     private String startDate = "";
 
     private String endDate = "";
+    
+    private int projectGroupId;
 
     private int rowCount = 30;
 
@@ -58,6 +61,8 @@ public class ViewBuildsReportAction
     private int numPages;
 
     private Map<Integer, String> buildStatuses;
+    
+    private Map<Integer, String> projectGroups;
 
     private List<ProjectBuildsSummary> projectBuilds;
 
@@ -69,12 +74,24 @@ public class ViewBuildsReportAction
         throws Exception
     {
         super.prepare();
-
+        
         buildStatuses = new LinkedHashMap<Integer, String>();
         buildStatuses.put( 0, "ALL" );
         buildStatuses.put( ContinuumProjectState.OK, "Ok" );
         buildStatuses.put( ContinuumProjectState.FAILED, "Failed" );
-        buildStatuses.put( ContinuumProjectState.ERROR, "Error" );    
+        buildStatuses.put( ContinuumProjectState.ERROR, "Error" );
+        
+        projectGroups = new LinkedHashMap<Integer, String>();
+        projectGroups.put( 0, "ALL" );
+        
+        List<ProjectGroup> groups = getContinuum().getAllProjectGroups();
+        if ( groups != null )
+        {
+            for ( ProjectGroup group : groups )
+            {
+                projectGroups.put( group.getId(),  group.getName() );
+            }
+        }
     }
 
     public String init()
@@ -147,7 +164,7 @@ public class ViewBuildsReportAction
             return INPUT;
         }
 
-        List<BuildResult> buildResults = getContinuum().getBuildResultsInRange( fromDate,
toDate, buildStatus, triggeredBy );
+        List<BuildResult> buildResults = getContinuum().getBuildResultsInRange( projectGroupId,
fromDate, toDate, buildStatus, triggeredBy );
         projectBuilds = Collections.emptyList();
 
         if ( buildResults != null && !buildResults.isEmpty() )
@@ -215,6 +232,16 @@ public class ViewBuildsReportAction
         this.buildStatus = buildStatus;
     }
 
+    public int getProjectGroupId()
+    {
+        return this.projectGroupId;
+    }
+
+    public void setProjectGroupId( int projectGroupId )
+    {
+        this.projectGroupId = projectGroupId;
+    }
+
     public String getTriggeredBy()
     {
         return this.triggeredBy;
@@ -260,6 +287,11 @@ public class ViewBuildsReportAction
         return buildStatuses;
     }
 
+    public Map<Integer, String> getProjectGroups()
+    {
+        return projectGroups;
+    }
+
     public List<ProjectBuildsSummary> getProjectBuilds()
     {
         return projectBuilds;

Modified: continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Wed Jun  2 12:18:29 2010
@@ -1268,6 +1268,7 @@ releasePrepare.input.error = Unable to g
 projectBuilds.report.title=Continuum - Project Builds Report
 projectBuilds.report.section.title=Project Builds Report
 projectBuilds.report.button.reset=Reset
+projectBuilds.report.project.group=Project Group
 projectBuilds.report.startDate=Start Date
 projectBuilds.report.endDate=End Date
 projectBuilds.report.triggeredBy=Triggered By

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp?rev=950521&r1=950520&r2=950521&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp
(original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp
Wed Jun  2 12:18:29 2010
@@ -42,6 +42,7 @@
           $('#triggeredBy').val('')
           $('#rowCount').val('30')
           $("#buildStatus option[value='0']").attr('selected', 'selected')
+          $("#projectGroupId option[value='0']").attr('selected', 'selected')
         });
       });
     </script>
@@ -64,6 +65,7 @@
       
       <div class="axial">
         <table>
+            <s:select label="%{getText('projectBuilds.report.project.group')}" name="projectGroupId"
id="projectGroupId" list="projectGroups"/>
             <s:textfield label="%{getText('projectBuilds.report.startDate')}" name="startDate"
id="startDate" size="20"/>
             <s:textfield label="%{getText('projectBuilds.report.endDate')}" name="endDate"
id="endDate" size="20"/>
             <s:select label="%{getText('projectBuilds.report.buildStatus')}" name="buildStatus"
id="buildStatus" list="buildStatuses"/>
@@ -80,12 +82,13 @@
     </p>
 
     <c:if test="${projectBuilds != null}">
-     	<div id="h3">
+      <div id="h3">
      	  <h3>Results</h3>
      	  <c:choose>
        	  <c:when test="${not empty projectBuilds}">
             <c:set var="prevPageUrl">
               <s:url action="generateProjectBuildsReport">    
+                <s:param name="projectGroupId" value="%{#attr.projectGroupId}"/>
                 <s:param name="triggeredBy" value="%{#attr.triggeredBy}"/>
                 <s:param name="buildStatus" value="%{#attr.buildStatus}"/>
                 <s:param name="rowCount" value="%{#attr.rowCount}"/>
@@ -96,6 +99,7 @@
             </c:set>
             <c:set var="nextPageUrl">
               <s:url action="generateProjectBuildsReport">    
+                <s:param name="projectGroupId" value="%{#attr.projectGroupId}"/>
                 <s:param name="triggeredBy" value="%{#attr.triggeredBy}"/>
                 <s:param name="buildStatus" value="%{#attr.buildStatus}"/>
                 <s:param name="rowCount" value="%{#attr.rowCount}"/>
@@ -143,8 +147,9 @@
                 <c:when test="${i != (page - 1)}">
                   <c:set var="specificPageUrl">
                     <s:url action="generateProjectBuildsReport">    
+                      <s:param name="projectGroupId" value="%{#attr.projectGroupId}"/>
                       <s:param name="triggeredBy" value="%{#attr.triggeredBy}"/>
-                	  <s:param name="buildStatus" value="%{#attr.buildStatus}"/>
+                      <s:param name="buildStatus" value="%{#attr.buildStatus}"/>
                       <s:param name="rowCount" value="%{#attr.rowCount}"/>
                       <s:param name="startDate" value="%{#attr.startDate}"/>      
               
                       <s:param name="endDate" value="%{#attr.endDate}"/>          



Mime
View raw message