aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/pom.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java48
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java160
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java19
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml16
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml14
8 files changed, 162 insertions, 109 deletions
diff --git a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java
index 724ef5522..955455279 100644
--- a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java
+++ b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaStandardRolesCheck.java
@@ -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;
diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml
index 0fe5f7858..6d72c2708 100644
--- a/archiva-modules/archiva-web/archiva-webdav/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml
@@ -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>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
index 4e0d9d03d..0884c649e 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
@@ -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.repository.ManagedRepositoryContent;
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 );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
index 2082e724a..224f7ec23 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
@@ -19,6 +19,9 @@ package org.apache.archiva.metadata.repository;
* under the License.
*/
+import org.springframework.stereotype.Service;
+
+@Service
public class TestRepositorySessionFactory
implements RepositorySessionFactory
{
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
index 84713cb73..b4a355ac9 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
@@ -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 ArchivaDavResourceFactoryTest
private RepositoryContentFactory repoFactory;
+ @Inject
+ ApplicationContext applicationContext;
+
+ @Inject
+ PlexusSisuBridge plexusSisuBridge;
+
@Before
public void setUp()
throws Exception
@@ -106,14 +116,14 @@ public class ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
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() );
+ 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" ) );
+ 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 ArchivaDavResourceFactoryTest
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() );
+ 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",
+ 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 ArchivaDavResourceFactoryTest
{
// 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 ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
long date = 2039842134;
response.addDateHeader( "last-modified", date );
responseControl.setVoidCallable();
-
+
archivaConfigurationControl.replay();
repoContentFactoryControl.replay();
requestControl.replay();
@@ -429,8 +427,8 @@ public class ArchivaDavResourceFactoryTest
{
// 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 ArchivaDavResourceFactoryTest
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 ArchivaDavResourceFactoryTest
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
{
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java
index 82065452e..f6e8a6e44 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/UnauthenticatedDavResourceFactory.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
index cfe7c5fbe..1175e70c7 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
@@ -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>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
index 98f491671..6742098a0 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
@@ -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