continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jzurb...@apache.org
Subject svn commit: r907163 - in /continuum/trunk: continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
Date Sat, 06 Feb 2010 03:25:25 GMT
Author: jzurbano
Date: Sat Feb  6 03:25:24 2010
New Revision: 907163

URL: http://svn.apache.org/viewvc?rev=907163&view=rev
Log:
[CONTINUUM-2397] - Unable to edit the added local repository
* trim() repository name and location when comparing for duplicates and before saving
* added selenium test on adding duplicate repository with trailing spaces; adjusted the dependsOnMethods
of the tests

Submitted by: Garry Baal


Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java?rev=907163&r1=907162&r2=907163&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java
Sat Feb  6 03:25:24 2010
@@ -56,8 +56,19 @@
         assertTextPresent( "Local repository name must be unique" );
         assertTextPresent( "Local repository location must be unique" );
     }
-
+    
     @Test( dependsOnMethods = { "testAddDuplicatedLocalRepository" } )
+    public void testAddDuplicateLocalRepositoryWithTrailingWhitespaces()
+    {
+        String duplicateRepositoryName = addTrailingWhitespace( getProperty( "LOCAL_REPOSITORY_NAME"
) );
+        String duplicateRepositoryLocation = addTrailingWhitespace( getProperty( "LOCAL_REPOSITORY_LOCATION"
) );
+        goToAddLocalRepository();
+        addEditLocalRepository( duplicateRepositoryName, duplicateRepositoryLocation, false
);
+        assertTextPresent( "Local repository name must be unique" );
+        assertTextPresent( "Local repository location must be unique" );
+    }
+
+    @Test( dependsOnMethods = { "testAddDuplicateLocalRepositoryWithTrailingWhitespaces"
} )
     public void testEditLocalRepository()
     {
         String LOCAL_REPOSITORY_NAME = getProperty( "LOCAL_REPOSITORY_NAME" );
@@ -76,4 +87,10 @@
         String LOCAL_REPOSITORY_NAME = getProperty( "LOCAL_REPOSITORY_NAME" );
         removeLocalRepository( LOCAL_REPOSITORY_NAME );
     }
+
+    private String addTrailingWhitespace( String str )
+    {
+        String WHITESPACE = "    ";
+        return WHITESPACE.concat( str.concat( WHITESPACE ) );
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java?rev=907163&r1=907162&r2=907163&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
Sat Feb  6 03:25:24 2010
@@ -143,12 +143,12 @@
         {
             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" ) );
                 }
@@ -170,6 +170,10 @@
             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 );



Mime
View raw message