continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1660263 - in /continuum/trunk: continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/v...
Date Tue, 17 Feb 2015 00:43:53 GMT
Author: batkinson
Date: Tue Feb 17 00:43:53 2015
New Revision: 1660263

URL: http://svn.apache.org/r1660263
Log:
Reworked build results page and fixed tests broken by CONTINUUM-2430.

Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildResultTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/buildresults/StateCell.java
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildResultTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildResultTest.java?rev=1660263&r1=1660262&r2=1660263&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildResultTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildResultTest.java
Tue Feb 17 00:43:53 2015
@@ -94,8 +94,7 @@ public class BuildResultTest
         clickAndWait( "link=Builds" );
 
         // Matches and clicks first result
-        assertElementPresent( "css=img[alt=\"Building\"]" );
-        clickAndWait( "link=Result" );
+        clickAndWait( "css=img[alt=\"Building\"]" );
 
         assertPage( "Continuum - Build result" );
         assertElementPresent( "css=img[alt=\"Building\"]" );    // confirm build is still
in progress

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=1660263&r1=1660262&r2=1660263&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Tue Feb 17 00:43:53 2015
@@ -365,7 +365,14 @@ public abstract class AbstractContinuumT
         clickLinkWithText( projectName );
         waitForElementPresent( "link=Builds" );
         clickLinkWithText( "Builds" );
-        clickLinkWithText( "Result" );
+
+        if (success)
+        {
+            clickAndWait( "css=img[alt=\"Success\"]" );
+        }
+        else {
+            clickAndWait( "css=img[alt=\"Failed\"]" );
+        }
 
         assertPage( "Continuum - Build result" );
         assertTextPresent( "Build result for " + projectName );

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/buildresults/StateCell.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/buildresults/StateCell.java?rev=1660263&r1=1660262&r2=1660263&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/buildresults/StateCell.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/buildresults/StateCell.java
Tue Feb 17 00:43:53 2015
@@ -19,13 +19,18 @@ package org.apache.maven.continuum.web.v
  * under the License.
  */
 
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.web.model.ProjectBuildsSummary;
 import org.apache.maven.continuum.web.util.StateGenerator;
+import org.apache.maven.continuum.web.util.UrlHelperFactory;
+import org.apache.struts2.ServletActionContext;
 import org.extremecomponents.table.bean.Column;
 import org.extremecomponents.table.cell.DisplayCell;
 import org.extremecomponents.table.core.TableModel;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.PageContext;
+import java.util.HashMap;
 
 /**
  * Used in BuildResults
@@ -33,7 +38,7 @@ import javax.servlet.jsp.PageContext;
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
  * @deprecated use of cells is discouraged due to lack of i18n and design in java code.
- *             Use jsp:include instead.
+ * Use jsp:include instead.
  */
 public class StateCell
     extends DisplayCell
@@ -42,6 +47,8 @@ public class StateCell
     {
         PageContext pageContext = (PageContext) tableModel.getContext().getContextObject();
 
+        Object result = tableModel.getCurrentRowBean();
+
         HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
 
         Object value = column.getPropertyValue();
@@ -55,8 +62,25 @@ public class StateCell
 
         value = StateGenerator.generate( state, request.getContextPath() );
 
+        if ( result instanceof BuildResult )
+        {
+            value = createActionLink( "buildResult", (BuildResult) result,
+                                      StateGenerator.generate( state, request.getContextPath()
) );
+        }
+
         column.setPropertyValue( value );
 
         return value.toString();
     }
+
+    private static String createActionLink( String action, BuildResult result, String linkText
)
+    {
+        HashMap<String, Object> params = new HashMap<String, Object>();
+        params.put( "projectId", result.getProject().getId() );
+        params.put( "buildId", result.getId() );
+        String url = UrlHelperFactory.getInstance().buildUrl( "/" + action + ".action",
+                                                              ServletActionContext.getRequest(),
+                                                              ServletActionContext.getResponse(),
params );
+        return String.format( "<a href='%s''>%s</a>", url, linkText );
+    }
 }
\ No newline at end of file

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp?rev=1660263&r1=1660262&r2=1660263&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResults.jsp Tue Feb
17 00:43:53 2015
@@ -48,7 +48,7 @@
             </s:iterator>
           </div>
         </c:if>
-    
+
         <form id="buildResultsForm" action="removeBuildResults.action" method="post">
           <s:token/>
           <s:set name="buildResults" value="buildResults" scope="request"/>
@@ -73,39 +73,30 @@
                     <c:out value="${pageScope.buildResult.buildNumber}"/>
                   </c:if>
               </ec:column>
-              <ec:column property="startTime" title="buildResults.startTime" cell="date"
format="yyyy-MM-dd HH:mm z"/>
-              <ec:column property="endTime" title="buildResults.endTime" cell="date" format="yyyy-MM-dd
HH:mm z"/>
-              <ec:column property="duration" title="buildResults.duration">
+              <ec:column property="state" headerStyle="text-align: center;" style="text-align:
center;" title="buildResults.result" cell="org.apache.maven.continuum.web.view.buildresults.StateCell"/>
+              <ec:column property="trigger" title="buildResult.trigger">
                 <c:choose>
-                  <c:when test="${buildResult.endTime gt 0}">
-                    ${buildResult.durationTime}
+                  <c:when test="${pageScope.buildResult.trigger == 1}">
+                    <s:text name="buildResult.trigger.1"/>
                   </c:when>
                   <c:otherwise>
-                    <s:text name="buildResults.startedSince"/> : <c:out value="${buildResult.elapsedTime}"/>
+                    <s:text name="buildResult.trigger.0"/>
                   </c:otherwise>
                 </c:choose>
               </ec:column>
-              <ec:column property="state" title="buildResults.state" cell="org.apache.maven.continuum.web.view.buildresults.StateCell"/>
-              <ec:column property="trigger" title="buildResult.trigger">
+              <ec:column property="duration" title="buildResults.duration">
                 <c:choose>
-                  <c:when test="${pageScope.buildResult.trigger == 1}">
-                    <s:text name="buildResult.trigger.1"/>
+                  <c:when test="${buildResult.endTime gt 0}">
+                    ${buildResult.durationTime}
                   </c:when>
                   <c:otherwise>
-                    <s:text name="buildResult.trigger.0"/>
+                    <s:text name="buildResults.startedSince"/> : <c:out value="${buildResult.elapsedTime}"/>
                   </c:otherwise>
                 </c:choose>
               </ec:column>
+              <ec:column property="startTime" title="buildResults.startTime" cell="date"
format="yyyy-MM-dd HH:mm z"/>
+              <ec:column property="endTime" title="buildResults.endTime" cell="date" format="yyyy-MM-dd
HH:mm z"/>
               <ec:column property="buildDefinition.description" title="buildResults.buildDefinition.description"
/>
-              <ec:column property="actions" title="buildResult.buildId">
-                <s:url id="buildResultUrl" action="buildResult">
-                  <s:param name="projectId"><c:out value="${projectId}"/></s:param>
-                  <s:param name="projectName"><c:out value="${projectName}"/></s:param>
-                  <s:param name="buildId"><c:out value="${buildResult.id}"/></s:param>
-                  <s:param name="projectGroupId"><c:out value="${projectGroupId}"/></s:param>
-                </s:url>
-                <s:a href="%{buildResultUrl}">${buildResult.id}</s:a>
-              </ec:column>
             </ec:row>
           </ec:table>
           <c:if test="${not empty buildResults}">



Mime
View raw message