]> source.dussan.org Git - archiva.git/commitdiff
throw exception when id or cron expression are empty
authorOlivier Lamy <olamy@apache.org>
Thu, 1 Sep 2011 16:43:14 +0000 (16:43 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 1 Sep 2011 16:43:14 +0000 (16:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1164154 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java

index bc5d0cf9ee986395c0ec6f87330022b0c5a0b5c6..992987e53bf0c41728ee06c19c02805f35530e32 100644 (file)
@@ -181,8 +181,15 @@ public class DefaultManagedRepositoryAdmin
                 throw new RepositoryAdminException( "Invalid cron expression." );
             }
         }
+        else
+        {
+            throw new RepositoryAdminException( "Cron expression cannot be empty." );
+        }
 
-        // FIXME checkId non empty
+        if (StringUtils.isBlank( repoId  ))
+        {
+            throw new RepositoryAdminException( "Repository ID cannot be empty." );
+        }
 
         if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) )
         {
index 55157261284503f10aac203f298e20a567a68186..a5eedb46ff479c1c7ee0178cbd42091331fe1c0f 100644 (file)
@@ -100,6 +100,7 @@ public class ManagedRepositoryAdminTest
         repo.setId( repoId );
         repo.setName( "test repo" );
         repo.setLocation( repoLocation );
+        repo.setCronExpression(  "0 0 * * * ?" );
         managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
         repos = managedRepositoryAdmin.getManagedRepositories();
         assertNotNull( repos );
@@ -147,6 +148,7 @@ public class ManagedRepositoryAdminTest
         repo.setId( repoId );
         repo.setName( "test repo" );
         repo.setLocation( repoLocation );
+        repo.setCronExpression(  "0 0 * * * ?" );
         managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
 
         assertTemplateRoleExists( repoId );
@@ -160,6 +162,7 @@ public class ManagedRepositoryAdminTest
         repo.setName( newName );
 
         repo.setLocation( repoLocation );
+        repo.setCronExpression(  "0 0 * * * ?" );
 
         managedRepositoryAdmin.updateManagedRepository( repo, false, getFakeAuditInformation(), false );
 
@@ -204,6 +207,7 @@ public class ManagedRepositoryAdminTest
         repo.setId( repoId );
         repo.setName( "test repo" );
         repo.setLocation( repoLocation );
+        repo.setCronExpression(  "0 0 * * * ?" );
         managedRepositoryAdmin.addManagedRepository( repo, true, getFakeAuditInformation() );
         repos = managedRepositoryAdmin.getManagedRepositories();
         assertNotNull( repos );