archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1131450 - in /archiva/trunk: ./ archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ archiva-modules/archiva-web/archiva-webdav/ archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/m...
Date Sat, 04 Jun 2011 18:01:23 GMT
Author: olamy
Date: Sat Jun  4 18:01:22 2011
New Revision: 1131450

URL: http://svn.apache.org/viewvc?rev=1131450&view=rev
Log:
fix some test spring setup for archiva-webdav

Modified:
    archiva/trunk/.gitignore
    archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/pom.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml

Modified: archiva/trunk/.gitignore
URL: http://svn.apache.org/viewvc/archiva/trunk/.gitignore?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/.gitignore (original)
+++ archiva/trunk/.gitignore Sat Jun  4 18:01:22 2011
@@ -2,3 +2,4 @@ target
 build
 *.iml
 derby.log
+${plexus.home}

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java
Sat Jun  4 18:01:22 2011
@@ -35,17 +35,17 @@ import javax.inject.Named;
  *
  * @version $Id$
  * 
- * @plexus.component role="org.codehaus.plexus.redback.system.check.EnvironmentCheck"
+ * plexus.component role="org.codehaus.plexus.redback.system.check.EnvironmentCheck"
  *                   role-hint="required-roles"
  */
-@Service("environmentCheck#required-roles")
+@Service("environmentCheck#archiva-required-roles")
 public class ArchivaStandardRolesCheck
     implements EnvironmentCheck
 {
     private Logger log = LoggerFactory.getLogger( ArchivaStandardRolesCheck.class );
     
     /**
-     * @plexus.requirement role-hint="cached"
+     * plexus.requirement role-hint="cached"
      */
     @Inject @Named(value = "rBACManager#cached")
     private RBACManager rbacManager;

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/pom.xml?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/pom.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/pom.xml Sat Jun  4 18:01:22 2011
@@ -124,6 +124,11 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-http-lightweight</artifactId>
       <scope>test</scope>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
Sat Jun  4 18:01:22 2011
@@ -22,6 +22,8 @@ package org.apache.maven.archiva.webdav;
 import org.apache.archiva.audit.AuditEvent;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.audit.Auditable;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
@@ -46,6 +48,7 @@ import org.apache.maven.archiva.reposito
 import org.apache.maven.archiva.repository.RepositoryContentFactory;
 import org.apache.maven.archiva.repository.RepositoryException;
 import org.apache.maven.archiva.repository.RepositoryNotFoundException;
+import org.apache.maven.archiva.repository.content.LegacyPathParser;
 import org.apache.maven.archiva.repository.content.RepositoryRequest;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.apache.maven.archiva.repository.metadata.MetadataTools;
@@ -118,7 +121,6 @@ public class ArchivaDavResourceFactory
     /**
      * plexus.requirement
      */
-    @Inject
     private RepositoryRequest repositoryRequest;
 
     /**
@@ -143,7 +145,7 @@ public class ArchivaDavResourceFactory
     /**
      * plexus.requirement
      */
-    @Inject
+    //Inject
     private ArchivaConfiguration archivaConfiguration;
 
     /**
@@ -167,21 +169,21 @@ public class ArchivaDavResourceFactory
     /**
      * plexus.requirement
      */
-    @Inject
+    //Inject
     private ChecksumFile checksum;
 
     /**
      * plexus.requirement role-hint="sha1"
      */
-    @Inject
-    @Named( value = "digester#sha1" )
+    //Inject
+    //Named( value = "digester#sha1" )
     private Digester digestSha1;
 
     /**
      * plexus.requirement role-hint="md5";
      */
-    @Inject
-    @Named( value = "digester#md5" )
+    //Inject
+    //Named( value = "digester#md5" )
     private Digester digestMd5;
 
     /**
@@ -191,16 +193,33 @@ public class ArchivaDavResourceFactory
     @Named( value = "archivaTaskScheduler#repository" )
     private RepositoryArchivaTaskScheduler scheduler;
 
-    @Inject
+    //Inject
     private ApplicationContext applicationContext;
 
-    @PostConstruct
-    public void initialize()
+    @Inject
+    public ArchivaDavResourceFactory( ApplicationContext applicationContext, PlexusSisuBridge
plexusSisuBridge,
+                                      ArchivaConfiguration archivaConfiguration )
+        throws PlexusSisuBridgeException
     {
+        this.archivaConfiguration = archivaConfiguration;
+        this.applicationContext = applicationContext;
+        this.checksum = plexusSisuBridge.lookup( ChecksumFile.class );
+
+        this.digestMd5 = plexusSisuBridge.lookup( Digester.class, "md5" );
+        this.digestSha1 = plexusSisuBridge.lookup( Digester.class, "sha1" );
+
+        repositoryRequest = new RepositoryRequest( new LegacyPathParser( archivaConfiguration
) );
         this.auditListeners =
             new ArrayList<AuditListener>( applicationContext.getBeansOfType( AuditListener.class
).values() );
     }
 
+    @PostConstruct
+    public void initialize()
+    {
+
+
+    }
+
     public DavResource createResource( final DavResourceLocator locator, final DavServletRequest
request,
                                        final DavServletResponse response )
         throws DavException
@@ -224,7 +243,7 @@ public class ArchivaDavResourceFactory
                                         "Write method not allowed for repository groups."
);
             }
 
-            log.debug( "Repository group '" + repoGroupConfig.getId() + "' accessed by '"
+ activePrincipal + "'" );
+            log.debug( "Repository group '{}' accessed by '{}", repoGroupConfig.getId(),
activePrincipal );
 
             // handle browse requests for virtual repos
             if ( RepositoryPathUtil.getLogicalResource( archivaLocator.getOrigResourcePath()
).endsWith( "/" ) )
@@ -259,7 +278,7 @@ public class ArchivaDavResourceFactory
                 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
             }
 
-            log.debug( "Managed repository '" + managedRepository.getId() + "' accessed by
'" + activePrincipal + "'" );
+            log.debug( "Managed repository '{}' accessed by '{}'", managedRepository.getId(),
activePrincipal );
 
             resource = processRepository( request, archivaLocator, activePrincipal, managedRepository
);
 
@@ -563,9 +582,8 @@ public class ArchivaDavResourceFactory
                     destDir.mkdirs();
                     String relPath = PathUtil.getRelative( rootDirectory.getAbsolutePath(),
destDir );
 
-                    log.debug(
-                        "Creating destination directory '" + destDir.getName() + "' (current
user '" + activePrincipal
-                            + "')" );
+                    log.debug( "Creating destination directory '{}' (current user '{}')",
destDir.getName(),
+                               activePrincipal );
 
                     triggerAuditEvent( request.getRemoteAddr(), managedRepository.getId(),
relPath,
                                        AuditEvent.CREATE_DIR, activePrincipal );

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
Sat Jun  4 18:01:22 2011
@@ -19,6 +19,9 @@ package org.apache.archiva.metadata.repo
  * under the License.
  */
 
+import org.springframework.stereotype.Service;
+
+@Service
 public class TestRepositorySessionFactory
     implements RepositorySessionFactory
 {

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
Sat Jun  4 18:01:22 2011
@@ -20,6 +20,8 @@ package org.apache.maven.archiva.webdav;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResourceLocator;
@@ -41,9 +43,11 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.springframework.context.ApplicationContext;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
+import javax.inject.Inject;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -91,6 +95,12 @@ public class ArchivaDavResourceFactoryTe
 
     private RepositoryContentFactory repoFactory;
 
+    @Inject
+    ApplicationContext applicationContext;
+
+    @Inject
+    PlexusSisuBridge plexusSisuBridge;
+
     @Before
     public void setUp()
         throws Exception
@@ -106,14 +116,14 @@ public class ArchivaDavResourceFactoryTe
 
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class
);
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
-        
+
         config = new Configuration();
-        config.addManagedRepository( createManagedRepository( RELEASES_REPO, new File( "target/test-classes/"
+
-                                                                                        
  RELEASES_REPO ).getPath(),
-                                                              "default" ) );
-        config.addManagedRepository( createManagedRepository( INTERNAL_REPO, new File( "target/test-classes/"
+
-                                                                                        
  INTERNAL_REPO ).getPath(),
-                                                              "default" ) );
+        config.addManagedRepository(
+            createManagedRepository( RELEASES_REPO, new File( "target/test-classes/" + RELEASES_REPO
).getPath(),
+                                     "default" ) );
+        config.addManagedRepository(
+            createManagedRepository( INTERNAL_REPO, new File( "target/test-classes/" + INTERNAL_REPO
).getPath(),
+                                     "default" ) );
 
         RepositoryGroupConfiguration repoGroupConfig = new RepositoryGroupConfiguration();
         repoGroupConfig.setId( LOCAL_REPO_GROUP );
@@ -128,7 +138,8 @@ public class ArchivaDavResourceFactoryTe
         repoRequestControl = MockClassControl.createControl( RepositoryRequest.class );
         repoRequest = (RepositoryRequest) repoRequestControl.getMock();
 
-        resourceFactory = new OverridingArchivaDavResourceFactory();
+        resourceFactory =
+            new OverridingArchivaDavResourceFactory( applicationContext, plexusSisuBridge,
archivaConfiguration );
         resourceFactory.setArchivaConfiguration( archivaConfiguration );
         resourceFactory.setRepositoryFactory( repoFactory );
         resourceFactory.setRepositoryRequest( repoRequest );
@@ -166,10 +177,9 @@ public class ArchivaDavResourceFactoryTe
     public void testRepositoryGroupFirstRepositoryRequiresAuthentication()
         throws Exception
     {
-        DavResourceLocator locator =
-            new ArchivaDavResourceLocator( "", "/repository/" + LOCAL_REPO_GROUP +
-                "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
-                                           new ArchivaDavLocatorFactory() );
+        DavResourceLocator locator = new ArchivaDavResourceLocator( "", "/repository/" +
LOCAL_REPO_GROUP
+            + "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
+                                                                    new ArchivaDavLocatorFactory()
);
 
         ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO
);
 
@@ -182,21 +192,18 @@ public class ArchivaDavResourceFactoryTe
             requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080",
2 );
             requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(),
