continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r941625 [20/24] - in /continuum/branches/continuum-flat-multi-module: ./ continuum-api/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ cont...
Date Thu, 06 May 2010 09:23:34 GMT
Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java Thu May  6 09:23:13 2010
@@ -19,11 +19,15 @@ package org.apache.continuum.web.test.pa
  * under the License.
  */
 
+import org.apache.continuum.web.test.ConfigurationTest;
+import org.apache.continuum.web.test.listener.CaptureScreenShotsListener;
 import org.testng.Assert;
 
+import java.io.File;
+
 /**
  * Based on AbstractContinuumTestCase of Emmanuel Venisse test.
- * 
+ *
  * @author José Morales Martínez
  * @version $Id$
  */
@@ -50,7 +54,7 @@ public abstract class AbstractContinuumT
         assertButtonWithValuePresent( "Create Admin" );
     }
 
-    public void submitAdminData( String fullname, String email, String password )
+    public void submitAdminData(String fullname,String email,String password )
     {
         setFieldValue( "user.fullName", fullname );
         setFieldValue( "user.email", email );
@@ -64,8 +68,8 @@ public abstract class AbstractContinuumT
     // ////////////////////////////////////
     public void goToAboutPage()
     {
+        getSelenium().open( baseUrl );
         clickLinkWithText( "About" );
-
         assertAboutPage();
     }
 
@@ -82,6 +86,7 @@ public abstract class AbstractContinuumT
 
     public void goToLoginPage()
     {
+        getSelenium().deleteAllVisibleCookies();
         getSelenium().open( baseUrl );
         clickLinkWithText( "Login" );
         assertLoginPage();
@@ -104,7 +109,7 @@ public abstract class AbstractContinuumT
         assertTextPresent( "Forgot your Password? Request a password reset." );
     }
 
-    public void submitUserData( String username, String password, boolean rememberme, boolean success )
+    public void submitUserData(String username,String password,boolean rememberme,boolean success )
     {
 
         setFieldValue( "username", username );
@@ -124,7 +129,7 @@ public abstract class AbstractContinuumT
         }
     }
 
-    public void assertAutenticatedPage( String username )
+    public void assertAutenticatedPage(String username )
     {
         assertTextPresent( "Current User" );
         assertTextPresent( "Edit Details" );
@@ -133,6 +138,38 @@ public abstract class AbstractContinuumT
         assertTextPresent( username );
     }
 
+    public void assertChangePasswordPage()
+    {
+        assertPage( "Change Password" );
+        assertTextPresent( "Change Password" );
+        assertTextPresent( "Existing Password*:" );
+        assertElementPresent( "existingPassword" );
+        assertTextPresent( "New Password*:" );
+        assertElementPresent( "newPassword" );
+        assertTextPresent( "Confirm New Password*:" );
+        assertElementPresent( "newPasswordConfirm" );
+    }
+
+    public void assertUserEditPage( String username, String name, String email )
+    {
+        assertPage( "[Admin] User Edit" );
+        assertTextPresent( "[Admin] User Edit" );
+        assertTextPresent( "Username" );
+        assertTextPresent( username );
+        assertTextPresent( "Full Name*:" );
+        assertFieldValue( name, "userEditForm_user_fullName" );
+        assertTextPresent( "Email Address*:" );
+        assertFieldValue( email, "userEditForm_user_email" );
+        assertTextPresent( "Password*:" );
+        assertFieldValue( "", "userEditForm_user_password" );
+        assertTextPresent( "Confirm Password*:" );
+        assertElementPresent( "userEditForm_user_confirmPassword" );
+        assertTextPresent( "Account Creation:" );
+        assertTextPresent( "Last Password Change:" );
+        assertTextPresent( "Effective Roles" );
+        assertLinkPresent( "Edit Roles" );
+    }
+
     // ////////////////////////////////////
     // Configuration
     // ////////////////////////////////////
@@ -163,7 +200,7 @@ public abstract class AbstractContinuumT
     // Build Queue
     // ////////////////////////////////////
 
-    public void setMaxBuildQueue( int maxBuildQueue )
+    public void setMaxBuildQueue(int maxBuildQueue )
     {
         clickLinkWithText( "Configuration" );
         setFieldValue( "numberOfAllowedBuildsinParallel", String.valueOf( maxBuildQueue ) );
@@ -176,7 +213,8 @@ public abstract class AbstractContinuumT
     public void goToProjectGroupsSummaryPage()
         throws Exception
     {
-        clickLinkWithText( "Show Project Groups" );
+        getSelenium().open( "/continuum/groupSummary.action" );
+        waitPage();
 
         assertProjectGroupsSummaryPage();
     }
@@ -201,7 +239,7 @@ public abstract class AbstractContinuumT
     // ////////////////////////////////////
     // Project Group
     // ////////////////////////////////////
-    public void showProjectGroup( String name, String groupId, String description )
+    public void showProjectGroup(String name,String groupId,String description )
         throws Exception
     {
         goToProjectGroupsSummaryPage();
@@ -213,7 +251,7 @@ public abstract class AbstractContinuumT
         assertProjectGroupSummaryPage( name, groupId, description );
     }
 
-    public void assertProjectGroupSummaryPage( String name, String groupId, String description )
+    public void assertProjectGroupSummaryPage(String name,String groupId,String description )
     {
         assertPage( "Continuum - Project Group" );
         assertTextPresent( "Project Group Name" );
@@ -230,6 +268,7 @@ public abstract class AbstractContinuumT
         // assertElementPresent( "remove" );
 
         assertTextPresent( "Project Group Scm Root" );
+        assertTextPresent( "Scm Root URL" );
 
         if ( isTextPresent( "Member Projects" ) )
         {
@@ -243,7 +282,7 @@ public abstract class AbstractContinuumT
         }
     }
 
-    public void addProjectGroup( String name, String groupId, String description, boolean success )
+    public void addProjectGroup(String name,String groupId,String description,boolean success )
         throws Exception
     {
         goToProjectGroupsSummaryPage();
@@ -280,7 +319,7 @@ public abstract class AbstractContinuumT
         assertElementPresent( "description" );
     }
 
-    public void removeProjectGroup( String name, String groupId, String description )
+    public void removeProjectGroup(String name,String groupId,String description )
         throws Exception
     {
         showProjectGroup( name, groupId, description );
@@ -293,8 +332,19 @@ public abstract class AbstractContinuumT
         clickButtonWithValue( "Save" );
         assertProjectGroupsSummaryPage();
     }
+    
+    public void removeProjectGroup( String groupName )
+        throws Exception
+    {
+        goToProjectGroupsSummaryPage();
+        clickLinkWithText( groupName );
+        clickButtonWithValue( "Delete Group" );
+        assertTextPresent( "Project Group Removal" );
+        clickButtonWithValue( "Delete" );
+        assertProjectGroupsSummaryPage();
+    }
 
-    public void editProjectGroup( String name, String groupId, String description, String newName, String newDescription )
+    public void editProjectGroup(String name,String groupId,String description,String newName,String newDescription )
         throws Exception
     {
         showProjectGroup( name, groupId, description );
@@ -305,7 +355,7 @@ public abstract class AbstractContinuumT
         clickButtonWithValue( "Save" );
     }
 
-    public void assertEditGroupPage( String groupId )
+    public void assertEditGroupPage(String groupId )
         throws Exception
     {
         assertPage( "Continuum - Update Project Group" );
@@ -320,29 +370,32 @@ public abstract class AbstractContinuumT
         assertElementPresent( "Cancel" );
     }
 
-    public void buildProjectGroup( String projectGroupName, String groupId, String description, String projectName )
+    public void buildProjectGroup(String projectGroupName,String groupId,String description,String projectName )
         throws Exception
     {
-        int currentIt = 1;
-        int maxIt = 10;
         showProjectGroup( projectGroupName, groupId, description );
+        waitForProjectUpdate();
         clickButtonWithValue( "Build all projects" );
-        while ( isElementPresent( "//img[@alt='Building']" ) || isElementPresent( "//img[@alt='Updating']" ) )
+
+        // wait for project to finish building
+        waitForProjectBuild();
+        
+        // wait for the success status of project
+        if ( !isElementPresent( "//a/img[@alt='Success']" ) )
+        {
+            waitForElementPresent( "//a/img[@alt='Success']" );
+        }
+        
+        // wait for the projectName link
+        if ( !isLinkPresent( projectName ) )
         {
-            Thread.sleep( 10000 );
-            getSelenium().refresh();
-            waitPage();
-            if ( currentIt > maxIt )
-            {
-                Assert.fail( "Timeout, Can't build project group" );
-            }
-            currentIt++;
+            waitForElementPresent( "link=" + projectName );
         }
-        Thread.sleep( 10000 );
+
         clickLinkWithText( projectName );
         clickLinkWithText( "Builds" );
         clickLinkWithText( "Result" );
-        assertTextPresent( "BUILD SUCCESSFUL" );
+        assertTextPresent( "BUILD SUCCESS" );
         clickLinkWithText( "Project Group Summary" );
     }
 
@@ -356,8 +409,8 @@ public abstract class AbstractContinuumT
         assertButtonWithValuePresent( "Submit" );
     }
 
