]> source.dussan.org Git - archiva.git/commitdiff
make more of the tests spring enabled
authorBrett Porter <brett@apache.org>
Thu, 13 Mar 2008 05:58:35 +0000 (05:58 +0000)
committerBrett Porter <brett@apache.org>
Thu, 13 Mar 2008 05:58:35 +0000 (05:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@636637 13f79535-47bb-0310-9956-ffa450edef68

16 files changed:
springy/archiva-base/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/spring-context.xml [deleted file]
springy/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
springy/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml [new file with mode: 0644]
springy/archiva-base/archiva-policies/src/test/resources/log4j.xml
springy/archiva-base/archiva-policies/src/test/resources/org/apache/maven/archiva/policies/CachedFailuresPolicyTest-context.xml [deleted file]
springy/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/spring-context.xml [deleted file]
springy/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/spring-context.xml [deleted file]
springy/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java
springy/archiva-database/src/test/java/org/apache/maven/archiva/database/browsing/RepositoryBrowsingTest.java
springy/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/DatabaseConsumersTest.java
springy/archiva-reporting/archiva-artifact-reports/src/test/java/org/apache/maven/archiva/reporting/artifact/AbstractArtifactReportsTestCase.java
springy/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java
springy/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java
springy/archiva-web/archiva-security/src/test/java/org/apache/maven/archiva/security/SecurityStartupTest.java
springy/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletTestCase.java
springy/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/spring-context.xml [deleted file]

diff --git a/springy/archiva-base/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/spring-context.xml b/springy/archiva-base/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/spring-context.xml
deleted file mode 100644 (file)
index 98fcd7f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-  <bean id="urlFailureCache" class="org.apache.maven.archiva.policies.urlcache.DefaultUrlFailureCache">
-    <constructor-arg ref="cache#url-failures-cache" type="org.codehaus.plexus.cache.Cache"/>
-  </bean>
-</beans>
\ No newline at end of file
index 62385382422f59457d43399ffcba92dd81f0b695..828aa74c4f55b5e31567109f95442487e620159d 100644 (file)
@@ -25,9 +25,9 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException;
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.JdoFactory;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.jpox.SchemaTool;
 
 import java.io.File;
@@ -46,7 +46,7 @@ import javax.jdo.PersistenceManagerFactory;
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
 public abstract class AbstractRepositoryPurgeTest
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     public static final String TEST_REPO_ID = "test-repo";
 
diff --git a/springy/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml b/springy/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml
new file mode 100644 (file)
index 0000000..840223b
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+  <bean id="urlFailureCache" class="org.apache.maven.archiva.policies.urlcache.DefaultUrlFailureCache">
+    <!-- collaborators and configuration for this bean go here -->
+    <constructor-arg ref="cache#url-failures-cache" type="org.codehaus.plexus.cache.Cache"/>
+  </bean>
+
+</beans>
\ No newline at end of file
index 9d9aefa8454a53df2137eafde543b0764e454caa..9bb5e1e5a0ac425e42ac5570eca37468ffcd2411 100644 (file)
     <level value="error"/>
   </logger>
 
+  <logger name="org.codehaus.plexus.spring">
+    <level value="warn"/>
+  </logger>
+
   <logger name="org.springframework">
-    <level value="DEBUG"/>
+    <level value="warn"/>
   </logger>
 
   <root>
diff --git a/springy/archiva-base/archiva-policies/src/test/resources/org/apache/maven/archiva/policies/CachedFailuresPolicyTest-context.xml b/springy/archiva-base/archiva-policies/src/test/resources/org/apache/maven/archiva/policies/CachedFailuresPolicyTest-context.xml
deleted file mode 100644 (file)
index 840223b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-  <bean id="urlFailureCache" class="org.apache.maven.archiva.policies.urlcache.DefaultUrlFailureCache">
-    <!-- collaborators and configuration for this bean go here -->
-    <constructor-arg ref="cache#url-failures-cache" type="org.codehaus.plexus.cache.Cache"/>
-  </bean>
-
-</beans>
\ No newline at end of file
diff --git a/springy/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/spring-context.xml b/springy/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/spring-context.xml
deleted file mode 100644 (file)
index 98fcd7f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-  <bean id="urlFailureCache" class="org.apache.maven.archiva.policies.urlcache.DefaultUrlFailureCache">
-    <constructor-arg ref="cache#url-failures-cache" type="org.codehaus.plexus.cache.Cache"/>
-  </bean>
-</beans>
\ No newline at end of file
diff --git a/springy/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/spring-context.xml b/springy/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/spring-context.xml
deleted file mode 100644 (file)
index c4051cc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-  <bean id="loggerManager" class="org.codehaus.plexus.logging.console.ConsoleLoggerManager"
-    init-method="initialize"/>
-
-  <bean id="urlFailureCache" class="org.apache.maven.archiva.policies.urlcache.DefaultUrlFailureCache">
-    <constructor-arg ref="cache#url-failures-cache" type="org.codehaus.plexus.cache.Cache"/>
-  </bean>
-</beans>
\ No newline at end of file
index be87fc857d06de16baeb0789e73bf57067a271df..d40fed4d84827a90d1e12333194377e72ce8ce29 100644 (file)
@@ -26,9 +26,9 @@ import org.apache.maven.archiva.database.updater.TestDatabaseCleanupConsumer;
 import org.apache.maven.archiva.database.updater.TestDatabaseUnprocessedConsumer;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.VersionedReference;
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.JdoFactory;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.jpox.SchemaTool;
 
 import java.io.File;
@@ -49,7 +49,7 @@ import javax.jdo.PersistenceManagerFactory;
  * @version $Id$
  */
 public abstract class AbstractArchivaDatabaseTestCase
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     private static final String TIMESTAMP = "yyyy/MM/dd HH:mm:ss";
 
index 8f2e6bf27d8834d1c7b6b91cbf5dae0ee353e88e..3eb408b9cfe23cc86b506a9865ff65018943e7d3 100644 (file)
@@ -61,7 +61,7 @@ public class RepositoryBrowsingTest
     public RepositoryBrowsing lookupBrowser()
         throws Exception
     {
-        RepositoryBrowsing browser = (RepositoryBrowsing) lookup( RepositoryBrowsing.class.getName() );
+        RepositoryBrowsing browser = (RepositoryBrowsing) lookup( RepositoryBrowsing.class );
         assertNotNull( "RepositoryBrowsing should not be null.", browser );
         return browser;
     }
index 18265657a9c46bfc6ce007ecbff815b0c227f461..5757742838aed342298c6b1a71c8a2602cce672b 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.database.updater;
  */
 
 import org.apache.commons.collections.CollectionUtils;
-import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 
 import java.util.List;
 
@@ -31,7 +31,7 @@ import java.util.List;
  * @version $Id$
  */
 public class DatabaseConsumersTest
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     private DatabaseConsumers lookupDbConsumers()
         throws Exception
index 40630faa4373ff2acaee9a7e0fe35264f0a52bda..577cdba6897d87cfcfdf045c79cf5a9b9c1b23c8 100644 (file)
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.reporting.artifact;
  */
 
 import org.apache.maven.archiva.database.ArchivaDAO;
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.JdoFactory;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.jpox.SchemaTool;
 
 import java.io.File;
@@ -41,7 +41,7 @@ import javax.jdo.PersistenceManagerFactory;
  * @version $Id$
  */
 public abstract class AbstractArtifactReportsTestCase
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     protected ArchivaDAO dao;
     
index ebdb592c31fd3dc838ad6202b5100b921fa20436..94f5d34bbbebe8c45c9c527fa3866868a9074836 100644 (file)
@@ -26,9 +26,9 @@ import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.JdoFactory;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 import org.jpox.SchemaTool;
 
@@ -51,7 +51,7 @@ import javax.jdo.PersistenceManagerFactory;
  * @version $Id:$
  */
 public class ArchivaDatabaseUpdateTaskExecutorTest
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     private TaskExecutor taskExecutor;
 
index 8f935289f39f157f23d22bd9ce17dc8842f6ba46..4570ea7cf208cef4b6862156a98270d23a98b665 100644 (file)
@@ -26,9 +26,9 @@ import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
 import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.JdoFactory;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 import org.jpox.SchemaTool;
 
@@ -49,7 +49,7 @@ import javax.jdo.PersistenceManagerFactory;
  * @version $Id$
  */
 public class ArchivaRepositoryScanningTaskExecutorTest
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     private TaskExecutor taskExecutor;
 
index f3924f9346d5bec9165322c086817c2e11466a06..7096133cc94e2d4c940eadabb2b321f35ead5a05 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.security;
  * under the License.
  */
 
-import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 
 /**
  * SecurityStartupTest 
@@ -28,7 +28,7 @@ import org.codehaus.plexus.PlexusTestCase;
  * @version $Id$
  */
 public class SecurityStartupTest
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     private SecurityStartup secStart;
 
index a72c99b9bb8a7af09f5d57e5e9ded066f36044d9..b08ca932852e169d2b416c042df5e223666e80de 100644 (file)
@@ -23,13 +23,12 @@ import com.meterware.httpunit.WebResponse;
 import com.meterware.servletunit.ServletRunner;
 import com.meterware.servletunit.ServletUnitClient;
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.spring.PlexusFactory;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.xml.XmlBeanFactory;
 import org.springframework.core.io.ClassPathResource;
@@ -47,7 +46,7 @@ import java.io.IOException;
  * @version $Id$
  */
 public abstract class AbstractRepositoryServletTestCase
-    extends PlexusTestCase
+    extends PlexusInSpringTestCase
 {
     protected static final String REPOID_INTERNAL = "internal";
 
@@ -145,48 +144,44 @@ public abstract class AbstractRepositoryServletTestCase
         throws Exception
     {
         super.setUp();
-        
-        String appserverBase = getTestFile( "target/appserver-base" ).getAbsolutePath();
-        System.setProperty( "appserver.base", appserverBase );
-
-        File testConf = getTestFile( "src/test/resources/repository-archiva.xml" );
-        File testConfDest = new File( appserverBase, "conf/archiva.xml" );
-        FileUtils.copyFile( testConf, testConfDest );
-
-        BeanFactory factory = new XmlBeanFactory(
-            new ClassPathResource( "/org/apache/maven/archiva/web/repository/spring-context.xml" ) );
-        getContainer().getContext().put( BeanFactory.class, factory );
-        PlexusFactory plexusFactory = (PlexusFactory) factory.getBean( "plexusCacheFactory" );
-        plexusFactory.setContainer( container );
-
-        archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
-        repoRootInternal = new File( appserverBase, "data/repositories/internal" );
-        Configuration config = archivaConfiguration.getConfiguration();
-
-        config.addManagedRepository( createManagedRepository( REPOID_INTERNAL, "Internal Test Repo", repoRootInternal ) );
-        saveConfiguration();
-
-        sr = new ServletRunner();
-        sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
-        sc = sr.newClient();
-        HttpSession session = sc.getSession( true );
-        ServletContext servletContext = session.getServletContext();
-        servletContext.setAttribute( PlexusConstants.PLEXUS_KEY, getContainer() );
+
+        try
+        {
+            String appserverBase = getTestFile( "target/appserver-base" ).getAbsolutePath();
+            System.setProperty( "appserver.base", appserverBase );
+
+            File testConf = getTestFile( "src/test/resources/repository-archiva.xml" );
+            File testConfDest = new File( appserverBase, "conf/archiva.xml" );
+            FileUtils.copyFile( testConf, testConfDest );
+
+            archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
+            repoRootInternal = new File( appserverBase, "data/repositories/internal" );
+            Configuration config = archivaConfiguration.getConfiguration();
+
+            config.addManagedRepository( createManagedRepository( REPOID_INTERNAL, "Internal Test Repo", repoRootInternal ) );
+            saveConfiguration();
+
+            sr = new ServletRunner();
+            sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
+            sc = sr.newClient();
+        }
+        finally
+        {
+            tearDown();
+        }
     }
-    
+
     @Override
-    protected String getConfigurationName( String subname )
+    protected String getPlexusConfigLocation()
         throws Exception
     {
         return "org/apache/maven/archiva/web/repository/RepositoryServletTest.xml";
     }
-    
+
     @Override
     protected void tearDown()
         throws Exception
     {
-        release( archivaConfiguration );
-        
         if ( sc != null )
         {
             sc.clearContents();
diff --git a/springy/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/spring-context.xml b/springy/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/spring-context.xml
deleted file mode 100644 (file)
index 055e8f9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-  <bean id="urlFailureCache" class="org.apache.maven.archiva.policies.urlcache.DefaultUrlFailureCache">
-    <!-- collaborators and configuration for this bean go here -->
-    <constructor-arg ref="urlCache" type="org.codehaus.plexus.cache.Cache"/>
-  </bean>
-  <bean id="urlCache" factory-bean="plexusCacheFactory" factory-method="createInstance"/>
-  <bean id="plexusCacheFactory" class="org.apache.maven.archiva.common.spring.PlexusFactory">
-    <constructor-arg index="0" value="org.codehaus.plexus.cache.Cache"/>
-    <constructor-arg index="1" value="url-failures-cache"/>
-  </bean>
-</beans>
\ No newline at end of file