aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java139
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java11
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataLocalOnlyTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataRemoteOnlyTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPassthroughTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPluginSnapshotPolicyTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedReleasePolicyTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedSnapshotPolicyTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedRepositoryServlet.java20
13 files changed, 112 insertions, 85 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java
index a69d2ba02..705a10d16 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java
+++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java
@@ -682,6 +682,9 @@ public class MavenIndexManager implements ArchivaIndexManager {
{
try
{
+ if (!Files.exists(indexDirectory.getFilePath())) {
+ Files.createDirectories(indexDirectory.getFilePath());
+ }
return indexer.createIndexingContext( contextKey, repository.getId( ), repoDir.toFile( ), indexDirectory.getFilePath( ).toFile( ),
repository.getLocation( ) == null ? null : repository.getLocation( ).toString( ),
indexUrl,
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
index 5102db7a1..e8602caaa 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
@@ -611,8 +611,8 @@ public class ArchivaDavResourceFactory
{
// Perform an adjustment of the resource to the managed
// repository expected path.
- String localResourcePath = managedRepository.getRequestInfo().toNativePath( logicalResource.getPath() );
- resourceAsset = managedRepositoryContent.getAsset( localResourcePath );
+ // String localResourcePath = managedRepository.getRequestInfo().toNativePath( logicalResource.getPath() );
+ resourceAsset = managedRepositoryContent.getAsset( logicalResource.getPath() );
resource =
new ArchivaDavResource( resourceAsset, logicalResource.getPath(),
managedRepositoryContent,
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java
index 1b6e64d62..5ca41715f 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java
@@ -20,12 +20,12 @@ package org.apache.archiva.webdav;
*/
import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ConfigurationEvent;
import org.apache.archiva.configuration.ConfigurationListener;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.security.ServletAuthenticator;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavLocatorFactory;
@@ -53,7 +53,10 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.stream.Collectors;
/**
* RepositoryServlet
@@ -66,7 +69,7 @@ public class RepositoryServlet
private ArchivaConfiguration configuration;
- private ManagedRepositoryAdmin managedRepositoryAdmin;
+ RepositoryRegistry repositoryRegistry;
private Map<String, ManagedRepository> repositoryMap;
@@ -76,22 +79,14 @@ public class RepositoryServlet
private DavSessionProvider sessionProvider;
- private final Object reloadLock = new Object();
+ protected final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
@Override
public void init( ServletConfig servletConfig )
throws ServletException
{
super.init( servletConfig );
- try
- {
- initServers( servletConfig );
- }
- catch ( RepositoryAdminException e )
- {
- log.error( e.getMessage(), e );
- throw new ServletException( e.getMessage(), e );
- }
+ initServers( servletConfig );
}
/**
@@ -170,53 +165,62 @@ public class RepositoryServlet
}
}
- public synchronized void initServers( ServletConfig servletConfig )
- throws RepositoryAdminException
- {
+ public void initServers( ServletConfig servletConfig ) {
long start = System.currentTimeMillis();
WebApplicationContext wac =
WebApplicationContextUtils.getRequiredWebApplicationContext( servletConfig.getServletContext() );
- configuration = wac.getBean( "archivaConfiguration#default", ArchivaConfiguration.class );
- configuration.addListener( this );
+ rwLock.writeLock().lock();
+ try {
+ configuration = wac.getBean("archivaConfiguration#default", ArchivaConfiguration.class);
+ configuration.addListener(this);
- managedRepositoryAdmin = wac.getBean( ManagedRepositoryAdmin.class );
+ repositoryRegistry = wac.getBean(RepositoryRegistry.class);
+ repositoryMap = new LinkedHashMap<>();
- repositoryMap = managedRepositoryAdmin.getManagedRepositoriesAsMap();
+ fillRepositoryMap();
- for ( ManagedRepository repo : repositoryMap.values() )
- {
- Path repoDir = Paths.get( repo.getLocation() );
+ for (ManagedRepository repo : repositoryMap.values()) {
+ Path repoDir = Paths.get(repo.getLocation());
- if ( !Files.exists(repoDir) )
- {
- try
- {
- Files.createDirectories( repoDir );
- }
- catch ( IOException e )
- {
- log.info( "Unable to create missing directory for {}", repo.getLocation() );
- continue;
+ if (!Files.exists(repoDir)) {
+ try {
+ Files.createDirectories(repoDir);
+ } catch (IOException e) {
+ log.info("Unable to create missing directory for {}", repo.getLocation());
+ continue;
+ }
}
}
- }
-
- resourceFactory = wac.getBean( "davResourceFactory#archiva", DavResourceFactory.class );
- locatorFactory = new ArchivaDavLocatorFactory();
- ServletAuthenticator servletAuth = wac.getBean( ServletAuthenticator.class );
- HttpAuthenticator httpAuth = wac.getBean( "httpAuthenticator#basic", HttpAuthenticator.class );
+ resourceFactory = wac.getBean("davResourceFactory#archiva", DavResourceFactory.class);
+ locatorFactory = new ArchivaDavLocatorFactory();
- sessionProvider = new ArchivaDavSessionProvider( servletAuth, httpAuth );
+ ServletAuthenticator servletAuth = wac.getBean(ServletAuthenticator.class);
+ HttpAuthenticator httpAuth = wac.getBean("httpAuthenticator#basic", HttpAuthenticator.class);
+ sessionProvider = new ArchivaDavSessionProvider(servletAuth, httpAuth);
+ } finally {
+ rwLock.writeLock().unlock();
+ }
long end = System.currentTimeMillis();
log.debug( "initServers done in {} ms", (end - start) );
}
+ private void fillRepositoryMap() {
+ final Map<String, ManagedRepository> repos = repositoryRegistry.getManagedRepositories().stream().collect(Collectors.toMap(r -> r.getId(), r -> r));
+ rwLock.writeLock().lock();
+ try {
+ repositoryMap.clear();
+ repositoryMap.putAll(repos);
+ } finally {
+ rwLock.writeLock().unlock();
+ }
+ }
+
@Override
public void configurationEvent( ConfigurationEvent event )
{
@@ -237,26 +241,23 @@ public class RepositoryServlet
private void initRepositories()
throws RepositoryAdminException
{
- synchronized ( repositoryMap )
- {
- repositoryMap.clear();
- repositoryMap.putAll( managedRepositoryAdmin.getManagedRepositoriesAsMap() );
- }
-
- synchronized ( reloadLock )
- {
initServers( getServletConfig() );
- }
}
- public synchronized ManagedRepository getRepository( String prefix )
+ public ManagedRepository getRepository( String prefix )
throws RepositoryAdminException
{
- if ( repositoryMap.isEmpty() )
- {
- repositoryMap.putAll( managedRepositoryAdmin.getManagedRepositoriesAsMap() );
+ rwLock.readLock().lock();
+ try {
+ if (repositoryMap.isEmpty()) {
+ rwLock.readLock().unlock();
+ fillRepositoryMap();
+ rwLock.readLock().lock();
+ }
+ return repositoryMap.get(prefix);
+ } finally {
+ rwLock.readLock().unlock();
}
- return repositoryMap.get( prefix );
}
ArchivaConfiguration getConfiguration()
@@ -322,21 +323,25 @@ public class RepositoryServlet
@Override
public void destroy()
{
- configuration.removeListener( this );
-
- resourceFactory = null;
- configuration = null;
- locatorFactory = null;
- sessionProvider = null;
- repositoryMap.clear();
- repositoryMap = null;
+ rwLock.writeLock().lock();
+ try {
+ configuration.removeListener(this);
+
+ resourceFactory = null;
+ configuration = null;
+ locatorFactory = null;
+ sessionProvider = null;
+ repositoryMap.clear();
+ repositoryMap = null;
- WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext( getServletContext() );
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
- if ( wac instanceof ConfigurableApplicationContext )
- {
- ( (ConfigurableApplicationContext) wac ).close();
+ if (wac instanceof ConfigurableApplicationContext) {
+ ((ConfigurableApplicationContext) wac).close();
+ }
+ super.destroy();
+ } finally {
+ rwLock.writeLock().unlock();
}
- super.destroy();
}
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
index dfcab2268..536d9df64 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
@@ -22,12 +22,12 @@ package org.apache.archiva.webdav;
import com.gargoylesoftware.htmlunit.*;
import junit.framework.TestCase;
import net.sf.ehcache.CacheManager;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.indexer.ArchivaIndexingContext;
+import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.RepositoryType;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
@@ -144,8 +144,10 @@ public abstract class AbstractRepositoryServletTestCase
protected void saveConfiguration()
throws Exception
{
- saveConfiguration( archivaConfiguration );
+ repositoryRegistry.setArchivaConfiguration(archivaConfiguration);
repositoryRegistry.reload();
+ saveConfiguration( archivaConfiguration );
+
}
@Before
@@ -159,6 +161,8 @@ public abstract class AbstractRepositoryServletTestCase
System.setProperty( "appserver.base", getAppserverBase().toAbsolutePath().toString());
log.info("setUp appserverBase={}, projectBase={}, workingDir={}", getAppserverBase(), getProjectBase(), Paths.get("").toString());
+ repositoryRegistry.getRepositories().stream().forEach(r -> r.close());
+
org.apache.archiva.common.utils.FileUtils.deleteDirectory( getAppserverBase() );
Path testConf = getProjectBase().resolve( "src/test/resources/repository-archiva.xml" );
@@ -717,6 +721,7 @@ public abstract class AbstractRepositoryServletTestCase
public void tearDown()
throws Exception
{
+ repositoryRegistry.getRepositories().stream().forEach(r -> r.close());
if ( Files.exists(repoRootInternal) )
{
@@ -829,8 +834,10 @@ public abstract class AbstractRepositoryServletTestCase
protected void saveConfiguration( ArchivaConfiguration archivaConfiguration )
throws Exception
{
+ repositoryRegistry.setArchivaConfiguration(archivaConfiguration);
repositoryRegistry.reload();
archivaConfiguration.save( archivaConfiguration.getConfiguration() );
+
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataLocalOnlyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataLocalOnlyTest.java
index 9b0654b7c..18b9d4d7e 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataLocalOnlyTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataLocalOnlyTest.java
@@ -55,6 +55,7 @@ public class RepositoryServletProxiedMetadataLocalOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/maven-metadata.xml";
String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
@@ -80,6 +81,7 @@ public class RepositoryServletProxiedMetadataLocalOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-2/maven-metadata.xml";
String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
@@ -102,6 +104,7 @@ public class RepositoryServletProxiedMetadataLocalOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/archivatest-maven-plugin/maven-metadata.xml";
String version = "1.0-alpha-4";
@@ -126,6 +129,7 @@ public class RepositoryServletProxiedMetadataLocalOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/maven-metadata.xml";
String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataRemoteOnlyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataRemoteOnlyTest.java
index dd5da4535..1c6864c69 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataRemoteOnlyTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedMetadataRemoteOnlyTest.java
@@ -57,6 +57,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/maven-metadata.xml";
String version = "4.0-alpha-1-SNAPSHOT";
@@ -88,6 +89,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-2-SNAPSHOT/maven-metadata.xml";
String version = "2.2-beta-2-SNAPSHOT";
@@ -119,6 +121,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-2/maven-metadata.xml";
String expectedMetadata =
@@ -145,6 +148,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/archivatest-maven-plugin/maven-metadata.xml";
String latest = "1.0-alpha-4";
@@ -174,6 +178,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
setupSnapshotsRemoteRepo();
setupPrivateSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String path = "org/apache/archiva/maven-metadata.xml";
String expectedMetadata =
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPassthroughTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPassthroughTest.java
index e6ed57bbb..5a8d97ef8 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPassthroughTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPassthroughTest.java
@@ -136,6 +136,7 @@ public class RepositoryServletProxiedPassthroughTest
// --- Setup
setupCentralRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String expectedRemoteContents = contents;
String expectedManagedContents = null;
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPluginSnapshotPolicyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPluginSnapshotPolicyTest.java
index d475fa3b0..fd7f18c34 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPluginSnapshotPolicyTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedPluginSnapshotPolicyTest.java
@@ -167,6 +167,7 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
// --- Setup
setupSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String resourcePath = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/archivatest-maven-plugin-4.0-alpha-1-20070822.033400-42.jar";
String expectedRemoteContents = "archivatest-maven-plugin-4.0-alpha-1-20070822.033400-42|jar-remote-contents";
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedReleasePolicyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedReleasePolicyTest.java
index c14b6c2ed..87fd62ad3 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedReleasePolicyTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedReleasePolicyTest.java
@@ -163,6 +163,7 @@ public class RepositoryServletProxiedReleasePolicyTest
// --- Setup
setupCentralRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String resourcePath = "org/apache/archiva/test/1.0/test-1.0.jar";
String expectedRemoteContents = "archiva-test-1.0|jar-remote-contents";
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedSnapshotPolicyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedSnapshotPolicyTest.java
index e35b17600..9388c453b 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedSnapshotPolicyTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedSnapshotPolicyTest.java
@@ -189,6 +189,7 @@ public class RepositoryServletProxiedSnapshotPolicyTest
// --- Setup
setupSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String resourcePath = "org/apache/archiva/test/2.0-SNAPSHOT/test-2.0-SNAPSHOT.jar";
String expectedRemoteContents = "archiva-test-2.0-SNAPSHOT|jar-remote-contents";
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java
index fea53db89..202b34fed 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java
@@ -185,6 +185,7 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
// --- Setup
setupSnapshotsRemoteRepo();
setupCleanInternalRepo();
+ saveConfiguration();
String resourcePath = "org/apache/archiva/test/3.0-SNAPSHOT/test-3.0-20070822.033400-42.jar";
String expectedRemoteContents = "archiva-test-3.0-20070822.033400-42|jar-remote-contents";
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java
index b88e75e29..024d3876a 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletTest.java
@@ -21,10 +21,10 @@ package org.apache.archiva.webdav;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.repository.ManagedRepository;
import org.junit.Before;
import org.junit.Test;
@@ -80,7 +80,7 @@ public class RepositoryServletTest
c.removeManagedRepository( c.findManagedRepositoryById( REPOID_INTERNAL ) );
saveConfiguration( archivaConfiguration );
- ManagedRepository repository = servlet.getRepository( REPOID_INTERNAL );
+ org.apache.archiva.repository.ManagedRepository repository = servlet.getRepository( REPOID_INTERNAL );
assertNull( repository );
}
@@ -137,6 +137,6 @@ public class RepositoryServletTest
WebResponse response = getServletUnitClient().getResponse( request );
assertResponseNotFound( response );
assertThat( response.getContentAsString() ) //
- .contains( "Legacy Maven1 repository not supported anymore." );
+ .contains( "Resource does not exist" );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedRepositoryServlet.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedRepositoryServlet.java
index 6ac977f6c..43cf11706 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedRepositoryServlet.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedRepositoryServlet.java
@@ -37,19 +37,17 @@ public class UnauthenticatedRepositoryServlet
extends RepositoryServlet
{
@Override
- public synchronized void initServers( ServletConfig servletConfig )
+ public void initServers( ServletConfig servletConfig )
{
- try
- {
- super.initServers( servletConfig );
- }
- catch ( RepositoryAdminException e )
- {
- throw new RuntimeException( e.getMessage(), e );
- }
+ rwLock.writeLock().lock();
+ try {
+ super.initServers(servletConfig);
- UnauthenticatedDavSessionProvider sessionProvider = new UnauthenticatedDavSessionProvider();
- setDavSessionProvider( sessionProvider );
+ UnauthenticatedDavSessionProvider sessionProvider = new UnauthenticatedDavSessionProvider();
+ setDavSessionProvider(sessionProvider);
+ } finally {
+ rwLock.writeLock().unlock();
+ }
}
@Override