continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r555514 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/test/java...
Date Thu, 12 Jul 2007 07:30:24 GMT
Author: evenisse
Date: Thu Jul 12 00:30:22 2007
New Revision: 555514

URL: http://svn.apache.org/viewvc?view=rev&rev=555514
Log:
[CONTINUUM-761] Ability to delete build results

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Thu Jul 12 00:30:22 2007
@@ -199,6 +199,8 @@
 
     List getChangesSinceLastSuccess( int projectId, int buildResultId )
         throws ContinuumException;
+    
+    void removeBuildResult( int buildId ) throws ContinuumException;
 
     // ----------------------------------------------------------------------
     // Projects

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Thu Jul 12 00:30:22 2007
@@ -203,6 +203,8 @@
 
     BuildResult getBuildResult( int buildId )
         throws ContinuumObjectNotFoundException, ContinuumStoreException;
+    
+    void removeBuildResult( BuildResult buildResult );
 
     void removeProject( Project project );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Thu Jul 12 00:30:22 2007
@@ -1009,6 +1009,12 @@
             throw logAndCreateException( "Exception while getting build result for project.",
e );
         }
     }
+    
+    public void removeBuildResult( int buildId )
+        throws ContinuumException
+    {
+        store.removeBuildResult( getBuildResult( buildId ) );
+    }
 
     public String getBuildOutput( int projectId, int buildId )
         throws ContinuumException

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
Thu Jul 12 00:30:22 2007
@@ -167,20 +167,20 @@
         URL url = getClass().getClassLoader().getResource( "projects/continuum/pom.xml" );
 
         // Eat System.out
-        PrintStream ps = System.out;
+        //PrintStream ps = System.out;
 
         ContinuumProjectBuildingResult result;
 
-        try
-        {
-            System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
+        //try
+        //{
+            //System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
 
             result = projectBuilder.buildProjectsFromMetadata( url, null, null );
-        }
-        finally
-        {
-            System.setOut( ps );
-        }
+        //}
+        //finally
+        //{
+            //System.setOut( ps );
+        //}
 
         assertNotNull( result );
 
@@ -261,20 +261,20 @@
         URL url = getClass().getClassLoader().getResource( "projects/continuum/pom_ci.xml"
);
 
         // Eat System.out
-        PrintStream ps = System.out;
+        //PrintStream ps = System.out;
 
         ContinuumProjectBuildingResult result;
 
-        try
-        {
-            System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
+        //try
+        //{
+            //System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
 
             result = projectBuilder.buildProjectsFromMetadata( url, null, null );
-        }
-        finally
-        {
-            System.setOut( ps );
-        }
+        //}
+        //finally
+        //{
+            //System.setOut( ps );
+        //}
 
         assertNotNull( result );
 
@@ -355,20 +355,20 @@
         URL url = getClass().getClassLoader().getResource( "projects/continuum/continuum-core/pom.xml"
);
 
         // Eat System.out
-        PrintStream ps = System.out;
+        //PrintStream ps = System.out;
 
         ContinuumProjectBuildingResult result;
 
-        try
-        {
-            System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
+        //try
+        //{
+            //System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
 
             result = projectBuilder.buildProjectsFromMetadata( url, null, null );
-        }
-        finally
-        {
-            System.setOut( ps );
-        }
+        //}
+        //finally
+        //{
+            //System.setOut( ps );
+        //}
 
         assertNotNull( result );
 

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Thu Jul 12 00:30:22 2007
@@ -592,6 +592,11 @@
     {
         return getLatestBuildResultsByProjectGroupId( -1 );
     }
+    
+    public void removeBuildResult( BuildResult buildResult )
+    {
+        removeObject( buildResult );
+    }
 
     public void removeNotifier( ProjectNotifier notifier )
         throws ContinuumStoreException

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
Thu Jul 12 00:30:22 2007
@@ -92,6 +92,22 @@
 
         return SUCCESS;
     }
