continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1659095 - in /continuum/trunk/continuum-webapp/src/test/java/org/apache: continuum/web/action/ maven/continuum/web/action/
Date Wed, 11 Feb 2015 21:28:22 GMT
Author: batkinson
Date: Wed Feb 11 21:28:22 2015
New Revision: 1659095

URL: http://svn.apache.org/r1659095
Log:
Changed web tests to use junit 4 annotations rather than TestCase.

Modified:
    continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractReleaseActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddMavenProjectActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildAgentActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildResultActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ProjectGroupActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/SummaryActionTest.java

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractActionTest.java
Wed Feb 11 21:28:22 2015
@@ -25,12 +25,14 @@ import com.opensymphony.xwork2.config.pr
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
-import junit.framework.TestCase;
+import org.junit.Before;
+
+import static org.junit.Assert.assertNotNull;
 
 public abstract class AbstractActionTest
-    extends TestCase
 {
-    protected void setUp()
+    @Before
+    public void setUpActionContext()
         throws Exception
     {
         if ( ActionContext.getContext() == null )

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractReleaseActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractReleaseActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractReleaseActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/AbstractReleaseActionTest.java
Wed Feb 11 21:28:22 2015
@@ -26,11 +26,14 @@ import org.apache.continuum.web.action.s
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.system.Profile;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 
 public class AbstractReleaseActionTest
@@ -44,11 +47,10 @@ public class AbstractReleaseActionTest
 
     private String defaultBuildagentUrl = "http://localhost:8181/continuum-buildagent/xmlrpc";
 
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         continuum = mock( Continuum.class );
         configurationService = mock( ConfigurationService.class );
 
@@ -61,6 +63,7 @@ public class AbstractReleaseActionTest
         action.setContinuum( continuum );
     }
 
+    @Test
     public void testGetEnvironmentsDefaultAgentInGroup()
         throws Exception
     {
@@ -79,6 +82,7 @@ public class AbstractReleaseActionTest
         assertTrue( "Default build agent is expected to be used.", defaultBuildagentUrl.equals(
buildagent ) );
     }
 
+    @Test
     public void testGetEnvironmentsDefaultAgentNotInGroup()
         throws Exception
     {
@@ -95,6 +99,7 @@ public class AbstractReleaseActionTest
         assertFalse( "Default build agent is not expected to be used.", defaultBuildagentUrl.equals(
buildagent ) );
     }
 
+    @Test
     public void testGetEnvironmentsNoEnabledAgentInGroup()
         throws Exception
     {
@@ -114,6 +119,7 @@ public class AbstractReleaseActionTest
         assertNull( "Build agent should be empty.", buildagent );
     }
 
+    @Test
     public void testGetEnvironmentsNoAgentInGroup()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
Wed Feb 11 21:28:22 2015
@@ -26,12 +26,15 @@ import org.apache.maven.continuum.Contin
 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.junit.Before;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
+import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 
 public class ViewBuildsReportActionTest
@@ -43,18 +46,17 @@ public class ViewBuildsReportActionTest
 
     private List<BuildResult> buildResults = new ArrayList<BuildResult>();
 
-    @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         continuum = mock( Continuum.class );
 
         action = new ViewBuildsReportActionStub();
         action.setContinuum( continuum );
     }
 
+    @Test
     public void testInvalidRowCount()
     {
         action.setRowCount( -1 );
@@ -65,6 +67,7 @@ public class ViewBuildsReportActionTest
         assertFalse( action.hasActionErrors() );
     }
 
+    @Test
     public void testEndDateBeforeStartDate()
     {
         action.setStartDate( "04/25/2010" );
@@ -76,6 +79,7 @@ public class ViewBuildsReportActionTest
         assertFalse( action.hasActionErrors() );
     }
 
+    @Test
     public void testMalformedStartDate()
     {
         action.setStartDate( "not a date" );
@@ -86,6 +90,7 @@ public class ViewBuildsReportActionTest
         assertFalse( action.hasFieldErrors() );
     }
 
+    @Test
     public void testMalformedEndDate()
     {
         action.setEndDate( "not a date" );
@@ -96,6 +101,7 @@ public class ViewBuildsReportActionTest
         assertFalse( action.hasFieldErrors() );
     }
 