-    public void addValidM2ProjectFromProjectGroup( String projectGroupName, String groupId, String description,
-                                                   String m2PomUrl )
+    public void addValidM2ProjectFromProjectGroup(String projectGroupName,String groupId,String description,
+                                                  String m2PomUrl )
         throws Exception
     {
         showProjectGroup( projectGroupName, groupId, description );
@@ -370,7 +423,7 @@ public abstract class AbstractContinuumT
         assertProjectGroupsSummaryPage();
     }
 
-    public void goToGroupBuildDefinitionPage( String projectGroupName, String groupId, String description )
+    public void goToGroupBuildDefinitionPage(String projectGroupName,String groupId,String description )
         throws Exception
     {
         showProjectGroup( projectGroupName, groupId, description );
@@ -378,12 +431,12 @@ public abstract class AbstractContinuumT
         assertGroupBuildDefinitionPage( projectGroupName );
     }
 
-    public void assertGroupBuildDefinitionPage( String projectGroupName )
+    public void assertGroupBuildDefinitionPage(String projectGroupName )
     {
         assertTextPresent( "Project Group Build Definitions of " + projectGroupName + " group" );
     }
 
-    public void assertDeleteBuildDefinitionPage( String description, String goals )
+    public void assertDeleteBuildDefinitionPage(String description,String goals )
     {
         assertTextPresent( "Are you sure you want to delete the build definition with description \"" + description
             + "\", goals \"" + goals + "\" and id" );
@@ -415,9 +468,9 @@ public abstract class AbstractContinuumT
         assertElementPresent( "profileId" );
     }
 
-    public void addEditGroupBuildDefinition( String groupName, String buildFile, String goals, String arguments,
-                                             String description, boolean buildFresh, boolean alwaysBuild,
-                                             boolean isDefault )
+    public void addEditGroupBuildDefinition(String groupName,String buildFile,String goals,String arguments,
+                                            String description,boolean buildFresh,boolean alwaysBuild,
+                                            boolean isDefault )
     {
         assertAddEditBuildDefinitionPage();
         // Enter values into Add Build Definition fields, and submit
@@ -454,7 +507,10 @@ public abstract class AbstractContinuumT
             uncheckField( "alwaysBuild" );
         }
 
+        selectValue( "scheduleId", "DEFAULT_SCHEDULE" );
+
         submit();
+
         if ( groupName != null )
         {
             assertGroupBuildDefinitionPage( groupName );
@@ -468,7 +524,7 @@ public abstract class AbstractContinuumT
     // ////////////////////////////////////
     // General Project Pages
     // ////////////////////////////////////
-    public void goToEditProjectPage( String projectGroupName, String projectName )
+    public void goToEditProjectPage(String projectGroupName,String projectName )
     {
         clickLinkWithText( "Show Project Groups" );
         clickLinkWithText( projectGroupName );
@@ -497,7 +553,7 @@ public abstract class AbstractContinuumT
         assertElementPresent( "scmTag" );
     }
 
-    public void goToProjectInformationPage( String projectGroupName, String projectName )
+    public void goToProjectInformationPage(String projectGroupName,String projectName )
     {
         clickLinkWithText( "Show Project Groups" );
         clickLinkWithText( projectGroupName );
@@ -518,12 +574,19 @@ public abstract class AbstractContinuumT
         assertTextPresent( "Developers" );
     }
 
-    public void moveProjectToProjectGroup( String groupName, String groupId, String groupDescription,
-                                           String projectName, String newProjectGroup )
+    public void moveProjectToProjectGroup(String groupName,String groupId,String groupDescription,
+                                          String projectName,String newProjectGroup )
         throws Exception
     {
         showProjectGroup( groupName, groupId, groupDescription );
-        clickButtonWithValue( "Edit" );
+        
+        // wait for project not being used
+        waitForProjectBuild();
+        
+        String id = getFieldValue( "name=projectGroupId" );
+        String url = baseUrl + "/editProjectGroup.action?projectGroupId=" + id;
+        getSelenium().open( url );
+        waitPage();
 
         assertTextPresent( "Move to Group" );
         String xPath = "//preceding::th/label[contains(text(),'" + projectName + "')]//following::select";
@@ -556,8 +619,8 @@ public abstract class AbstractContinuumT
         assertElementPresent( "selectedProjectGroup" );
     }
 
-    public void addMavenTwoProject( String pomUrl, String username, String password, String projectGroup,
-                                    boolean success )
+    public void addMavenTwoProject(String pomUrl,String username,String password,String projectGroup,
+                                   boolean success )
         throws Exception
     {
         goToAddMavenTwoProjectPage();
@@ -586,11 +649,11 @@ public abstract class AbstractContinuumT
 
     /**
      * submit the page
-     * 
+     *
      * @param m2PomUrl
      * @param validPom
      */
-    public void submitAddMavenTwoProjectPage( String m2PomUrl, boolean validPom )
+    public void submitAddMavenTwoProjectPage(String m2PomUrl,boolean validPom )
         throws Exception
     {
         addMavenTwoProject( m2PomUrl, "", "", null, validPom );
@@ -634,8 +697,8 @@ public abstract class AbstractContinuumT
         assertButtonWithValuePresent( "Cancel" );
     }
 
-    public void addMavenOneProject( String pomUrl, String username, String password, String projectGroup,
-                                    String buildTemplate, boolean success )
+    public void addMavenOneProject(String pomUrl,String username,String password,String projectGroup,
+                                   String buildTemplate,boolean success )
         throws Exception
     {
         setFieldValue( "m1PomUrl", pomUrl );
@@ -679,7 +742,7 @@ public abstract class AbstractContinuumT
         assertAddProjectPage( "shell" );
     }
 
-    public void assertAddProjectPage( String type )
+    public void assertAddProjectPage(String type )
     {
         String title = type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ).toLowerCase();
         assertPage( "Continuum - Add " + title + " Project" );
@@ -712,9 +775,9 @@ public abstract class AbstractContinuumT
         assertButtonWithValuePresent( "Cancel" );
     }
 
-    public void addProject( String name, String description, String version, String scmUrl, String scmUser,
-                            String scmPassword, String scmTag, boolean useCache, String projectGroup,
-                            String buildTemplate, boolean success )
+    public void addProject(String name,String description,String version,String scmUrl,String scmUser,
+                           String scmPassword,String scmTag,boolean useCache,String projectGroup,
+                           String buildTemplate,boolean success,String type )
         throws Exception
     {
         setFieldValue( "projectName", name );
@@ -738,25 +801,270 @@ public abstract class AbstractContinuumT
         }
         submit();
         String title;
+        type = type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ).toLowerCase();
         if ( success )
         {
             title = "Continuum - Project Group";
         }
         else
         {
-            title = "Continuum - Add ";
+            title = "Continuum - Add " + type + " Project";
         }
         waitAddProject( title );
     }
 
