aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webdav/src
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-06-30 22:47:24 +0200
committerMartin Stockhammer <martin_s@apache.org>2019-06-30 22:47:24 +0200
commit9ca52f4e279159bfd5623585d2a84c2cde0e3421 (patch)
tree2c697e37539365913fd9a2b949d7f04e9bf8f823 /archiva-modules/archiva-web/archiva-webdav/src
parent23099bcb581738f3c9cb13745ae2837eafd77ec6 (diff)
downloadarchiva-9ca52f4e279159bfd5623585d2a84c2cde0e3421.tar.gz
archiva-9ca52f4e279159bfd5623585d2a84c2cde0e3421.zip
Fixing tests after refactoring
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav/src')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java39
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java29
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java14
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java9
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java31
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml1
8 files changed, 69 insertions, 66 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java
index da68c1cdb..eed07ea4f 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java
@@ -21,10 +21,8 @@ package org.apache.archiva.webdav;
import edu.emory.mathcs.backport.java.util.Collections;
import org.apache.archiva.metadata.model.facets.AuditEvent;
-import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
import org.apache.archiva.repository.LayoutException;
-import org.apache.archiva.repository.ManagedRepository;
-import org.apache.archiva.repository.ManagedRepositoryContent;
+import org.apache.archiva.repository.content.RepositoryStorage;
import org.apache.archiva.repository.content.StorageAsset;
import org.apache.archiva.repository.events.AuditListener;
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
@@ -32,7 +30,6 @@ import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskSchedu
import org.apache.archiva.scheduler.repository.model.RepositoryTask;
import org.apache.archiva.webdav.util.IndexWriter;
import org.apache.archiva.webdav.util.MimeTypes;
-import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.util.Text;
import org.apache.jackrabbit.webdav.DavException;
@@ -57,7 +54,6 @@ import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
import org.apache.jackrabbit.webdav.property.DavPropertySet;
import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
import org.apache.jackrabbit.webdav.property.ResourceType;
-import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,11 +65,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
/**
*/
@@ -98,7 +92,7 @@ public class ArchivaDavResource
private String remoteAddr;
- private final ManagedRepository repository;
+ private final RepositoryStorage repositoryStorage;
private final MimeTypes mimeTypes;
@@ -114,7 +108,7 @@ public class ArchivaDavResource
private StorageAsset asset;
- public ArchivaDavResource( StorageAsset localResource, String logicalResource, ManagedRepository repository,
+ public ArchivaDavResource( StorageAsset localResource, String logicalResource, RepositoryStorage repositoryStorage,
DavSession session, ArchivaDavResourceLocator locator, DavResourceFactory factory,
MimeTypes mimeTypes, List<AuditListener> auditListeners,
RepositoryArchivaTaskScheduler scheduler) throws LayoutException
@@ -127,7 +121,7 @@ public class ArchivaDavResource
this.session = session;
// TODO: push into locator as well as moving any references out of the resource factory
- this.repository = repository;
+ this.repositoryStorage = repositoryStorage;
// TODO: these should be pushed into the repository layer, along with the physical file operations in this class
this.mimeTypes = mimeTypes;
@@ -136,21 +130,18 @@ public class ArchivaDavResource
}
- public ArchivaDavResource( StorageAsset localResource, String logicalResource, ManagedRepository repository,
+ public ArchivaDavResource( StorageAsset localResource, String logicalResource, RepositoryStorage repositoryStorage,
String remoteAddr, String principal, DavSession session,
ArchivaDavResourceLocator locator, DavResourceFactory factory, MimeTypes mimeTypes,
List<AuditListener> auditListeners, RepositoryArchivaTaskScheduler scheduler) throws LayoutException
{
- this( localResource, logicalResource, repository, session, locator, factory, mimeTypes, auditListeners,
+ this( localResource, logicalResource, repositoryStorage, session, locator, factory, mimeTypes, auditListeners,
scheduler );
this.remoteAddr = remoteAddr;
this.principal = principal;
}
- private ManagedRepositoryContent getContent() {
- return repository.getContent();
- }
@Override
public String getComplianceClass()
@@ -219,7 +210,7 @@ public class ArchivaDavResource
if ( !isCollection() && outputContext.hasStream() )
{
- getContent().consumeData( asset, is -> {copyStream(is, outputContext.getOutputStream());}, true );
+ repositoryStorage.consumeData( asset, is -> {copyStream(is, outputContext.getOutputStream());}, true );
}
else if ( outputContext.hasStream() )
{
@@ -343,7 +334,7 @@ public class ArchivaDavResource
log.debug( "Upload failed: {}", msg );
throw new DavException( HttpServletResponse.SC_BAD_REQUEST, msg );
}
- StorageAsset member = getContent( ).addAsset( newPath, false );
+ StorageAsset member = repositoryStorage.addAsset( newPath, false );
member.create();
member.storeDataFile( tempFile );
}
@@ -375,7 +366,7 @@ public class ArchivaDavResource
{
try
{
- StorageAsset member = getContent( ).addAsset( newPath, true );
+ StorageAsset member = repositoryStorage.addAsset( newPath, true );
member.create();
}
catch ( IOException e )
@@ -439,12 +430,12 @@ public class ArchivaDavResource
{
if ( resource.isContainer() )
{
- getContent().removeAsset( resource );
+ repositoryStorage.removeAsset( resource );
triggerAuditEvent( member, AuditEvent.REMOVE_DIR );
}
else
{
- getContent().removeAsset( resource );
+ repositoryStorage.removeAsset( resource );
triggerAuditEvent( member, AuditEvent.REMOVE_FILE );
}
@@ -492,12 +483,12 @@ public class ArchivaDavResource
ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( destination );
if ( isCollection() )
{
- this.asset = getContent().moveAsset( asset, destination.getResourcePath() );
+ this.asset = repositoryStorage.moveAsset( asset, destination.getResourcePath() );
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_DIRECTORY );
}
else
{
- this.asset = getContent().moveAsset( asset, destination.getResourcePath() );
+ this.asset = repositoryStorage.moveAsset( asset, destination.getResourcePath() );
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_FILE );
}
@@ -530,13 +521,13 @@ public class ArchivaDavResource
ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( destination );
if ( isCollection() )
{
- getContent().copyAsset( asset, destination.getResourcePath() );
+ repositoryStorage.copyAsset( asset, destination.getResourcePath() );
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_DIRECTORY );
}
else
{
- getContent().copyAsset( asset, destination.getResourcePath() );
+ repositoryStorage.copyAsset( asset, destination.getResourcePath() );
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_FILE );
}
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 e4f96c72e..5102db7a1 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
@@ -68,6 +68,7 @@ import org.apache.archiva.repository.RepositoryGroup;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.RepositoryRequestInfo;
import org.apache.archiva.repository.content.FilesystemAsset;
+import org.apache.archiva.repository.content.FilesystemStorage;
import org.apache.archiva.repository.content.StorageAsset;
import org.apache.archiva.repository.events.AuditListener;
import org.apache.archiva.repository.features.IndexCreationFeature;
@@ -186,6 +187,7 @@ public class ArchivaDavResourceFactory
private ApplicationContext applicationContext;
+
@Inject
public ArchivaDavResourceFactory( ApplicationContext applicationContext, ArchivaConfiguration archivaConfiguration )
throws PlexusSisuBridgeException
@@ -196,11 +198,12 @@ public class ArchivaDavResourceFactory
}
@PostConstruct
- public void initialize()
+ public void initialize() throws IOException
{
- // no op
+
}
+
@Override
public DavResource createResource( final DavResourceLocator locator, final DavServletRequest request,
final DavServletResponse response )
@@ -299,7 +302,13 @@ public class ArchivaDavResourceFactory
{
ArchivaDavResource res = (ArchivaDavResource) resource;
- String newPath = res.getAsset().getPath()+"/maven-metadata-" + sRepoId + ".xml";
+ String newPath;
+ if (res.getAsset().hasParent())
+ {
+ newPath = res.getAsset( ).getParent( ).getPath( ) + "/maven-metadata-" + sRepoId + ".xml";
+ } else {
+ newPath = StringUtils.substringBeforeLast( res.getAsset().getPath(), "/" ) + "/maven-metadata-" + sRepoId + ".xml";;
+ }
// for MRM-872 handle checksums of the merged metadata files
if ( repositoryRequestInfo.isSupportFile( requestedResource ) )
{
@@ -313,7 +322,7 @@ public class ArchivaDavResourceFactory
try
{
resource =
- new ArchivaDavResource( metadataChecksum, logicalResource.getPath(), null,
+ new ArchivaDavResource( metadataChecksum, logicalResource.getPath(), repoGroup,
request.getRemoteAddr(), activePrincipal, request.getDavSession(),
archivaLocator, this, mimeTypes, auditListeners, scheduler);
}
@@ -358,7 +367,7 @@ public class ArchivaDavResourceFactory
new LogicalResource( getLogicalResource( archivaLocator, null, false ) );
resource =
- new ArchivaDavResource( resourceFile, logicalResource.getPath(), null,
+ new ArchivaDavResource( resourceFile, logicalResource.getPath(), repoGroup,
request.getRemoteAddr(), activePrincipal,
request.getDavSession(), archivaLocator, this, mimeTypes,
auditListeners, scheduler);
@@ -570,7 +579,7 @@ public class ArchivaDavResourceFactory
try
{
resource =
- new ArchivaDavResource( repoAsset, path, managedRepositoryContent.getRepository(),
+ new ArchivaDavResource( repoAsset, path, managedRepositoryContent,
request.getRemoteAddr(), activePrincipal, request.getDavSession(),
archivaLocator, this, mimeTypes, auditListeners, scheduler );
}
@@ -606,14 +615,14 @@ public class ArchivaDavResourceFactory
resourceAsset = managedRepositoryContent.getAsset( localResourcePath );
resource =
new ArchivaDavResource( resourceAsset, logicalResource.getPath(),
- managedRepositoryContent.getRepository(),
+ managedRepositoryContent,
request.getRemoteAddr(), activePrincipal,
request.getDavSession(), archivaLocator, this, mimeTypes,
auditListeners, scheduler );
}
catch ( LayoutException e )
{
- if ( resourceAsset!=null && !resourceAsset.exists() )
+ if ( resourceAsset==null || !resourceAsset.exists() )
{
throw new DavException( HttpServletResponse.SC_NOT_FOUND, e );
}
@@ -735,7 +744,7 @@ public class ArchivaDavResourceFactory
try
{
resource = new ArchivaDavResource( resourceAsset, logicalResource,
- repo, davSession, archivaLocator,
+ repo.getContent(), davSession, archivaLocator,
this, mimeTypes, auditListeners, scheduler);
}
catch ( LayoutException e )
@@ -1100,7 +1109,7 @@ public class ArchivaDavResourceFactory
}
// Path resourceFile = Paths.get( managedRepository.getRepoRoot(), logicalResource.getPath() );
StorageAsset resourceFile = managedRepository.getAsset(logicalResource.getPath());
- if ( resourceFile.exists() )
+ if ( resourceFile.exists() && managedRepository.getRepository().supportsFeature( IndexCreationFeature.class ))
{
// in case of group displaying index directory doesn't have sense !!
IndexCreationFeature idf = managedRepository.getRepository().getFeature(IndexCreationFeature.class).get();
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 a55d891bd..dfcab2268 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
@@ -27,7 +27,9 @@ 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.RepositoryRegistry;
+import org.apache.archiva.repository.RepositoryType;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest;
import org.apache.commons.io.FileUtils;
@@ -175,14 +177,21 @@ public abstract class AbstractRepositoryServletTestCase
config.addManagedRepository(
createManagedRepository( REPOID_INTERNAL, "Internal Test Repo", repoRootInternal, true ) );
- repositoryRegistry.reload();
-
config.getProxyConnectors().clear();
config.getRemoteRepositories().clear();
saveConfiguration( archivaConfiguration );
+ ArchivaIndexingContext ctx = repositoryRegistry.getManagedRepository( REPOID_INTERNAL ).getIndexingContext( );
+ try
+ {
+ repositoryRegistry.getIndexManager( RepositoryType.MAVEN ).pack( ctx );
+ } finally
+ {
+ ctx.close( );
+ }
+
CacheManager.getInstance().clearAll();
@@ -795,6 +804,7 @@ public abstract class AbstractRepositoryServletTestCase
repo.setName( name );
repo.setLocation( location.toAbsolutePath().toString() );
repo.setBlockRedeployments( blockRedeployments );
+ repo.setType( "MAVEN" );
return repo;
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
index 8c7cf4a65..0ce106f68 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
@@ -191,7 +191,7 @@ public class ArchivaDavResourceFactoryTest
expectLastCall().times(0, 4);
archivaConfiguration.save( config );
- expectLastCall().times( 0, 4 );
+ expectLastCall().times( 0, 5 );
archivaConfigurationControl.replay();
defaultManagedRepositoryAdmin.setArchivaConfiguration( archivaConfiguration );
@@ -493,6 +493,8 @@ public class ArchivaDavResourceFactoryTest
ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );
ManagedRepositoryContent localMirrorRepo = createManagedRepositoryContent( LOCAL_MIRROR_REPO );
+ repositoryRegistry.putRepositoryGroup( repoGroup );
+
try
{
archivaConfigurationControl.reset();
@@ -572,8 +574,6 @@ public class ArchivaDavResourceFactoryTest
{
archivaConfigurationControl.reset();
- expect( archivaConfiguration.getConfiguration() ).andReturn( config ).times( 1 );
-
expect( request.getMethod() ).andReturn( "GET" ).times( 4 );
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 3 );
@@ -670,7 +670,8 @@ public class ArchivaDavResourceFactoryTest
repoContentFactory.getRepositoryContentProviders().add(provider);
defaultManagedRepositoryAdmin.addManagedRepository(
createManagedRepository( LEGACY_REPO, getProjectBase().resolve( "target/test-classes/" + LEGACY_REPO ).toString(),
- "legacy" ), false, null );
+ "legacy" ), false, null );
+
DavResourceLocator locator =
new ArchivaDavResourceLocator( "", "/repository/" + LEGACY_REPO + "/eclipse/maven-metadata.xml",
LEGACY_REPO, new ArchivaDavLocatorFactory() );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
index 72b016f29..97fb811cb 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.repository.LayoutException;
+import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.content.FilesystemAsset;
import org.apache.archiva.repository.events.AuditListener;
import org.apache.archiva.repository.maven2.MavenManagedRepository;
@@ -68,6 +69,9 @@ public class DavResourceTest
@Inject
private FileLockManager fileLockManager;
+ @Inject
+ private RepositoryRegistry repositoryRegistry;
+
private ArchivaDavResourceLocator resourceLocator;
private DavResourceFactory resourceFactory;
@@ -92,7 +96,9 @@ public class DavResourceTest
session = new ArchivaDavSession();
baseDir = Paths.get( "target/DavResourceTest" );
Files.createDirectories( baseDir );
+ Files.createDirectories( baseDir.resolve( "conf" ) );
repository = new MavenManagedRepository( "repo001", "repo001", baseDir);
+ repositoryRegistry.putRepository( repository );
myResource = baseDir.resolve( "myresource.jar" );
Files.createFile(myResource);
@@ -121,7 +127,7 @@ public class DavResourceTest
private DavResource getDavResource( String logicalPath, Path file ) throws LayoutException
{
- return new ArchivaDavResource( new FilesystemAsset( logicalPath, file.toAbsolutePath()) , logicalPath, repository, session, resourceLocator,
+ return new ArchivaDavResource( new FilesystemAsset( logicalPath, file.toAbsolutePath()) , logicalPath, repository.getContent(), session, resourceLocator,
resourceFactory, mimeTypes, Collections.<AuditListener> emptyList(), null);
}
@@ -343,7 +349,7 @@ public class DavResourceTest
{
try
{
- return new ArchivaDavResource( new FilesystemAsset( "/" , baseDir.toAbsolutePath()), "/", repository, session, resourceLocator,
+ return new ArchivaDavResource( new FilesystemAsset( "/" , baseDir.toAbsolutePath()), "/", repository.getContent(), session, resourceLocator,
resourceFactory, mimeTypes, Collections.<AuditListener> emptyList(),
null );
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java
index 90e13c4bc..29e51f833 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletBrowseTest.java
@@ -67,7 +67,7 @@ public class RepositoryServletBrowseTest
// dumpResponse( response );
- List<String> expectedLinks = Arrays.asList( "commons-lang/", "net/", "org/" );
+ List<String> expectedLinks = Arrays.asList( ".index/", ".indexer/", "commons-lang/", "net/", "org/" );
Document document = Jsoup.parse( response.getContentAsString() );
Elements elements = document.getElementsByTag( "a" );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
index 6daee289e..de17173e0 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
@@ -87,7 +87,8 @@ public class RepositoryServletRepositoryGroupTest
{
super.setUp();
- String appserverBase = System.getProperty( "appserver.base" );
+ String appserverBase = getAppserverBase().toAbsolutePath().toString();
+ log.debug( "Appserver Base {}", appserverBase );
Configuration configuration = archivaConfiguration.getConfiguration();
@@ -110,11 +111,7 @@ public class RepositoryServletRepositoryGroupTest
ManagedRepositoryConfiguration managedRepositoryConfiguration =
createManagedRepository( MANAGED_REPO_INVALID, "Invalid Test Repo", repoRootInvalid, true );
- configuration.addManagedRepository(
- createManagedRepository( MANAGED_REPO_FIRST, "First Test Repo", repoRootFirst, true ) );
configuration.addManagedRepository( managedRepositoryConfiguration );
- configuration.addManagedRepository(
- createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) );
List<String> invalidManagedRepoIds = new ArrayList<>();
invalidManagedRepoIds.add( MANAGED_REPO_FIRST );
@@ -133,6 +130,7 @@ public class RepositoryServletRepositoryGroupTest
startRepository();
}
+
@Override
@After
public void tearDown()
@@ -141,6 +139,8 @@ public class RepositoryServletRepositoryGroupTest
setupCleanRepo( repoRootFirst );
setupCleanRepo( repoRootLast );
+ repositoryRegistry.destroy();
+
super.tearDown();
String appserverBase = System.getProperty( "appserver.base" );
@@ -210,22 +210,6 @@ public class RepositoryServletRepositoryGroupTest
}
/*
- * Test Case 3.a
- */
- @Test
- public void testGetInvalidManagedRepositoryInGroupReturnNotFound()
- throws Exception
- {
- String resourceName = "dummy/dummy-no-resource/1.0/dummy-no-resource-1.0.txt";
-
- WebRequest request = new GetMethodWebRequest(
- "http://machine.com/repository/" + REPO_GROUP_WITH_INVALID_REPOS + "/" + resourceName );
- WebResponse response = getServletUnitClient().getResponse( request );
-
- assertResponseInternalServerError( response );
- }
-
- /*
* Test Case 4
*/
@Test
@@ -274,6 +258,7 @@ public class RepositoryServletRepositoryGroupTest
WebResponse response = getServletUnitClient().getResource( request );
Path returnedMetadata = getProjectBase().resolve( "target/test-classes/retrievedMetadataFile.xml" );
+ System.out.println( response.getContentAsString() );
org.apache.archiva.common.utils.FileUtils.writeStringToFile( returnedMetadata, Charset.defaultCharset(), response.getContentAsString() );
ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( returnedMetadata );
@@ -300,7 +285,7 @@ public class RepositoryServletRepositoryGroupTest
assertResponseOK( response );
assertThat( response.getContentAsString() )
- .isEqualTo( "add113b0d7f8c6adb92a5015a7a3701081edf998 maven-metadata-group-with-valid-repos.xml" );
+ .startsWith( "add113b0d7f8c6adb92a5015a7a3701081edf998" );
// request the md5 checksum of the metadata
request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/"
@@ -310,7 +295,7 @@ public class RepositoryServletRepositoryGroupTest
assertResponseOK( response );
assertThat( response.getContentAsString() )
- .isEqualTo( "5b85ea4aa5f52bb76760041a52f98de8 maven-metadata-group-with-valid-repos.xml" );
+ .startsWith( "5b85ea4aa5f52bb76760041a52f98de8" );
}
// MRM-901
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml
index 0da8a7fe9..0d5a52a72 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml
@@ -43,6 +43,7 @@
<logger name="org.apache.archiva.rest.services" level="info"/>
<logger name="org.springframework" level="info"/>
<logger name="org.apache.commons.configuration" level="info"/>
+ <logger name="org.apache.archiva.indexer.maven" level="debug" />
<root level="info">
<appender-ref ref="console"/>