+    @Test
     public void testStartDateSameWithEndDate()
     {
         when( continuum.getBuildResultsInRange( anyInt(), any( Date.class ), any( Date.class
), anyInt(),
@@ -108,6 +114,7 @@ public class ViewBuildsReportActionTest
         assertSuccessResult( result );
     }
 
+    @Test
     public void testEndDateWithNoStartDate()
     {
         when( continuum.getBuildResultsInRange( anyInt(), any( Date.class ), any( Date.class
), anyInt(),
@@ -118,6 +125,7 @@ public class ViewBuildsReportActionTest
         assertSuccessResult( result );
     }
 
+    @Test
     public void testExportToCsv()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddMavenProjectActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddMavenProjectActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddMavenProjectActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddMavenProjectActionTest.java
Wed Feb 11 21:28:22 2015
@@ -24,6 +24,8 @@ import org.apache.continuum.web.action.A
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
 import org.apache.maven.continuum.web.action.stub.AddMavenProjectStub;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.UnsupportedEncodingException;
@@ -31,7 +33,9 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLEncoder;
 
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 /**
  * Verifies {@link org.apache.maven.continuum.web.action.AddMavenProjectAction}.
@@ -43,11 +47,10 @@ public class AddMavenProjectActionTest
 
     private HttpServletRequest request;
 
+    @Before
     public void setUp()
         throws Exception
     {
-        super.setUp();
-
         request = mock( HttpServletRequest.class );
 
         action = new AddMavenProjectStub();
@@ -55,6 +58,7 @@ public class AddMavenProjectActionTest
 
     }
 
+    @Test
     public void testHttpUrlConstructionWithCreds()
         throws BuildDefinitionServiceException, ContinuumException, MalformedURLException,
UnsupportedEncodingException
     {
@@ -75,7 +79,7 @@ public class AddMavenProjectActionTest
         when( request.getCharacterEncoding() ).thenReturn( encoding );
 
         String result = action.execute();
-        
+
         assertEquals( "action should have succeeded", Action.SUCCESS, result );
 
         URL builtUrl = new URL( action.getPom() );

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
Wed Feb 11 21:28:22 2015
@@ -24,11 +24,15 @@ import org.apache.maven.continuum.Contin
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.web.action.stub.AddProjectActionStub;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.mockito.Mockito.*;
 
 /**
@@ -53,11 +57,10 @@ public class AddProjectActionTest
 
     private static final String VALID_DESCRIPTION_CHARACTER = "abcABC123whitespaces_.-";
 
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         continuum = mock( Continuum.class );
 
         action = new AddProjectActionStub();
@@ -74,6 +77,7 @@ public class AddProjectActionTest
         when( continuum.addProject( any( Project.class ), anyString(), anyInt(), anyInt()
) ).thenReturn( 3 );
     }
 
+    @Test
     public void testAddProjectNullValues()
         throws Exception
     {
@@ -89,6 +93,7 @@ public class AddProjectActionTest
      *
      * @throws Exception
      */
+    @Test
     public void testAddAntProject()
         throws Exception
     {
@@ -105,6 +110,7 @@ public class AddProjectActionTest
         action.add();
     }
 
+    @Test
     public void testAddAntProjectWithValidValues()
         throws Exception
     {
@@ -133,6 +139,7 @@ public class AddProjectActionTest
      *
      * @throws Exception
      */
+    @Test
     public void testAddShellProject()
         throws Exception
     {
@@ -149,6 +156,7 @@ public class AddProjectActionTest
         action.add();
     }
 
+    @Test
     public void testAddShellProjectWithValidValues()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildAgentActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildAgentActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildAgentActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildAgentActionTest.java
Wed Feb 11 21:28:22 2015
@@ -26,6 +26,8 @@ import org.apache.continuum.web.action.A
 import org.apache.continuum.web.action.admin.BuildAgentAction;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -45,11 +47,10 @@ public class BuildAgentActionTest
 
     private List<BuildAgentConfiguration> buildAgents;
 
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         continuum = mock( Continuum.class );
         configurationService = mock( ConfigurationService.class );
         distributedBuildManager = mock( DistributedBuildManager.class );
@@ -60,6 +61,7 @@ public class BuildAgentActionTest
         buildAgents = new ArrayList<BuildAgentConfiguration>();
     }
 
+    @Test
     public void testAddBuildAgent()
         throws Exception
     {
@@ -77,6 +79,7 @@ public class BuildAgentActionTest
         verify( distributedBuildManager ).update( any( BuildAgentConfiguration.class ) );
     }
 
+    @Test
     public void testDeleteBuildAgent()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildResultActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildResultActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildResultActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/BuildResultActionTest.java
Wed Feb 11 21:28:22 2015
@@ -30,10 +30,13 @@ import org.apache.maven.continuum.model.
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.web.action.stub.BuildResultActionStub;
 import org.apache.maven.continuum.xmlrpc.project.ContinuumProjectState;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.io.File;
 import java.util.HashMap;
 
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.*;
 
 public class BuildResultActionTest
@@ -49,11 +52,10 @@ public class BuildResultActionTest
 
     private BuildsManager buildsManager;
 
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         continuum = mock( Continuum.class );
         configurationService = mock( ConfigurationService.class );
         distributedBuildManager = mock( DistributedBuildManager.class );
@@ -64,6 +66,7 @@ public class BuildResultActionTest
         action.setDistributedBuildManager( distributedBuildManager );
     }
 
+    @Test
     public void testViewPreviousBuild()
         throws Exception
     {
@@ -85,6 +88,7 @@ public class BuildResultActionTest
         assertEquals( Action.SUCCESS, action.execute() );
     }
 
+    @Test
     public void testViewCurrentBuildInDistributedBuildAgent()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ProjectGroupActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ProjectGroupActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ProjectGroupActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ProjectGroupActionTest.java
Wed Feb 11 21:28:22 2015
@@ -30,10 +30,13 @@ import org.codehaus.plexus.redback.rbac.
 import org.codehaus.plexus.redback.rbac.UserAssignment;
 import org.codehaus.plexus.redback.rbac.jdo.JdoRole;
 import org.codehaus.plexus.redback.rbac.jdo.JdoUserAssignment;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 
 public class ProjectGroupActionTest
@@ -45,11 +48,10 @@ public class ProjectGroupActionTest
 
     private RBACManager rbac;
 
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         continuum = mock( Continuum.class );
         rbac = mock( RBACManager.class );
 
@@ -58,6 +60,7 @@ public class ProjectGroupActionTest
         action.setRbacManager( rbac );
     }
 
+    @Test
     public void testViewMembersWithProjectAdminRole()
         throws Exception
     {
@@ -102,6 +105,7 @@ public class ProjectGroupActionTest
         assertTrue( users.get( 0 ).isUser() );
     }
 
+    @Test
     public void testViewMembersWithProjectUserRole()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/ReleasePrepareActionTest.java
Wed Feb 11 21:28:22 2015
@@ -22,7 +22,10 @@ package org.apache.maven.continuum.web.a
 import org.apache.continuum.web.action.AbstractActionTest;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.model.project.Project;
+import org.junit.Before;
+import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.*;
 
 /**
@@ -37,11 +40,10 @@ public class ReleasePrepareActionTest
 
     private Continuum continuum;
 
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         action = new ReleasePrepareAction();
         continuum = mock( Continuum.class );
         //securitySessionMock = mock( SecuritySession.class );
@@ -56,6 +58,7 @@ public class ReleasePrepareActionTest
      *
      * @throws Exception
      */
+    @Test
     public void testScmTagBaseSvn()
         throws Exception
     {
@@ -78,6 +81,7 @@ public class ReleasePrepareActionTest
      *
      * @throws Exception
      */
+    @Test
     public void testScmTagBaseNonSvn()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/SummaryActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/SummaryActionTest.java?rev=1659095&r1=1659094&r2=1659095&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/SummaryActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/SummaryActionTest.java
Wed Feb 11 21:28:22 2015
@@ -29,6 +29,8 @@ import org.apache.maven.continuum.model.
 import org.apache.maven.continuum.web.action.stub.SummaryActionStub;
 import org.apache.maven.continuum.web.model.ProjectSummary;
 import org.apache.maven.continuum.xmlrpc.project.ContinuumProjectState;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -36,6 +38,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.*;
 
 public class SummaryActionTest
@@ -49,11 +53,10 @@ public class SummaryActionTest
 
     private BuildsManager buildsManager;
 
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
-        super.setUp();
-
         continuum = mock( Continuum.class );
         configurationService = mock( ConfigurationService.class );
         buildsManager = mock( BuildsManager.class );
@@ -63,6 +66,7 @@ public class SummaryActionTest
         action.setParallelBuildsManager( buildsManager );
     }
 
+    @Test
     public void testLatestBuildIdWhenCurrentlyBuildingInDistributedBuild()
         throws Exception
     {
@@ -90,6 +94,7 @@ public class SummaryActionTest
         assertEquals( 0, summary.getLatestBuildId() );
     }
 
+    @Test
     public void testLatestBuildIdInDistributedBuild()
         throws Exception
     {
@@ -117,6 +122,7 @@ public class SummaryActionTest
         assertEquals( 1, summary.getLatestBuildId() );
     }
 
+    @Test
     public void testLatestBuildIdWhenCurrentlyBuilding()
         throws Exception
     {



Mime
View raw message