-    private void waitAddProject( String title )
+    public void waitAddProject( String title )
         throws Exception
     {
-        Thread.sleep( 100 );
-        String condition = "selenium.browserbot.getCurrentWindow().document.title != ''";
-        getSelenium().waitForCondition( condition, maxWaitTimeInMs );
-        Thread.sleep( 1000 );
-        String t = getTitle();
-        Assert.assertTrue( t.contains( title ) );
+        // the "adding project" interstitial page has an empty title, so we wait for a real title to appear
+
+        if ( browser.equals( "*iexplore" ) )
+        {
+            int currentIt = 1;
+            int maxIt = 20;
+
+            // there's a problem with ie using waitForCondition
+            while( getTitle().equals( "" ) && currentIt <= maxIt )
+            {
+                waitPage();
+                currentIt++;
+            }
+        }
+        else
+        {
+            String condition = "selenium.browserbot.getCurrentWindow().document.title.replace(/^\\s*/, \"\").replace(/\\s*$/, \"\") != '' && selenium.browserbot.getCurrentWindow().document.getElementById('footer') != null";
+            waitForCondition( condition );
+        }
+
+        Assert.assertEquals( getTitle(), title );
+    }
+
+    public void createAndAddUserAsDeveloperToGroup( String username, String name, String email, String password, String groupName )
+    {
+        clickLinkWithText( "Users" );
+        assertPage( "[Admin] User List" );
+        assertTextNotPresent( username );
+        clickButtonWithValue( "Create New User" );
+        assertPage( "[Admin] User Create" );
+        setFieldValue( "user.fullName", name );
+        setFieldValue( "user.username", username );
+        setFieldValue( "user.email", email );
+        setFieldValue( "user.password", password );
+        setFieldValue( "user.confirmPassword", password );
+        clickButtonWithValue( "Create User" );
+        assertPage( "[Admin] User Edit" );
+        assignContinuumResourceRoleToUser( "Project Developer", groupName );
+        clickButtonWithValue( "Submit" );
+        assertPage( "[Admin] User List" );
+        assertTextPresent( username );
+        assertTextPresent( name );
+        assertTextPresent( email );
+    }
+
+    public void showMembers( String name, String groupId, String description )
+        throws Exception
+    {
+        showProjectGroup( name, groupId, description );
+        clickLinkWithText( "Members" );
+        assertTextPresent( "Member Projects of " + name + " group" );
+        assertTextPresent( "Users" );
+    }
+
+    public void assertUserPresent( String username, String name, String email )
+    {
+        assertTextPresent( username );
+        assertTextPresent( name );
+        assertTextPresent( email );
+    }
+
+    public void assertUserNotPresent( String username, String name, String email )
+    {
+        assertTextNotPresent( username );
+        assertTextNotPresent( name );
+        assertTextNotPresent( email );
+    }
+
+    public void waitForProjectCheckout()
+        throws Exception
+    {
+        // wait for project to finish checking out
+        waitForElementPresent( "//img[@alt='Checking Out']", false );
+    }
+    
+    public void waitForProjectUpdate()
+        throws Exception
+    {
+        if ( isElementPresent( "//img[@alt='Checking Out']" ) )
+        {
+            waitForProjectCheckout();
+        }
+        
+        // wait for project to finish updating
+        waitForElementPresent( "//img[@alt='Updating']", false );
+    }
+    
+    public void waitForProjectBuild()
+        throws Exception
+    {
+        if ( isElementPresent( "//img[@alt='Checking Out']" ) || isElementPresent( "//img[@alt='Updating']" ) )
+        {
+            waitForProjectUpdate();
+        }
+        
+        // wait for project to finish building
+        waitForElementPresent( "//img[@alt='Building']", false );
+    }
+
+    public void createNewUser( String username, String name, String email, String password )
+    {
+        clickLinkWithText( "Users" );
+        assertPage( "[Admin] User List" );
+        assertTextNotPresent( username );
+        clickButtonWithValue( "Create New User" );
+        assertPage( "[Admin] User Create" );
+        setFieldValue( "user.fullName", name );
+        setFieldValue( "user.username", username );
+        setFieldValue( "user.email", email );
+        setFieldValue( "user.password", password );
+        setFieldValue( "user.confirmPassword", password );
+        clickButtonWithValue( "Create User" );
+        assertPage( "[Admin] User Edit" );
+    }
+
+    public void assignContinuumRoleToUser( String role )
+    {
+        clickLinkWithXPath( "//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + role + "']", false );
+    }
+
+    public void assignContinuumResourceRoleToUser( String resourceRole, String groupName )
+    {
+        clickLinkWithXPath( "//input[@name='addDSelectedRoles' and @value='" + resourceRole + " - " + groupName + "']", false );
+    }
+
+    public void assertUserCreatedPage()
+    {
+        assertPage( "[Admin] User List" );
+        assertTextPresent( "[Admin] List of Users in Role: Any" );
+        assertLinkPresent( "admin" );
+        assertLinkPresent( "guest" );
+    }
+
+    public void removeDefaultBuildDefinitionFromTemplate( String type )
+    {
+        goToEditBuildDefinitionTemplate( type );
+        clickLinkWithXPath( "//input[@value='<-']", false );
+        submit();
+    }
+
+    public void addDefaultBuildDefinitionFromTemplate( String type )
+    {
+        goToEditBuildDefinitionTemplate( type );
+
+        if ( "maven2".equals( type ) )
+        {
+            selectForOption( "saveBuildDefinitionTemplate_buildDefinitionIds", "Default Maven 2 Build Definition" );
+        }
+        else if ( "maven1".equals( type ) )
+        {
+            
+        }
+        else if ( "ant".equals( type ) )
+        {
+            
+        }
+        else
+        {
+            
+        }
+
+        clickLinkWithXPath( "//input[@value='->']", false );
+        submit();
+    }
+
+    public void goToEditBuildDefinitionTemplate( String type )
+    {
+        clickLinkWithText( "Build Definition Templates" );
+
+        assertBuildDefinitionTemplatesPage();
+
+        if ( "maven2".equals( type ) )
+        {
+            clickLinkWithXPath( "//table[@id='ec_table']/tbody/tr[3]/td[2]/a/img", true );
+        }
+        else if ( "maven1".equals( type ) )
+        {
+            clickLinkWithXPath( "//table[@id='ec_table']/tbody/tr[2]/td[2]/a/img", true );
+        }
+        else if ( "ant".equals( type ) )
+        {
+            clickLinkWithXPath( "//img[@alt='Edit']", true );
+        }
+        else
+        {
+            clickLinkWithXPath( "//table[@id='ec_table']/tbody/tr[4]/td[2]/a/img", true );
+        }
+
+        assertPage( "Continuum - Build Definition Template" );
+    }
+
+    public void assertBuildDefinitionTemplatesPage()
+    {
+        assertPage( "Continuum - Build Definition Templates" );
+        assertTextPresent( "Default Ant Template" );
+        assertTextPresent( "Default Maven 1 Template" );
+        assertTextPresent( "Default Maven 2 Template" );
+        assertTextPresent( "Default Shell Template" );
+        assertTextPresent( "Available Build Definitions" );
+        assertTextPresent( "Default Ant Build Definition" );
+        assertTextPresent( "Default Maven 1 Build Definition" );
+        assertTextPresent( "Default Maven 2 Build Definition" );
+        assertTextPresent( "Default Shell Build Definition" );
+    }
+    
+    // ////////////////////////////////////
+    // Distributed Builds
+    // ////////////////////////////////////
+
+    public void enableDistributedBuilds()
+    {
+        ConfigurationTest config = new ConfigurationTest();
+        config.goToConfigurationPage();
+        setFieldValue( "numberOfAllowedBuildsinParallel", "2" );
+        if ( !isChecked( "configuration_distributedBuildEnabled" ) )
+        {
+            checkField( "configuration_distributedBuildEnabled" );
+        }
+        clickAndWait( "configuration_" );
+        assertTextPresent( "true" );
+        assertTextPresent( "Distributed Builds" );
+        assertElementPresent( "link=Build Agents" );
+    }
+
+    public void disableDistributedBuilds()
+    {
+        ConfigurationTest config = new ConfigurationTest();
+        config.goToConfigurationPage();
+        setFieldValue( "numberOfAllowedBuildsinParallel", "2" );
+        if ( isChecked( "configuration_distributedBuildEnabled" ) )
+        {
+            uncheckField( "configuration_distributedBuildEnabled" );
+        }
+        submit();
+        assertTextPresent( "false" );
+        assertElementNotPresent( "link=Build Agents" );
+    }
+
+    public void goToBuildAgentPage()
+    {
+        clickAndWait("link=Build Agents");
+        assertPage("Continuum - Build Agents");
+    }
+
+    public void assertBuildAgentPage()
+    {
+        assertPage("Continuum - Build Agents");
+        assertTextPresent("Build Agents");
+        assertTextPresent("Build Agent Groups");
+        assertButtonWithValuePresent( "Add" );
     }
 }

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractScheduleTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractScheduleTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractScheduleTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractScheduleTest.java Thu May  6 09:23:13 2010
@@ -84,8 +84,8 @@ public abstract class AbstractScheduleTe
         assertTextPresent( "Quiet Period (seconds):" );
         assertElementPresent( "delay" );
         assertTextPresent( "Add Build Queue" );
-        assertElementPresent( "availableBuildQueues" );
-        assertElementPresent( "selectedBuildQueues" );
+        assertElementPresent( "availableBuildQueuesIds" );
+        assertElementPresent( "selectedBuildQueuesIds" );
         assertElementPresent( "active" );
         assertTextPresent( "Enable/Disable the schedule" );
         assertButtonWithValuePresent( "Save" );