+    
+    public String remove() throws ContinuumException
+    {
+        try
+        {
+            checkModifyProjectGroupAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException e )
+        {
+            return REQUIRES_AUTHORIZATION;
+        }
+        
+        getContinuum().removeBuildResult( buildId );
+        
+        return SUCCESS;
+    }
 
 
     public int getBuildId()

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
Thu Jul 12 00:30:22 2007
@@ -25,6 +25,7 @@
 import org.codehaus.plexus.util.StringUtils;
 
 import java.util.Collection;
+import java.util.Iterator;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -37,6 +38,8 @@
     private Project project;
 
     private Collection buildResults;
+    
+    private Collection selectedBuildResults;
 
     private int projectId;
 
@@ -62,6 +65,41 @@
 
         return SUCCESS;
     }
+    
+    public String remove()
+        throws ContinuumException
+    {
+        try
+        {
+            checkModifyProjectGroupAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException e )
+        {
+            return REQUIRES_AUTHORIZATION;
+        }
+        
+        if ( selectedBuildResults != null && !selectedBuildResults.isEmpty() )
+        {
+            for ( Iterator i = selectedBuildResults.iterator(); i.hasNext(); )
+            {
+                int buildId = Integer.parseInt( (String) i.next() );
+                
+                try
+                {
+                    getLogger().info( "Removing BuildResult with id=" + buildId );
+                    
+                    getContinuum().removeBuildResult( buildId );
+                }
+                catch ( ContinuumException e )
+                {
+                    getLogger().error( "Error removing BuildResult with id=" + buildId );
+                    addActionError( "Unable to remove BuildResult with id=" + buildId );
+                }
+            }
+        }
+        
+        return SUCCESS;
+    }
 
     public int getProjectId()
     {
@@ -102,5 +140,15 @@
         }
 
         return projectGroupName;