2 );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                false );
+                repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
+                false );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                false );
+                repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
), false );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                null );
+                repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
+                null );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.toNativePath(
-                                                                          "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
-                                                                          internalRepo ),
-                                                new File(
-                                                          config.findManagedRepositoryById(
INTERNAL_REPO ).getLocation(),
-                                                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
+                repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
+                                          internalRepo ),
+                new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
+                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent(
INTERNAL_REPO ),
                                                        internalRepo );
 
@@ -224,10 +231,9 @@ public class ArchivaDavResourceFactoryTe
     public void testRepositoryGroupLastRepositoryRequiresAuthentication()
         throws Exception
     {
-        DavResourceLocator locator =
-            new ArchivaDavResourceLocator( "", "/repository/" + LOCAL_REPO_GROUP +
-                "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
-                                           new ArchivaDavLocatorFactory() );
+        DavResourceLocator locator = new ArchivaDavResourceLocator( "", "/repository/" +
LOCAL_REPO_GROUP
+            + "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
+                                                                    new ArchivaDavLocatorFactory()
);
 
         List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>();
         RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
@@ -252,21 +258,18 @@ public class ArchivaDavResourceFactoryTe
             requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080",
2 );
             requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(),
2 );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                false );
+                repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
+                false );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                false );
+                repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
), false );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                null );
+                repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
+                null );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.toNativePath(
-                                                                          "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
-                                                                          internalRepo ),
-                                                new File(
-                                                          config.findManagedRepositoryById(
INTERNAL_REPO ).getLocation(),
-                                                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
+                repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
+                                          internalRepo ),
+                new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
+                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
 
             archivaConfigurationControl.replay();
             requestControl.replay();