@@ -94,20 +94,41 @@ public abstract class AbstractScheduleTe
 
     public void addEditSchedule( String name, String description, String second, String minute, String hour,
                                  String dayMonth, String month, String dayWeek, String year, String maxTime,
-                                 String period, boolean success )
+                                 String period, boolean buildQueue, boolean success )
     {
-        setFieldValue( "name", name );
-        setFieldValue( "description", description );
-        setFieldValue( "second", second );
-        setFieldValue( "minute", minute );
-        setFieldValue( "hour", hour );
-        setFieldValue( "dayOfMonth", dayMonth );
-        setFieldValue( "month", month );
-        setFieldValue( "dayOfWeek", dayWeek );
-        setFieldValue( "year", year );
-        setFieldValue( "maxJobExecutionTime", maxTime );
-        setFieldValue( "delay", period );
-        submit();
+	if ( buildQueue ) 
+	{
+	        setFieldValue( "name", name );
+		setFieldValue( "description", description );
+		setFieldValue( "second", second );
+		setFieldValue( "minute", minute );
+		setFieldValue( "hour", hour );
+		setFieldValue( "dayOfMonth", dayMonth );
+		setFieldValue( "month", month );
+		setFieldValue( "dayOfWeek", dayWeek );
+		setFieldValue( "year", year );
+		setFieldValue( "maxJobExecutionTime", maxTime );
+		setFieldValue( "delay", period );
+		getSelenium().addSelection("saveSchedule_availableBuildQueuesIds", "label=DEFAULT_BUILD_QUEUE");
+		getSelenium().click("//input[@value='->']");
+		submit();
+	}
+	else
+	{
+		setFieldValue( "name", name );
+		setFieldValue( "description", description );
+		setFieldValue( "second", second );
+		setFieldValue( "minute", minute );
+		setFieldValue( "hour", hour );
+		setFieldValue( "dayOfMonth", dayMonth );
+		setFieldValue( "month", month );
+		setFieldValue( "dayOfWeek", dayWeek );
+		setFieldValue( "year", year );
+		setFieldValue( "maxJobExecutionTime", maxTime );
+		setFieldValue( "delay", period );
+		submit();
+	}
+
         if ( success )
         {
             assertSchedulePage();

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java Thu May  6 09:23:13 2010
@@ -19,21 +19,24 @@ package org.apache.continuum.web.test.pa
  * under the License.
  */
 
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+import org.apache.commons.io.IOUtils;
+import org.testng.Assert;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Map.Entry;
-
-import org.testng.Assert;
-
-import com.thoughtworks.selenium.DefaultSelenium;
-import com.thoughtworks.selenium.Selenium;
+import java.util.Properties;
 
 /**
  * Based on AbstractSeleniumTestCase of Emmanuel Venisse test.
- * 
+ *
  * @author José Morales Martínez
  * @version $Id$
  */
@@ -41,41 +44,85 @@ public abstract class AbstractSeleniumTe
 {
     public static String baseUrl;
 
+    public static String browser;
+
     public static String maxWaitTimeInMs;
 
-    private static ThreadLocal<Selenium> selenium;
+    private static ThreadLocal<Selenium> selenium = new ThreadLocal<Selenium>();
+
+    private static Properties p;
 
-    public static Properties p;
+    private final static String PROPERTIES_SEPARATOR = "=";
+    
+    private static String maxProjectWaitTimeInMs;
 
     /**
-     * Initialize selenium an others properties. This method is called from BeforeSuite method of sub-class.
+     * Initialize properties.
      */
     public void open()
         throws Exception
     {
+        InputStream input = this.getClass().getClassLoader().getResourceAsStream( "testng.properties" );
         p = new Properties();
-        p.load( this.getClass().getClassLoader().getResourceAsStream( "testng.properties" ) );
+        p.load( input );
+
+        maxWaitTimeInMs = getProperty( "MAX_WAIT_TIME_IN_MS" );
+        maxProjectWaitTimeInMs = getProperty( "MAX_PROJECT_WAIT_TIME_IN_MS" );
+    }
 
-        baseUrl = p.getProperty( "BASE_URL" );
-        maxWaitTimeInMs = p.getProperty( "MAX_WAIT_TIME_IN_MS" );
+    /**
+     * Initialize selenium
+     */
+    public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort )
+        throws Exception
+    {
+        this.baseUrl = baseUrl;
 
-        String seleniumHost = p.getProperty( "SELENIUM_HOST" );
-        int seleniumPort = Integer.parseInt( ( p.getProperty( "SELENIUM_PORT" ) ) );
-        String seleniumBrowser = p.getProperty( "SELENIUM_BROWSER" );
-        final Selenium s = new DefaultSelenium( seleniumHost, seleniumPort, seleniumBrowser, baseUrl );
-        selenium = new ThreadLocal<Selenium>()
+        this.browser = browser;
+
+        if ( getSelenium() == null )
         {
-            protected Selenium initialValue()
-            {
-                return s;
-            }
-        };
-        getSelenium().start();
+            DefaultSelenium s = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl );
+            s.start();
+            s.setTimeout( maxWaitTimeInMs );
+            selenium.set( s );
+        }
+    }
+
+    public static Selenium getSelenium()
+    {
+        return selenium == null ? null : selenium.get();
+    }
+
+    protected String getProperty( String key )
+    {
+        return p.getProperty( key );
     }
 