+    }
+
+    public Collection getSelectedBuildResults()
+    {
+        return selectedBuildResults;
+    }
+
+    public void setSelectedBuildResults( Collection selectedBuildResults )
+    {
+        this.selectedBuildResults = selectedBuildResults;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Thu Jul 12 00:30:22
2007
@@ -305,9 +305,23 @@
     <action name="buildResults" class="buildResults">
       <result name="success">/WEB-INF/jsp/buildResults.jsp</result>
     </action>
+    
+    <action name="removeBuildResults" class="buildResults" method="remove">
+      <result name="success" type="redirect-action">
+        <param name="actionName">buildResults</param>
+        <param name="projectId">${projectId}</param>
+      </result>
+    </action>
 
     <action name="buildResult" class="buildResult">
       <result name="success">/WEB-INF/jsp/buildResult.jsp</result>
+    </action>
+    
+    <action name="removeBuildResult" class="buildResult" method="remove">
+      <result name="success" type="redirect-action">
+        <param name="actionName">buildResults</param>
+        <param name="projectId">${projectId}</param>
+      </result>
     </action>
 
     <action name="surefireReport" class="surefireReport">

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp Thu
Jul 12 00:30:22 2007
@@ -21,6 +21,7 @@
 <%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
 <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
 <%@ taglib prefix="c1" uri="continuum" %>
+<%@ taglib uri="http://plexus.codehaus.org/redback/taglib-1.0" prefix="redback" %>
 <html>
   <ww:i18n name="localization.Continuum">
     <head>
@@ -61,6 +62,23 @@
                     </ww:else>
                 </ww:param>
             </c1:data>
+          </table>
+        </div>
+        <div class="functnbar3">
+          <table>
+            <tbody>
+            <tr>
+              <td>
+                <redback:ifAuthorized permission="continuum-modify-group" resource="${projectGroupName}">
+                  <form action="removeBuildResult.action">
+                    <input type="hidden" name="projectId" value="<ww:property value="projectId"/>"/>
+                    <input type="hidden" name="buildId" value="<ww:property value="buildId"/>"/>
+                    <input type="submit" name="delete-project" value="<ww:text name="delete"/>"/>
+                  </form>
+                </redback:ifAuthorized>
+              </td>
+            </tr>
+            </tbody>
           </table>
         </div>
 

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp?view=diff&rev=555514&r1=555513&r2=555514
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp Thu
Jul 12 00:30:22 2007
@@ -20,6 +20,7 @@
 <%@ taglib uri="/webwork" prefix="ww" %>
 <%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
 <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib uri="http://plexus.codehaus.org/redback/taglib-1.0" prefix="redback" %>
 <html>
   <ww:i18n name="localization.Continuum">
     <head>
@@ -38,34 +39,54 @@
                 <ww:param><ww:property value="project.name"/></ww:param>
             </ww:text>
         </h3>
-        <ww:set name="buildResults" value="buildResults" scope="request"/>
-        <ec:table items="buildResults"
-                  var="buildResult"
-                  showExports="false"
-                  showPagination="false"
-                  showStatusBar="false"
-                  filterable="false"
-                  sortable="false">
-          <ec:row highlightRow="true">
-            <ec:column property="buildNumberIfNotZero" title="buildResults.buildNumber">
-                <c:if test="${pageScope.buildResult.state == 2}">
-                    <c:out value="${pageScope.buildResult.buildNumber}"/>
-                </c:if>
-            </ec:column>
-            <ec:column property="startTime" title="buildResults.startTime" cell="date"/>
-            <ec:column property="endTime" title="buildResults.endTime" cell="date"/>
-            <ec:column property="state" title="buildResults.state" cell="org.apache.maven.continuum.web.view.buildresults.StateCell"/>
-            <ec:column property="actions" title="&nbsp;">
-              <ww:url id="buildResultUrl" action="buildResult">
-                <ww:param name="projectId" value="${projectId}"/>
-                <ww:param name="projectName" value="%{projectName}"/>
-                <ww:param name="buildId" value="${buildResult.id}"/>
-                <ww:param name="projectGroupId" value="${projectGroupId}"/>
-              </ww:url>
-              <ww:a href="%{buildResultUrl}">Result</ww:a>
-            </ec:column>
-          </ec:row>
-        </ec:table>
+        <form id="buildResultsForm" action="removeBuildResults.action" method="post">
+          <ww:set name="buildResults" value="buildResults" scope="request"/>
+          <ec:table items="buildResults"
+                    var="buildResult"
+                    showExports="false"
+                    showPagination="false"
+                    showStatusBar="false"
+                    filterable="false"
+                    sortable="false">
+            <ec:row highlightRow="true">
+              <redback:ifAuthorized permission="continuum-modify-group" resource="${projectGroupName}">
+                <ec:column alias="checkbox" title=" " style="width:5px" filterable="false"
sortable="false">
+                  <input type="checkbox" name="selectedBuildResults" value="${buildResult.id}"
/>
+                </ec:column>
+              </redback:ifAuthorized>
+              <ec:column property="buildNumberIfNotZero" title="buildResults.buildNumber">
+                  <c:if test="${pageScope.buildResult.state == 2}">
+                      <c:out value="${pageScope.buildResult.buildNumber}"/>
+                  </c:if>
+              </ec:column>
+              <ec:column property="startTime" title="buildResults.startTime" cell="date"/>
+              <ec:column property="endTime" title="buildResults.endTime" cell="date"/>
+              <ec:column property="state" title="buildResults.state" cell="org.apache.maven.continuum.web.view.buildresults.StateCell"/>
+              <ec:column property="actions" title="&nbsp;">
+                <ww:url id="buildResultUrl" action="buildResult">
+                  <ww:param name="projectId" value="${projectId}"/>
+                  <ww:param name="projectName" value="%{projectName}"/>
+                  <ww:param name="buildId" value="${buildResult.id}"/>
+                  <ww:param name="projectGroupId" value="${projectGroupId}"/>
+                </ww:url>
+                <ww:a href="%{buildResultUrl}">Result</ww:a>
+              </ec:column>
+            </ec:row>
+          </ec:table>
+          <div class="functnbar3">
+            <table>
+              <tbody>
+              <tr>
+                <td>
+                  <redback:ifAuthorized permission="continuum-modify-group" resource="${projectGroupName}">
+                    <input type="button" name="delete-project" value="<ww:text name="delete"/>"
onclick="document.forms.buildResultsForm.submit();" />
+                  </redback:ifAuthorized>
+                </td>
+              </tr>
+              </tbody>
+            </table>
+          </div>
+        </form>
       </div>
     </body>
   </ww:i18n>



Mime
View raw message