archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r900692 - /archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
Date Tue, 19 Jan 2010 07:45:04 GMT
Author: brett
Date: Tue Jan 19 07:45:04 2010
New Revision: 900692

URL: http://svn.apache.org/viewvc?rev=900692&view=rev
Log:
[MRM-1282] clean up edit test, note that a location change does not delete audit events

Modified:
    archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java

Modified: archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java?rev=900692&r1=900691&r2=900692&view=diff
==============================================================================
--- archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
(original)
+++ archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
Tue Jan 19 07:45:04 2010
@@ -25,6 +25,7 @@
 
 import com.opensymphony.xwork2.Action;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
@@ -36,7 +37,7 @@
 import org.easymock.MockControl;
 
 /**
- * EditManagedRepositoryActionTest 
+ * EditManagedRepositoryActionTest
  *
  * @version $Id$
  */
@@ -140,10 +141,17 @@
         ManagedRepositoryConfiguration repository = action.getRepository();
         populateRepository( repository );
         repository.setName( "new repo name" );
-        
+
+        MockControl repositoryStatisticsManagerControl = MockControl.createControl( RepositoryStatisticsManager.class
);
+        RepositoryStatisticsManager repositoryStatisticsManager =
+            (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock();
+        action.setRepositoryStatisticsManager( repositoryStatisticsManager );
+        // no deletion
+        repositoryStatisticsManagerControl.replay();
+
         String status = action.commit();
         assertEquals( Action.SUCCESS, status );
-        
+
         ManagedRepositoryConfiguration newRepository = createRepository();
         newRepository.setName( "new repo name" );
         assertRepositoryEquals( repository, newRepository );
@@ -151,6 +159,7 @@
 
         roleManagerControl.verify();
         archivaConfigurationControl.verify();
+        repositoryStatisticsManagerControl.verify();
     }
 
     public void testEditRepositoryLocationChanged()
@@ -181,18 +190,18 @@
         RepositoryStatisticsManager repositoryStatisticsManager =
             (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock();
         action.setRepositoryStatisticsManager( repositoryStatisticsManager );
-
         repositoryStatisticsManager.deleteStatistics( REPO_ID );
-
         repositoryStatisticsManagerControl.replay();
 
         action.setRepoid( REPO_ID );
         action.prepare();
         assertEquals( REPO_ID, action.getRepoid() );
-        
+
         ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
         populateRepository( repository );
-        repository.setLocation( new File( "target/test/location/new" ).getCanonicalPath()
);
+        File testFile = getTestFile( "target/test/location/new" );
+        FileUtils.deleteDirectory( testFile );
+        repository.setLocation( testFile.getCanonicalPath() );
         action.setRepository( repository );
         String status = action.commit();
         assertEquals( Action.SUCCESS, status );
@@ -202,7 +211,7 @@
         archivaConfigurationControl.verify();
         repositoryStatisticsManagerControl.verify();
     }
-    
+
     private void assertRepositoryEquals( ManagedRepositoryConfiguration expectedRepository,
                                          ManagedRepositoryConfiguration actualRepository
)
     {



Mime
View raw message