-    protected static Selenium getSelenium()
+    // TODO: look into removing this, as the issue should be fixed by upgrading the resources plugin to v2.4+
+    protected String getEscapeProperty( String key )
     {
-        return selenium.get();
+        InputStream input = this.getClass().getClassLoader().getResourceAsStream( "testng.properties" );
+        String value = null;
+        List<String> lines;
+        try
+        {
+            lines = IOUtils.readLines( input );
+        }
+        catch ( IOException e )
+        {
+            lines = new ArrayList<String>();
+        }
+        for ( String l : lines )
+        {
+            if ( l != null && l.startsWith( key ) )
+            {
+                int indexSeparator = l.indexOf( PROPERTIES_SEPARATOR );
+                value = l.substring( indexSeparator + 1 ).trim();
+                break;
+            }
+        }
+        return value;
     }
 
     /**
@@ -84,7 +131,11 @@ public abstract class AbstractSeleniumTe
     public void close()
         throws Exception
     {
-        getSelenium().stop();
+        if ( getSelenium() != null )
+        {
+            getSelenium().stop();
+            selenium.set( null );
+        }
     }
 
     // *******************************************************
@@ -139,7 +190,7 @@ public abstract class AbstractSeleniumTe
 
     public void assertLinkNotPresent( String text )
     {
-        Assert.assertFalse( isElementPresent( "link=" + text ), "The link '" + text + "' is present." );
+            Assert.assertFalse( isElementPresent( "link=" + text ), "The link '" + text + "' is present." );
     }
 
     public void assertImgWithAlt( String alt )
@@ -156,6 +207,11 @@ public abstract class AbstractSeleniumTe
         assertElementPresent( locator );
     }
 
+    public void assertImgWithAltNotPresent( String alt )
+    {
+        assertElementNotPresent( "//img[@alt='" + alt + "']" );
+    }
+
     public void assertCellValueFromTable( String expected, String tableElement, int row, int column )
     {
         Assert.assertEquals( expected, getCellValueFromTable( tableElement, row, column ) );
@@ -202,6 +258,7 @@ public abstract class AbstractSeleniumTe
         String[] optionsPresent = getSelenium().getSelectOptions( selectField );
         List<String> expected = Arrays.asList( options );
         List<String> present = Arrays.asList( optionsPresent );
+
         Assert.assertTrue( present.containsAll( expected ), "Options expected are not included in present options" );
     }
 
@@ -209,6 +266,7 @@ public abstract class AbstractSeleniumTe
     {
         assertElementPresent( fieldName );
         String optionsPresent = getSelenium().getSelectedLabel( value );
+
         Assert.assertEquals( optionsPresent, value );
     }
 
@@ -304,7 +362,6 @@ public abstract class AbstractSeleniumTe
 
     public void clickLinkWithLocator( String locator, boolean wait )
     {
-        assertElementPresent( locator );
         getSelenium().click( locator );
         if ( wait )
         {
@@ -353,4 +410,58 @@ public abstract class AbstractSeleniumTe
     {
         Assert.assertFalse( getSelenium().isChecked( locator ) );
     }
+
+    public void clickAndWait( String locator )
+    {
+        getSelenium().click( locator );
+        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+    }
+
+    public void waitForElementPresent( String locator )
+        throws Exception
+    {
+        waitForElementPresent( locator, true );
+    }
+    
+    /*
+     * This will wait for the condition to be met.
+     *   * shouldBePresent - if the locator is expected or not (true or false respectively)
+     */
+    public void waitForElementPresent( String locator, boolean shouldBePresent )
+        throws Exception
+    {
+        if ( browser.equals( "*iexplore" ) )
+        {
+            int currentIt = 0;
+            int maxIt = Integer.valueOf( getProperty( "WAIT_TRIES" ) );
+            String pageLoadTimeInMs = getProperty( "PAGE_LOAD_TIME_IN_MS" );
+            
+            while ( isElementPresent( locator ) != shouldBePresent && currentIt < maxIt )
+            {
+                getSelenium().waitForPageToLoad( pageLoadTimeInMs );
+                currentIt++;
+            }
+        }
+        else
+        {
+            String condition = "selenium.isElementPresent(\"" + locator + "\") == " + shouldBePresent;
+            waitForCondition( condition );
+        }
+    }
+
+    public void selectForOption( String locator, String text )
+    {
+        getSelenium().addSelection( locator, "label=" + text );
+    }
+
+    public void unselectForOption( String locator, String text )
+    {
+        getSelenium().removeSelection( locator, "label=" + text );
+    }
+    
+    public void waitForCondition( String condition )
+        throws Exception
+    {
+        getSelenium().waitForCondition( condition, maxProjectWaitTimeInMs );
+    }
 }

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/conf/catalina.policy
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/conf/catalina.policy?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/conf/catalina.policy (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/conf/catalina.policy Thu May  6 09:23:13 2010
@@ -1,172 +1,172 @@
-// ============================================================================
-// catalina.corepolicy - Security Policy Permissions for Tomcat 5
-//
-// This file contains a default set of security policies to be enforced (by the
-// JVM) when Catalina is executed with the "-security" option.  In addition
-// to the permissions granted here, the following additional permissions are
-// granted to the codebase specific to each web application:
-//
-// * Read access to the document root directory
-//
-// $Id: catalina.policy 393732 2006-04-13 06:32:25Z pero $
-// ============================================================================
-
-
-// ========== SYSTEM CODE PERMISSIONS =========================================
-
-
-// These permissions apply to javac
-grant codeBase "file:${java.home}/lib/-" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to all shared system extensions
-grant codeBase "file:${java.home}/jre/lib/ext/-" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
-grant codeBase "file:${java.home}/../lib/-" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to all shared system extensions when
-// ${java.home} points at $JAVA_HOME/jre
-grant codeBase "file:${java.home}/lib/ext/-" {
-        permission java.security.AllPermission;
-};
-
-
-// ========== CATALINA CODE PERMISSIONS =======================================
-
-
-// These permissions apply to the launcher code
-grant codeBase "file:${catalina.home}/bin/commons-launcher.jar" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to the daemon code
-grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to the commons-logging API
-grant codeBase "file:${catalina.home}/bin/commons-logging-api.jar" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to the server startup code
-grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to the JMX server
-grant codeBase "file:${catalina.home}/bin/jmx.jar" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to JULI
-grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to the servlet API classes
-// and those that are shared across all class loaders
-// located in the "common" directory
-grant codeBase "file:${catalina.home}/common/-" {
-        permission java.security.AllPermission;
-};
-
-// These permissions apply to the container's core code, plus any additional
-// libraries installed in the "server" directory
-grant codeBase "file:${catalina.home}/server/-" {
-        permission java.security.AllPermission;
-};
-
-// The permissions granted to the balancer WEB-INF/classes and WEB-INF/lib directory
-grant codeBase "file:${catalina.home}/webapps/balancer/-" {
-        permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.util.digester";
-        permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.util.digester.*";
-};
-// ========== WEB APPLICATION PERMISSIONS =====================================
-
-
-// These permissions are granted by default to all web applications
-// In addition, a web application will be given a read FilePermission
-// and JndiPermission for all files and directories in its document root.
-grant { 
-    // Required for JNDI lookup of named JDBC DataSource's and
-    // javamail named MimePart DataSource used to send mail
-    permission java.util.PropertyPermission "java.home", "read";
-    permission java.util.PropertyPermission "java.naming.*", "read";
-    permission java.util.PropertyPermission "javax.sql.*", "read";
-
-    // OS Specific properties to allow read access
-    permission java.util.PropertyPermission "os.name", "read";
-    permission java.util.PropertyPermission "os.version", "read";
-    permission java.util.PropertyPermission "os.arch", "read";
-    permission java.util.PropertyPermission "file.separator", "read";
-    permission java.util.PropertyPermission "path.separator", "read";
-    permission java.util.PropertyPermission "line.separator", "read";
-
-    // JVM properties to allow read access
-    permission java.util.PropertyPermission "java.version", "read";
-    permission java.util.PropertyPermission "java.vendor", "read";
-    permission java.util.PropertyPermission "java.vendor.url", "read";
-    permission java.util.PropertyPermission "java.class.version", "read";
-	permission java.util.PropertyPermission "java.specification.version", "read";
-	permission java.util.PropertyPermission "java.specification.vendor", "read";
-	permission java.util.PropertyPermission "java.specification.name", "read";
-
-	permission java.util.PropertyPermission "java.vm.specification.version", "read";
-	permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
-	permission java.util.PropertyPermission "java.vm.specification.name", "read";
-	permission java.util.PropertyPermission "java.vm.version", "read";
-	permission java.util.PropertyPermission "java.vm.vendor", "read";
-	permission java.util.PropertyPermission "java.vm.name", "read";
-
-    // Required for OpenJMX
-    permission java.lang.RuntimePermission "getAttribute";
-
-	// Allow read of JAXP compliant XML parser debug
-	permission java.util.PropertyPermission "jaxp.debug", "read";
-
-    // Precompiled JSPs need access to this package.
-    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
-    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime.*";
-    
-};
-
-
-// You can assign additional permissions to particular web applications by
-// adding additional "grant" entries here, based on the code base for that
-// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
-//
-// Different permissions can be granted to JSP pages, classes loaded from
-// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
-// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
-//
-// For instance, assume that the standard "examples" application
-// included a JDBC driver that needed to establish a network connection to the
-// corresponding database and used the scrape taglib to get the weather from
-// the NOAA web server.  You might create a "grant" entries like this:
-//
-// The permissions granted to the context root directory apply to JSP pages.
-// grant codeBase "file:${catalina.home}/webapps/examples/-" {
-//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
-//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
-// };
-//
-// The permissions granted to the context WEB-INF/classes directory
-// grant codeBase "file:${catalina.home}/webapps/examples/WEB-INF/classes/-" {
-// };
-//
-// The permission granted to your JDBC driver
-// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
-//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
-// };
-// The permission granted to the scrape taglib
-// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
-//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
-// };
-
+// ============================================================================
+// catalina.corepolicy - Security Policy Permissions for Tomcat 5
+//
+// This file contains a default set of security policies to be enforced (by the
+// JVM) when Catalina is executed with the "-security" option.  In addition
+// to the permissions granted here, the following additional permissions are
+// granted to the codebase specific to each web application:
+//
+// * Read access to the document root directory
+//
+// $Id$
+// ============================================================================
+
+
+// ========== SYSTEM CODE PERMISSIONS =========================================
+
+
+// These permissions apply to javac
+grant codeBase "file:${java.home}/lib/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions
+grant codeBase "file:${java.home}/jre/lib/ext/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/../lib/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions when
+// ${java.home} points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/lib/ext/-" {
+        permission java.security.AllPermission;
+};
+
+
+// ========== CATALINA CODE PERMISSIONS =======================================
+
+
+// These permissions apply to the launcher code
+grant codeBase "file:${catalina.home}/bin/commons-launcher.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the daemon code
+grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the commons-logging API
+grant codeBase "file:${catalina.home}/bin/commons-logging-api.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the server startup code
+grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the JMX server
+grant codeBase "file:${catalina.home}/bin/jmx.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to JULI
+grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the servlet API classes
+// and those that are shared across all class loaders
+// located in the "common" directory
+grant codeBase "file:${catalina.home}/common/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the container's core code, plus any additional
+// libraries installed in the "server" directory
+grant codeBase "file:${catalina.home}/server/-" {
+        permission java.security.AllPermission;
+};
+
+// The permissions granted to the balancer WEB-INF/classes and WEB-INF/lib directory
+grant codeBase "file:${catalina.home}/webapps/balancer/-" {
+        permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.util.digester";
+        permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.util.digester.*";
+};
+// ========== WEB APPLICATION PERMISSIONS =====================================
+
+
+// These permissions are granted by default to all web applications
+// In addition, a web application will be given a read FilePermission
+// and JndiPermission for all files and directories in its document root.
+grant { 
+    // Required for JNDI lookup of named JDBC DataSource's and
+    // javamail named MimePart DataSource used to send mail
+    permission java.util.PropertyPermission "java.home", "read";
+    permission java.util.PropertyPermission "java.naming.*", "read";
+    permission java.util.PropertyPermission "javax.sql.*", "read";
+
+    // OS Specific properties to allow read access
+    permission java.util.PropertyPermission "os.name", "read";
+    permission java.util.PropertyPermission "os.version", "read";
+    permission java.util.PropertyPermission "os.arch", "read";
+    permission java.util.PropertyPermission "file.separator", "read";
+    permission java.util.PropertyPermission "path.separator", "read";
+    permission java.util.PropertyPermission "line.separator", "read";
+
+    // JVM properties to allow read access
+    permission java.util.PropertyPermission "java.version", "read";
+    permission java.util.PropertyPermission "java.vendor", "read";
+    permission java.util.PropertyPermission "java.vendor.url", "read";
+    permission java.util.PropertyPermission "java.class.version", "read";
+	permission java.util.PropertyPermission "java.specification.version", "read";
+	permission java.util.PropertyPermission "java.specification.vendor", "read";
+	permission java.util.PropertyPermission "java.specification.name", "read";
+
+	permission java.util.PropertyPermission "java.vm.specification.version", "read";
+	permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
+	permission java.util.PropertyPermission "java.vm.specification.name", "read";
+	permission java.util.PropertyPermission "java.vm.version", "read";
+	permission java.util.PropertyPermission "java.vm.vendor", "read";
+	permission java.util.PropertyPermission "java.vm.name", "read";
+
+    // Required for OpenJMX
+    permission java.lang.RuntimePermission "getAttribute";
+
+	// Allow read of JAXP compliant XML parser debug
+	permission java.util.PropertyPermission "jaxp.debug", "read";
+
+    // Precompiled JSPs need access to this package.
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime.*";
+    
+};
+
+
+// You can assign additional permissions to particular web applications by
+// adding additional "grant" entries here, based on the code base for that
+// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
+//
+// Different permissions can be granted to JSP pages, classes loaded from
+// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
+// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
+//
+// For instance, assume that the standard "examples" application
+// included a JDBC driver that needed to establish a network connection to the
+// corresponding database and used the scrape taglib to get the weather from
+// the NOAA web server.  You might create a "grant" entries like this:
+//
+// The permissions granted to the context root directory apply to JSP pages.
+// grant codeBase "file:${catalina.home}/webapps/examples/-" {
+//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+//
+// The permissions granted to the context WEB-INF/classes directory
+// grant codeBase "file:${catalina.home}/webapps/examples/WEB-INF/classes/-" {
+// };
+//
+// The permission granted to your JDBC driver
+// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
+//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+// };
+// The permission granted to the scrape taglib
+// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
+//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/conf/catalina.policy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/conf/catalina.policy
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp-test/src/test/tomcat5x/context.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/pom.xml?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/pom.xml (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/pom.xml Thu May  6 09:23:13 2010
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <artifactId>continuum</artifactId>
     <groupId>org.apache.continuum</groupId>
-    <version>1.4.0-SNAPSHOT</version>
+    <version>1.4.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>continuum-webapp</artifactId>
@@ -52,49 +52,12 @@ under the License.
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-clean-plugin</artifactId>
-        <!-- This configuration is added to cleanup from war:inplace -->
+        <artifactId>maven-clean-plugin</artifactId>        
         <configuration>
           <filesets>
             <fileset>
               <directory>${basedir}/data</directory>
-            </fileset>
-            <fileset>
-              <directory>${basedir}/src/main/webapp</directory>
-              <includes>
-                <!-- TODO: META-INF shouldn't be required, seems to be an issue with the current war plugin -->
-                <include>META-INF</include>
-                <include>images/redback</include>
-                <!-- Images from other wars -->
-                <include>template/</include>
-                <!-- validation.js -->
-                <include>template/redback</include>
-                <!-- Templates from other wars -->
-                <include>WEB-INF/classes</include>
-                <!-- Classes and Resources from other wars -->
-                <include>WEB-INF/lib</include>
-                <!-- Dependencies from other wars -->
-                <include>WEB-INF/database</include>
-                <!-- Database location configured in application.xml -->
-                <include>WEB-INF/logs</include>
-                <!-- Log file location specified in application.xml -->
-                <include>redback</include>
-                <!-- plexus-redback css and javascript -->
-                <include>css/redback</include>
-                <include>WEB-INF/jsp/redback</include>
-                <!-- plexus-redback jsps -->
-                <include>WEB-INF/template/redback</include>
-                <!-- plexus-security xwork templates -->
-                <include>WEB-INF/build-output-directory</include>
-                <!-- Directory created by jetty:run -->
-                <include>WEB-INF/working-directory</include>
-                <!-- Directory created by jetty:run -->
-                <include>WEB-INF/logs</include>
-                <!-- Directory created by jetty:run -->
-                <include>WEB-INF/temp</include>
-                <!-- Directory created by jetty:run -->
-              </includes>
-            </fileset>
+            </fileset>            
           </filesets>
         </configuration>
       </plugin>
@@ -105,49 +68,9 @@ under the License.
           <!-- Some versions of maven-war-plugin (snapshots) have this incorrectly defaulted to true.
                Specifically setting this to false to avoid accidental jar file creation. -->
           <archiveClasses>false</archiveClasses>
-          <dependentWarExcludes>META-INF/**,WEB-INF/web.xml,WEB-INF/classes/xwork.xml,WEB-INF/lib/**
-          </dependentWarExcludes>
-        </configuration>
-        <!-- TODO: would be good to make the jetty plugin aware of these and remove the below -->
-        <executions>
-          <execution>
-            <phase>compile</phase>
-            <goals>
-              <!-- Needed to get the plexus-security war overlay to do its thing before jetty:run -->
-              <goal>inplace</goal>
-            </goals>
-          </execution>
-        </executions>
+          <dependentWarExcludes>META-INF/**,WEB-INF/web.xml,WEB-INF/classes/xwork.xml,WEB-INF/lib/**</dependentWarExcludes>
+        </configuration>       
       </plugin>
-		
-      <!-- 
-        here an hack to prevent multiple struts core in classpath
-        which prevent struts start 
-        and same struts.xml in the classpath too
-      -->
-      <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>cleanup-struts-jar-in-webapp</id>
-            <phase>compile</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <tasks>
-                <delete includeemptydirs="true">
-                  <fileset dir="${basedir}/src/main/webapp/WEB-INF/lib" includes="**/struts2*.jar" />
-                </delete>
-                <delete includeemptydirs="true">
-                  <fileset dir="${basedir}/src/main/webapp/WEB-INF/classes" includes="**/struts.*" />
-                </delete>
-              </tasks>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>		
-
       <plugin>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-maven-plugin</artifactId>
@@ -179,17 +102,9 @@ under the License.
           <execution>
             <id>web summary model classes</id>
             <configuration>
-              <model>src/main/mdo/view-models.mdo</model>
-              <version>1.0.0</version>
-            </configuration>
-            <goals>
-              <goal>java</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>session model classes</id>
-            <configuration>
-              <model>src/main/mdo/session-models.mdo</model>
+              <models>
+                <model>src/main/mdo/view-models.mdo</model>
+              </models>
               <version>1.0.0</version>
             </configuration>
             <goals>
@@ -199,7 +114,9 @@ under the License.
           <execution>
             <id>appearence model classes</id>
             <configuration>
-              <model>src/main/mdo/appearance-models.mdo</model>
+              <models>
+                <model>src/main/mdo/appearance-models.mdo</model>
+              </models>
               <version>1.0.0</version>
             </configuration>
             <goals>
@@ -207,8 +124,11 @@ under the License.
               <goal>xpp3-reader</goal>
               <goal>xpp3-writer</goal>
             </goals>
-          </execution>          
+          </execution>    
         </executions>
+        <configuration>
+          <useJava5>true</useJava5>
+        </configuration>
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
@@ -233,13 +153,65 @@ under the License.
           -->
         </configuration>
       </plugin>
+      
+      <!-- hack for jetty:run, continuum web config files are checked in /WEB-INF/ dir -->
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy-web-config-files</id>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <phase>compile</phase>
+            <configuration>
+              <tasks>
+                <mkdir dir="${basedir}/target/continuum/WEB-INF/" />
+                <copy todir="${basedir}/target/continuum/WEB-INF/">
+                  <fileset dir="${basedir}/target" includes="classes/" excludes="**/struts.xml" />         
+                </copy>
+              </tasks>              
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>unpack-redback-war</id>
+            <goals>
+             <goal>unpack</goal>
+            </goals>
+            <phase>compile</phase>
+            <configuration>
+               <artifactItems>
+                 <artifactItem>
+                   <groupId>org.codehaus.redback</groupId>
+                   <artifactId>redback-struts2-content</artifactId>
+                   <version>${redback.version}</version>
+                   <type>war</type>
+                   <overWrite>false</overWrite>
+                   <outputDirectory>${project.build.directory}/redback</outputDirectory>
+                   <excludes>**/struts-security.xml</excludes>
+                 </artifactItem>
+               </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>maven-jetty-plugin</artifactId>
         <configuration>
+          <webAppConfig>
+	        <contextPath>/</contextPath>	          
+	        <baseResource implementation="org.mortbay.resource.ResourceCollection">
+	          <resourcesAsCSV>src/main/webapp,target/continuum,target/redback</resourcesAsCSV>
+	        </baseResource>   
+          </webAppConfig>
           <scanIntervalSeconds>10</scanIntervalSeconds>
-          <contextPath>/</contextPath>
-          <jettyEnvXml>${basedir}/src/jetty-env.xml</jettyEnvXml>
+          <jettyEnvXml>${basedir}/src/jetty-env.xml</jettyEnvXml>          
           <connectors>
             <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
               <port>9090</port>
@@ -259,7 +231,7 @@ under the License.
               <name>derby.system.home</name>
               <value>${project.build.directory}/appserver-base/logs</value>
             </systemProperty>
-          </systemProperties>
+          </systemProperties>          
         </configuration>
         <dependencies>
           <dependency>
@@ -391,10 +363,6 @@ under the License.
       <artifactId>maven-app-configuration-web</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven.release</groupId>
-      <artifactId>maven-release-manager</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.continuum</groupId>
       <artifactId>continuum-builder</artifactId>
     </dependency>
@@ -446,6 +414,10 @@ under the License.
       <scope>runtime</scope>
     </dependency>
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+    </dependency>
+    <dependency>
       <groupId>com.atlassian.xmlrpc</groupId>
       <artifactId>atlassian-xmlrpc-binder-server-spring</artifactId>
       <scope>runtime</scope>
@@ -489,7 +461,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.scm</groupId>
       <artifactId>maven-scm-provider-svn-commons</artifactId>
-    </dependency>    
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.release</groupId>
       <artifactId>maven-release-manager</artifactId>
@@ -594,6 +566,7 @@ under the License.
     <dependency>
       <groupId>org.apache.struts</groupId>
       <artifactId>struts2-spring-plugin</artifactId>
+      <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java Thu May  6 09:23:13 2010
@@ -24,6 +24,9 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.continuum.configuration.BuildAgentGroupConfiguration;
+import org.apache.continuum.configuration.BuildAgentConfiguration;
+import org.apache.continuum.release.distributed.DistributedReleaseUtil;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
@@ -33,7 +36,7 @@ import org.codehaus.plexus.util.StringUt
 public class AbstractReleaseAction
     extends ContinuumActionSupport
 {
-    protected Map<String, String> getEnvironments( Profile profile )
+    protected Map<String, String> getEnvironments( Profile profile, String defaultBuildagent )
     {
         if ( profile == null )
         {
@@ -41,6 +44,35 @@ public class AbstractReleaseAction
         }
 
         Map<String, String> envVars = new HashMap<String, String>();
+        
+        if ( defaultBuildagent != null && defaultBuildagent.length() > 0 )
+        {
+            // get buildagent to be used from the buildagent group for distributed builds setup
+            BuildAgentGroupConfiguration group = getContinuum().getConfiguration().getBuildAgentGroup( profile.getBuildAgentGroup() );
+            
+            if ( group != null )
+            {
+                List<BuildAgentConfiguration> agents = group.getBuildAgents();
+                if ( agents != null )
+                {
+                    if ( isDefaultBuildAgentEnabledInGroup( defaultBuildagent, agents ) )
+                    {
+                        envVars.put( DistributedReleaseUtil.KEY_BUILD_AGENT_URL, defaultBuildagent );
+                    }
+                    else
+                    {
+                        for ( BuildAgentConfiguration agent : agents )
+                        {
+                            if ( agent.isEnabled() == true )
+                            {
+                                envVars.put( DistributedReleaseUtil.KEY_BUILD_AGENT_URL, agent.getUrl() );
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
 
         String javaHome = getJavaHomeValue( profile );
         if ( !StringUtils.isEmpty( javaHome ) )
@@ -61,6 +93,25 @@ public class AbstractReleaseAction
         }
         return envVars;
     }
+    
+    private boolean isDefaultBuildAgentEnabledInGroup( String defaultBuildagent, List<BuildAgentConfiguration> agents )
+    {
+        boolean isInGroup = false;
+        
+        for ( BuildAgentConfiguration agent : agents )
+        {
+            if ( agent.isEnabled() == true )
+            {
+                if ( defaultBuildagent.equals( agent.getUrl() ) )
+                {
+                    isInGroup = true;
+                    break;
+                }
+            }
+        }
+        
+        return isInGroup;
+    }
 
     private String getJavaHomeValue( Profile profile )
     {

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/ReleaseResultAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/ReleaseResultAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/ReleaseResultAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/ReleaseResultAction.java Thu May  6 09:23:13 2010
@@ -61,6 +61,8 @@ public class ReleaseResultAction
     private String projectName;
 
     private String releaseGoal;
+    
+    private String username;
 
     public String list()
         throws ContinuumException
@@ -142,6 +144,7 @@ public class ReleaseResultAction
 
         releaseGoal = releaseResult.getReleaseGoal();
         projectName = releaseResult.getProject().getName();
+        username = releaseResult.getUsername();
 
         try
         {
@@ -282,4 +285,14 @@ public class ReleaseResultAction
     {
         this.releaseGoal = releaseGoal;
     }
+    
+    public void setUsername( String username )
+    {
+        this.username = username;
+    }
+    
+    public String getUsername()
+    {
+        return username;
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java Thu May  6 09:23:13 2010
@@ -22,6 +22,8 @@ package org.apache.continuum.web.action.
 import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.apache.continuum.configuration.BuildAgentGroupConfiguration;
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.system.Installation;
@@ -52,11 +54,6 @@ public class BuildAgentAction
 {
     private static final Logger logger = LoggerFactory.getLogger( BuildAgentAction.class );
 
-    /**
-     * @plexus.requirement
-     */
-    private DistributedBuildManager distributedBuildManager;
-
     private List<BuildAgentConfiguration> buildAgents;
 
     private BuildAgentConfiguration buildAgent;
@@ -139,7 +136,7 @@ public class BuildAgentAction
 
                 try
                 {
-                    installations = distributedBuildManager.getAvailableInstallations( buildAgent.getUrl() );
+                    installations = getContinuum().getDistributedBuildManager().getAvailableInstallations( buildAgent.getUrl() );
                 }
                 catch ( ContinuumException e )
                 {
@@ -170,14 +167,21 @@ public class BuildAgentAction
                     agent.setEnabled( buildAgent.isEnabled() );
 
                     configuration.updateBuildAgent( agent );
+                    configuration.store();
                     found = true;
                 }
             }
         }
 
+        AuditLog event = new AuditLog( "Build Agent URL=" + buildAgent.getUrl(), AuditLogConstants.MODIFY_BUILD_AGENT );
+        event.setCategory( AuditLogConstants.BUILD_AGENT );
+        event.setCurrentUser( getPrincipal() );
+
         if ( !found )
         {
             configuration.addBuildAgent( buildAgent );
+            configuration.store();
+            event.setAction( AuditLogConstants.ADD_BUILD_AGENT );
         }
         else
         {
@@ -188,7 +192,8 @@ public class BuildAgentAction
             }
         }
 
-        distributedBuildManager.reload();
+        getContinuum().getDistributedBuildManager().reload();
+        event.log();
 
         return SUCCESS;
     }
@@ -201,33 +206,45 @@ public class BuildAgentAction
             return CONFIRM;
         }
 
-        if ( distributedBuildManager.isBuildAgentBusy( buildAgent.getUrl() ) )
+        if ( getContinuum().getDistributedBuildManager().isBuildAgentBusy( buildAgent.getUrl() ) )
         {
             message = getText( "buildAgent.error.delete.busy" );
             return ERROR;
         }
-        else
-        {
-            distributedBuildManager.removeAgentFromTaskQueueExecutor( buildAgent.getUrl() );
-        }
 
         ConfigurationService configuration = getContinuum().getConfiguration();
 
-        for ( BuildAgentGroupConfiguration buildAgentGroup : configuration.getBuildAgentGroups() )
-        {
-            if ( configuration.containsBuildAgentUrl( buildAgent.getUrl(), buildAgentGroup ) )
+        if ( configuration.getBuildAgentGroups() != null )
+        {   
+            for ( BuildAgentGroupConfiguration buildAgentGroup : configuration.getBuildAgentGroups() )
             {
-                message = getText( "buildAgent.error.remove.in.use" );
-                return ERROR;
+                if ( configuration.containsBuildAgentUrl( buildAgent.getUrl(), buildAgentGroup ) )
+                {
+                    message = getText( "buildAgent.error.remove.in.use" );
+                    return ERROR;
+                }
             }
         }
 
-        for ( BuildAgentConfiguration agent : configuration.getBuildAgents() )
+        if ( configuration.getBuildAgents() != null )
         {
-            if ( buildAgent.getUrl().equals( agent.getUrl() ) )
+            for ( BuildAgentConfiguration agent : configuration.getBuildAgents() )
             {
-                configuration.removeBuildAgent( agent );
-                return SUCCESS;
+                if ( buildAgent.getUrl().equals( agent.getUrl() ) )
+                {
+                    getContinuum().getDistributedBuildManager().removeDistributedBuildQueueOfAgent( buildAgent.getUrl() );
+                    configuration.removeBuildAgent( agent );
+                    configuration.store();
+
+                    AuditLog event = new AuditLog( "Build Agent URL=" + agent.getUrl(), AuditLogConstants.REMOVE_BUILD_AGENT );
+                    event.setCategory( AuditLogConstants.BUILD_AGENT );
+                    event.setCurrentUser( getPrincipal() );
+                    event.log();
+
+                    getContinuum().getDistributedBuildManager().reload();
+
+                    return SUCCESS;
+                }
             }
         }
 
@@ -260,6 +277,12 @@ public class BuildAgentAction
             if ( buildAgentGroup.getName().equals( group.getName() ) )
             {
                 configuration.removeBuildAgentGroup( group );
+
+                AuditLog event = new AuditLog( "Build Agent Group=" + group.getName(), AuditLogConstants.REMOVE_BUILD_AGENT_GROUP );
+                event.setCategory( AuditLogConstants.BUILD_AGENT );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
+
                 return SUCCESS;
             }
         }
@@ -304,10 +327,15 @@ public class BuildAgentAction
             }
         }
 
+        AuditLog event = new AuditLog( "Build Agent Group=" + buildAgentGroup.getName(), AuditLogConstants.MODIFY_BUILD_AGENT_GROUP );
+        event.setCategory( AuditLogConstants.BUILD_AGENT );
+        event.setCurrentUser( getPrincipal() );
+
         if ( !found )
         {
             buildAgentGroup.setBuildAgents( selectedbuildAgents );
             configuration.addBuildAgentGroup( buildAgentGroup );
+            event.setAction( AuditLogConstants.ADD_BUILD_AGENT_GROUP );
         }
         else
         // found
@@ -324,7 +352,8 @@ public class BuildAgentAction
             }
         }
 
-        distributedBuildManager.reload();
+        getContinuum().getDistributedBuildManager().reload();
+        event.log();
 
         return SUCCESS;
     }

Propchange: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May  6 09:23:13 2010
@@ -1,2 +1,2 @@
-/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java:766106,766120-766121,766641,766645,766669,766977,767397,767792,767796,768222
+/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java:760767-900271,915354,915760,915848-915864,916073-916074
 /continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java:713270-724659,724671-733412

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java Thu May  6 09:23:13 2010
@@ -30,6 +30,8 @@ import org.apache.continuum.purge.Contin
 import org.apache.continuum.purge.PurgeConfigurationService;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.web.action.ContinuumConfirmAction;
@@ -68,9 +70,7 @@ public class LocalRepositoryAction
     private List<String> layouts;
     
     private Map<String, Boolean> defaultPurgeMap;
-    
-    private String message;
-    
+
     /**
      * @plexus.requirement
      */
@@ -112,13 +112,6 @@ public class LocalRepositoryAction
     public String list()
         throws Exception
     {
-        String errorMessage = ServletActionContext.getRequest().getParameter( "errorMessage" );
-        
-        if ( errorMessage != null )
-        {
-            addActionError( getText( errorMessage ) );
-        }
-        
         repositories = repositoryService.getAllLocalRepositories();
         
         defaultPurgeMap = new HashMap<String, Boolean>();
@@ -150,12 +143,12 @@ public class LocalRepositoryAction
         {
             if ( repository.getId() != repo.getId() )
             {
-                if ( repository.getName().equals( repo.getName() ) )
+                if ( repository.getName().trim().equals( repo.getName() ) )
                 {
                     addActionError( getText( "repository.error.name.unique" ) );
                 }
                 
-                if ( repository.getLocation().equals( repo.getLocation() ) )
+                if ( repository.getLocation().trim().equals( repo.getLocation() ) )
                 {
                     addActionError( getText( "repository.error.location.unique" ) );
                 }
@@ -177,6 +170,10 @@ public class LocalRepositoryAction
             return INPUT;
         }
         
+        // trim repository name and location before saving
+        repository.setName( repository.getName().trim() );
+        repository.setLocation( repository.getLocation().trim() );
+        
         if ( repository.getId() == 0 )
         {
             repository = repositoryService.addLocalRepository( repository );
@@ -209,29 +206,31 @@ public class LocalRepositoryAction
         throws Exception
     {
         TaskQueueManager taskQueueManager = getContinuum().getTaskQueueManager();
+
+        repository = repositoryService.getLocalRepository( repository.getId() );
+
         if ( taskQueueManager.isRepositoryInUse( repository.getId() ) )
         {
-            message = "repository.error.remove.in.use";
-            return ERROR;
+            addActionError( getText( "repository.error.remove.in.use", "Unable to remove local repository because it is in use" ) );
         }
-        
-        repository = repositoryService.getLocalRepository( repository.getId() );
-        
+
         if ( repository.getName().equals( "DEFAULT" ) )
         {
-            message = "repository.error.remove.default";
-            return ERROR;
-        }
-        
-        if ( confirmed )
-        {
-            repositoryService.removeLocalRepository( repository.getId() );
+            addActionError( getText( "repository.error.remove.default", "Unable to remove default local repository" ) );
         }
-        else
+
+        if ( !hasActionErrors() )
         {
-            return CONFIRM;
+            if ( confirmed )
+            {
+                repositoryService.removeLocalRepository( repository.getId() );
+            }
+            else
+            {
+                return CONFIRM;
+            }
         }
-        
+
         return SUCCESS;
     }
     
@@ -244,18 +243,24 @@ public class LocalRepositoryAction
         // check if repository is in use
         if ( taskQueueManager.isRepositoryInUse( repository.getId() ) )
         {
-            message = "repository.error.purge.in.use";
-            return ERROR;
+            addActionError( getText( "repository.error.purge.in.use", "Unable to purge repository because it is in use" ) );
         }
-        
-        // get default purge configuration for repository
-        RepositoryPurgeConfiguration purgeConfig = purgeConfigService.getDefaultPurgeConfigurationForRepository( repository.getId() );
-        
-        if ( purgeConfig != null )
+     
+        if ( !hasActionErrors() )
         {
-            purgeManager.purgeRepository( purgeConfig );
-        }
+            // get default purge configuration for repository
+            RepositoryPurgeConfiguration purgeConfig = purgeConfigService.getDefaultPurgeConfigurationForRepository( repository.getId() );
         
+            if ( purgeConfig != null )
+            {
+                purgeManager.purgeRepository( purgeConfig );
+
+                AuditLog event = new AuditLog( "Repository id=" + repository.getId(), AuditLogConstants.PURGE_LOCAL_REPOSITORY );
+                event.setCategory( AuditLogConstants.LOCAL_REPOSITORY );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
+            }
+        }
         return SUCCESS;
     }
     
@@ -323,17 +328,7 @@ public class LocalRepositoryAction
     {
         this.defaultPurgeMap = defaultPurgeMap;
     }
-    
-    public String getMessage()
-    {
-        return this.message;
-    }
-    
-    public void setMessage( String message )
-    {
-        this.message = message;
-    }
-    
+
     private void createDefaultPurgeConfiguration()
         throws Exception
     {



Mime
View raw message