@@ -292,14 +295,13 @@ public class ArchivaDavResourceFactoryTe
     public void testRepositoryGroupArtifactDoesNotExistInAnyOfTheReposAuthenticationDisabled()
         throws Exception
     {
-        DavResourceLocator locator =
-            new ArchivaDavResourceLocator( "", "/repository/" + LOCAL_REPO_GROUP +
-                "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
-                                           new ArchivaDavLocatorFactory() );
-
-        config.addManagedRepository( createManagedRepository( LOCAL_MIRROR_REPO,
-                                                              new File( "target/test-classes/local-mirror"
).getPath(),
-                                                              "default" ) );
+        DavResourceLocator locator = new ArchivaDavResourceLocator( "", "/repository/" +
LOCAL_REPO_GROUP
+            + "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP,
+                                                                    new ArchivaDavLocatorFactory()
);
+
+        config.addManagedRepository(
+            createManagedRepository( LOCAL_MIRROR_REPO, new File( "target/test-classes/local-mirror"
).getPath(),
+                                     "default" ) );
 
         List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>();
         RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
@@ -325,29 +327,24 @@ public class ArchivaDavResourceFactoryTe
             requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080",
4 );
             requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(),
4 );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                false, 2 );
+                repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
), false,
+                2 );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                false, 2 );
+                repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
), false, 2 );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
-                                                null, 2 );
+                repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
),
+                null, 2 );
             repoRequestControl.expectAndReturn(
-                                                repoRequest.toNativePath(
-                                                                          "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
-                                                                          internalRepo ),
-                                                new File(
-                                                          config.findManagedRepositoryById(
INTERNAL_REPO ).getLocation(),
-                                                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
-
-            repoRequestControl.expectAndReturn(
-                                                repoRequest.toNativePath(
-                                                                          "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
-                                                                          localMirrorRepo
),
-                                                new File(
-                                                          config.findManagedRepositoryById(
LOCAL_MIRROR_REPO ).getLocation(),
-                                                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
+                repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
+                                          internalRepo ),
+                new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
+                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
+
+            repoRequestControl.expectAndReturn(
+                repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
+                                          localMirrorRepo ),
+                new File( config.findManagedRepositoryById( LOCAL_MIRROR_REPO ).getLocation(),
+                          "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar"
).getPath() );
 
             archivaConfigurationControl.replay();
             requestControl.replay();
@@ -376,8 +373,8 @@ public class ArchivaDavResourceFactoryTe
     {
         // should fetch metadata 
         DavResourceLocator locator =
-            new ArchivaDavResourceLocator( "", "/repository/" + INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml",
INTERNAL_REPO,
-                                           new ArchivaDavLocatorFactory() );
+            new ArchivaDavResourceLocator( "", "/repository/" + INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml",
+                                           INTERNAL_REPO, new ArchivaDavLocatorFactory()
);
 
         ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO
);
 
@@ -393,8 +390,9 @@ public class ArchivaDavResourceFactoryTe
             requestControl.expectAndReturn( request.getMethod(), "GET", 3 );
             requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080",
3 );
             requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(),
2 );
-            requestControl.expectAndReturn( request.getRequestURI(), "http://localhost:8080/archiva/repository/"
+
-                INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml" );
+            requestControl.expectAndReturn( request.getRequestURI(),
+                                            "http://localhost:8080/archiva/repository/" +
INTERNAL_REPO
+                                                + "/eclipse/jdtcore/maven-metadata.xml" );
             response.addHeader( "Pragma", "no-cache" );
             responseControl.setVoidCallable();
 
@@ -404,7 +402,7 @@ public class ArchivaDavResourceFactoryTe
             long date = 2039842134;
             response.addDateHeader( "last-modified", date );
             responseControl.setVoidCallable();
-            
+
             archivaConfigurationControl.replay();
             repoContentFactoryControl.replay();
             requestControl.replay();
@@ -429,8 +427,8 @@ public class ArchivaDavResourceFactoryTe
     {
         // should not fetch metadata
         DavResourceLocator locator =
-            new ArchivaDavResourceLocator( "", "/repository/" + INTERNAL_REPO + "/eclipse/maven-metadata.xml",
INTERNAL_REPO,
-                                           new ArchivaDavLocatorFactory() );
+            new ArchivaDavResourceLocator( "", "/repository/" + INTERNAL_REPO + "/eclipse/maven-metadata.xml",
+                                           INTERNAL_REPO, new ArchivaDavLocatorFactory()
);
 
         ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO
);
 
@@ -469,12 +467,12 @@ public class ArchivaDavResourceFactoryTe
     public void testRequestMetadataRepoIsLegacy()
         throws Exception
     {
-        config.addManagedRepository( createManagedRepository( LEGACY_REPO, new File( "target/test-classes/"
+
-                                                                                        
LEGACY_REPO ).getPath(),
-                                                              "legacy" ) );
+        config.addManagedRepository(
+            createManagedRepository( LEGACY_REPO, new File( "target/test-classes/" + LEGACY_REPO
).getPath(),
+                                     "legacy" ) );
         DavResourceLocator locator =
-            new ArchivaDavResourceLocator( "", "/repository/" + LEGACY_REPO + "/eclipse/maven-metadata.xml",
LEGACY_REPO,
-                                           new ArchivaDavLocatorFactory() );
+            new ArchivaDavResourceLocator( "", "/repository/" + LEGACY_REPO + "/eclipse/maven-metadata.xml",
+                                           LEGACY_REPO, new ArchivaDavLocatorFactory() );
 
         ManagedRepositoryContent legacyRepo = createManagedRepositoryContent( LEGACY_REPO
);
 
@@ -512,6 +510,14 @@ public class ArchivaDavResourceFactoryTe
     class OverridingArchivaDavResourceFactory
         extends ArchivaDavResourceFactory
     {
+
+        OverridingArchivaDavResourceFactory( ApplicationContext applicationContext, PlexusSisuBridge
plexusSisuBridge,
+                                             ArchivaConfiguration archivaConfiguration )
+            throws PlexusSisuBridgeException
+        {
+            super( applicationContext, plexusSisuBridge, archivaConfiguration );
+        }
+
         protected boolean isAuthorized( DavServletRequest request, String repositoryId )
             throws DavException
         {

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java
Sat Jun  4 18:01:22 2011
@@ -19,18 +19,29 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavServletRequest;
-import org.apache.maven.archiva.webdav.ArchivaDavResourceFactory;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.springframework.context.ApplicationContext;
 
 /**
  * UnauthenticatedDavResourceFactory
- * 
- * @version $Id: 
+ *
+ * @version $Id:
  */
 public class UnauthenticatedDavResourceFactory
     extends ArchivaDavResourceFactory
-{   
+{
+
+    public UnauthenticatedDavResourceFactory( ApplicationContext applicationContext, PlexusSisuBridge
plexusSisuBridge,
+                                              ArchivaConfiguration archivaConfiguration )
+        throws PlexusSisuBridgeException
+    {
+        super( applicationContext, plexusSisuBridge, archivaConfiguration );
+    }
+
     @Override
     protected boolean isAuthorized( DavServletRequest request, String repositoryId )
         throws DavException

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
Sat Jun  4 18:01:22 2011
@@ -27,19 +27,17 @@
   <listener>
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
-
   <context-param>
-    <param-name>contextClass</param-name>
-    <param-value>org.codehaus.plexus.spring.PlexusWebApplicationContext</param-value>
-  </context-param>
-
-   <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>
-        classpath*:/META-INF/plexus/components.xml
-        classpath*:/META-INF/spring-context.xml
-        target/test-classes/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
+        classpath*:/META-INF/spring-context.xml,
+        classpath*:spring-context.xml
     </param-value>
   </context-param>
 
+  <!--
+  classpath*:/META-INF/plexus/components.xml
+  target/test-classes/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
+  -->
+
 </web-app>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml?rev=1131450&r1=1131449&r2=1131450&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
Sat Jun  4 18:01:22 2011
@@ -28,6 +28,18 @@
        default-lazy-init="true">
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.maven.archiva.webdav"/>
+  <context:component-scan base-package="org.apache.maven.archiva.webdav,org.apache.archiva.metadata.repository"/>
+
+  <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
+    <property name="properties">
+      <props>
+        <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
+        <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+        <prop key="org.quartz.threadPool.threadCount">1</prop>
+        <prop key="org.quartz.threadPool.threadPriority">4</prop>
+        <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
+      </props>
+    </property>
+  </bean>
 
 </beans>
\ No newline at end of file



Mime
View raw message