From cc81e0172276af7046d6da7cf75a605ad4d49766 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sat, 4 Feb 2012 22:14:00 +0000 Subject: [PATCH] [MRM-1599] NTLM proxy no longer works change for metadata resolver too using ntlm proxy take the opportunity to use repo admin api rather than archivaconfiguration directly/ git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1240625 13f79535-47bb-0310-9956-ffa450edef68 --- .../ArchivaMetadataCreationConsumer.java | 29 +- .../archiva-web/archiva-webapp/pom.xml | 5 + .../repository/DefaultMetadataResolver.java | 303 +++++++++------- .../repository/storage/RepositoryStorage.java | 15 +- .../RepositoryStorageRuntimeException.java | 38 ++ .../plugins/maven2-repository/pom.xml | 20 ++ .../maven2/Maven2RepositoryStorage.java | 330 +++++++++--------- .../archiva/configuration/MockRepoAdmin.java | 283 +++++++++++++++ .../Maven2RepositoryMetadataResolverTest.java | 197 +++++------ pom.xml | 1 - 10 files changed, 810 insertions(+), 411 deletions(-) create mode 100644 archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorageRuntimeException.java create mode 100644 archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/configuration/MockRepoAdmin.java diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java index 42cf70c75..a2157eb3a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java @@ -37,6 +37,7 @@ import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.metadata.repository.storage.RepositoryStorage; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; +import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; import org.codehaus.plexus.registry.Registry; import org.codehaus.plexus.registry.RegistryListener; import org.slf4j.Logger; @@ -145,21 +146,22 @@ public class ArchivaMetadataCreationConsumer public void processFile( String path ) throws ConsumerException { - // note that we do minimal processing including checksums and POM information for performance of - // the initial scan. Any request for this information will be intercepted and populated on-demand - // or picked up by subsequent scans - - ArtifactMetadata artifact = repositoryStorage.readArtifactMetadataFromPath( repoId, path ); - - ProjectMetadata project = new ProjectMetadata(); - project.setNamespace( artifact.getNamespace() ); - project.setId( artifact.getProject() ); - - String projectVersion = VersionUtil.getBaseVersion( artifact.getVersion() ); RepositorySession repositorySession = repositorySessionFactory.createSession(); try { + // note that we do minimal processing including checksums and POM information for performance of + // the initial scan. Any request for this information will be intercepted and populated on-demand + // or picked up by subsequent scans + + ArtifactMetadata artifact = repositoryStorage.readArtifactMetadataFromPath( repoId, path ); + + ProjectMetadata project = new ProjectMetadata(); + project.setNamespace( artifact.getNamespace() ); + project.setId( artifact.getProject() ); + + String projectVersion = VersionUtil.getBaseVersion( artifact.getVersion() ); + MetadataRepository metadataRepository = repositorySession.getRepository(); boolean createVersionMetadata = false; @@ -203,6 +205,11 @@ public class ArchivaMetadataCreationConsumer log.warn( "Error occurred persisting metadata for artifact: " + path + "; message: " + e.getMessage(), e ); repositorySession.revert(); } + catch ( RepositoryStorageRuntimeException e ) + { + log.warn( "Error occurred persisting metadata for artifact: " + path + "; message: " + e.getMessage(), e ); + repositorySession.revert(); + } finally { repositorySession.close(); diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 907901309..3f3fdd2ff 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -599,6 +599,11 @@ wagon-http runtime + + org.apache.maven.wagon + wagon-http-lightweight + runtime + org.apache.maven.wagon wagon-file diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java index f56d72c16..0d99110a3 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java @@ -19,7 +19,6 @@ package org.apache.archiva.metadata.repository; * under the License. */ -import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.ProjectMetadata; import org.apache.archiva.metadata.model.ProjectVersionMetadata; @@ -28,6 +27,7 @@ import org.apache.archiva.metadata.repository.filter.ExcludesFilter; import org.apache.archiva.metadata.repository.storage.RepositoryStorage; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; +import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; import org.apache.archiva.repository.events.RepositoryListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -135,22 +135,23 @@ public class DefaultMetadataResolver } throw new MetadataResolutionException( e.getMessage(), e ); } - catch ( RepositoryAdminException e ) + catch ( RepositoryStorageMetadataNotFoundException e ) { for ( RepositoryListener listener : listeners ) { listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e ); } - throw new MetadataResolutionException( e.getMessage(), e ); + // no need to rethrow - return null } - catch ( RepositoryStorageMetadataNotFoundException e ) + catch ( RepositoryStorageRuntimeException e ) { for ( RepositoryListener listener : listeners ) { listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e ); } - // no need to rethrow - return null + throw new MetadataResolutionException( e.getMessage(), e ); } + } return metadata; } @@ -169,198 +170,234 @@ public class DefaultMetadataResolver public Collection resolveRootNamespaces( RepositorySession session, String repoId ) throws MetadataResolutionException { - MetadataRepository metadataRepository = session.getRepository(); - Collection namespaces = metadataRepository.getRootNamespaces( repoId ); - Collection storageNamespaces = - repositoryStorage.listRootNamespaces( repoId, new ExcludesFilter( namespaces ) ); - if ( storageNamespaces != null && !storageNamespaces.isEmpty() ) + try { - if ( log.isDebugEnabled() ) - { - log.debug( "Resolved root namespaces from storage: " + storageNamespaces ); - } - for ( String n : storageNamespaces ) + MetadataRepository metadataRepository = session.getRepository(); + Collection namespaces = metadataRepository.getRootNamespaces( repoId ); + Collection storageNamespaces = + repositoryStorage.listRootNamespaces( repoId, new ExcludesFilter( namespaces ) ); + if ( storageNamespaces != null && !storageNamespaces.isEmpty() ) { - try + if ( log.isDebugEnabled() ) { - metadataRepository.updateNamespace( repoId, n ); + log.debug( "Resolved root namespaces from storage: " + storageNamespaces ); } - catch ( MetadataRepositoryException e ) + for ( String n : storageNamespaces ) { - log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + try + { + metadataRepository.updateNamespace( repoId, n ); + } + catch ( MetadataRepositoryException e ) + { + log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + } } - } - session.markDirty(); + session.markDirty(); - namespaces = new ArrayList( namespaces ); - namespaces.addAll( storageNamespaces ); + namespaces = new ArrayList( namespaces ); + namespaces.addAll( storageNamespaces ); + } + return namespaces; + } + catch ( RepositoryStorageRuntimeException e ) + { + throw new MetadataResolutionException( e.getMessage(), e ); } - return namespaces; } public Collection resolveNamespaces( RepositorySession session, String repoId, String namespace ) throws MetadataResolutionException { - MetadataRepository metadataRepository = session.getRepository(); - Collection namespaces = metadataRepository.getNamespaces( repoId, namespace ); - Collection exclusions = new ArrayList( namespaces ); - exclusions.addAll( metadataRepository.getProjects( repoId, namespace ) ); - Collection storageNamespaces = - repositoryStorage.listNamespaces( repoId, namespace, new ExcludesFilter( exclusions ) ); - if ( storageNamespaces != null && !storageNamespaces.isEmpty() ) + try { - if ( log.isDebugEnabled() ) - { - log.debug( "Resolved namespaces from storage: " + storageNamespaces ); - } - for ( String n : storageNamespaces ) + MetadataRepository metadataRepository = session.getRepository(); + Collection namespaces = metadataRepository.getNamespaces( repoId, namespace ); + Collection exclusions = new ArrayList( namespaces ); + exclusions.addAll( metadataRepository.getProjects( repoId, namespace ) ); + Collection storageNamespaces = + repositoryStorage.listNamespaces( repoId, namespace, new ExcludesFilter( exclusions ) ); + if ( storageNamespaces != null && !storageNamespaces.isEmpty() ) { - try - { - metadataRepository.updateNamespace( repoId, namespace + "." + n ); - } - catch ( MetadataRepositoryException e ) + + log.debug( "Resolved namespaces from storage: {}", storageNamespaces ); + for ( String n : storageNamespaces ) { - log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + try + { + metadataRepository.updateNamespace( repoId, namespace + "." + n ); + } + catch ( MetadataRepositoryException e ) + { + log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + } } - } - session.markDirty(); + session.markDirty(); - namespaces = new ArrayList( namespaces ); - namespaces.addAll( storageNamespaces ); + namespaces = new ArrayList( namespaces ); + namespaces.addAll( storageNamespaces ); + } + return namespaces; + } + catch ( RepositoryStorageRuntimeException e ) + { + throw new MetadataResolutionException( e.getMessage(), e ); } - return namespaces; } public Collection resolveProjects( RepositorySession session, String repoId, String namespace ) throws MetadataResolutionException { - MetadataRepository metadataRepository = session.getRepository(); - Collection projects = metadataRepository.getProjects( repoId, namespace ); - Collection exclusions = new ArrayList( projects ); - exclusions.addAll( metadataRepository.getNamespaces( repoId, namespace ) ); - Collection storageProjects = - repositoryStorage.listProjects( repoId, namespace, new ExcludesFilter( exclusions ) ); - if ( storageProjects != null && !storageProjects.isEmpty() ) + try { - if ( log.isDebugEnabled() ) - { - log.debug( "Resolved projects from storage: " + storageProjects ); - } - for ( String projectId : storageProjects ) + MetadataRepository metadataRepository = session.getRepository(); + Collection projects = metadataRepository.getProjects( repoId, namespace ); + Collection exclusions = new ArrayList( projects ); + exclusions.addAll( metadataRepository.getNamespaces( repoId, namespace ) ); + Collection storageProjects = + repositoryStorage.listProjects( repoId, namespace, new ExcludesFilter( exclusions ) ); + if ( storageProjects != null && !storageProjects.isEmpty() ) { - ProjectMetadata projectMetadata = repositoryStorage.readProjectMetadata( repoId, namespace, projectId ); - if ( projectMetadata != null ) + + log.debug( "Resolved projects from storage: {}", storageProjects ); + for ( String projectId : storageProjects ) { - try - { - metadataRepository.updateProject( repoId, projectMetadata ); - } - catch ( MetadataRepositoryException e ) + ProjectMetadata projectMetadata = + repositoryStorage.readProjectMetadata( repoId, namespace, projectId ); + if ( projectMetadata != null ) { - log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + try + { + metadataRepository.updateProject( repoId, projectMetadata ); + } + catch ( MetadataRepositoryException e ) + { + log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + } } } - } - session.markDirty(); + session.markDirty(); - projects = new ArrayList( projects ); - projects.addAll( storageProjects ); + projects = new ArrayList( projects ); + projects.addAll( storageProjects ); + } + return projects; + } + catch ( RepositoryStorageRuntimeException e ) + { + throw new MetadataResolutionException( e.getMessage(), e ); } - return projects; } public Collection resolveProjectVersions( RepositorySession session, String repoId, String namespace, String projectId ) throws MetadataResolutionException { - MetadataRepository metadataRepository = session.getRepository(); - Collection projectVersions = metadataRepository.getProjectVersions( repoId, namespace, projectId ); - Collection storageProjectVersions = repositoryStorage.listProjectVersions( repoId, namespace, projectId, - new ExcludesFilter( - projectVersions ) ); - if ( storageProjectVersions != null && !storageProjectVersions.isEmpty() ) + try { - if ( log.isDebugEnabled() ) - { - log.debug( "Resolved project versions from storage: " + storageProjectVersions ); - } - for ( String projectVersion : storageProjectVersions ) + MetadataRepository metadataRepository = session.getRepository(); + Collection projectVersions = metadataRepository.getProjectVersions( repoId, namespace, projectId ); + Collection storageProjectVersions = + repositoryStorage.listProjectVersions( repoId, namespace, projectId, + new ExcludesFilter( projectVersions ) ); + if ( storageProjectVersions != null && !storageProjectVersions.isEmpty() ) { - try - { - ProjectVersionMetadata versionMetadata = - repositoryStorage.readProjectVersionMetadata( repoId, namespace, projectId, projectVersion ); - for ( RepositoryListener listener : listeners ) - { - listener.addArtifact( session, repoId, namespace, projectId, versionMetadata ); - } + log.debug( "Resolved project versions from storage: {}", storageProjectVersions ); - metadataRepository.updateProjectVersion( repoId, namespace, projectId, versionMetadata ); - } - catch ( MetadataRepositoryException e ) - { - log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); - } - catch ( RepositoryStorageMetadataInvalidException e ) + for ( String projectVersion : storageProjectVersions ) { - log.warn( "Not update project in metadata repository due to an error resolving it from storage: " - + e.getMessage() ); + try + { + ProjectVersionMetadata versionMetadata = + repositoryStorage.readProjectVersionMetadata( repoId, namespace, projectId, + projectVersion ); + for ( RepositoryListener listener : listeners ) + { + listener.addArtifact( session, repoId, namespace, projectId, versionMetadata ); + } - for ( RepositoryListener listener : listeners ) + metadataRepository.updateProjectVersion( repoId, namespace, projectId, versionMetadata ); + } + catch ( MetadataRepositoryException e ) { - listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e ); + log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); } - } - catch ( RepositoryStorageMetadataNotFoundException e ) - { - for ( RepositoryListener listener : listeners ) + catch ( RepositoryStorageMetadataInvalidException e ) { - listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e ); + log.warn( + "Not update project in metadata repository due to an error resolving it from storage: " + + e.getMessage() ); + + for ( RepositoryListener listener : listeners ) + { + listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e ); + } + } + catch ( RepositoryStorageMetadataNotFoundException e ) + { + for ( RepositoryListener listener : listeners ) + { + listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e ); + } } } - } - session.markDirty(); + session.markDirty(); - projectVersions = new ArrayList( projectVersions ); - projectVersions.addAll( storageProjectVersions ); + projectVersions = new ArrayList( projectVersions ); + projectVersions.addAll( storageProjectVersions ); + } + return projectVersions; + } + catch ( RepositoryStorageRuntimeException e ) + { + throw new MetadataResolutionException( e.getMessage(), e ); } - return projectVersions; } public Collection resolveArtifacts( RepositorySession session, String repoId, String namespace, String projectId, String projectVersion ) throws MetadataResolutionException { - MetadataRepository metadataRepository = session.getRepository(); - Collection artifacts = - metadataRepository.getArtifacts( repoId, namespace, projectId, projectVersion ); - ExcludesFilter filter = new ExcludesFilter( createArtifactIdList( artifacts ) ); - Collection storageArtifacts = - repositoryStorage.readArtifactsMetadata( repoId, namespace, projectId, projectVersion, filter ); - if ( storageArtifacts != null && !storageArtifacts.isEmpty() ) + try { - if ( log.isDebugEnabled() ) - { - log.debug( "Resolved artifacts from storage: " + storageArtifacts ); - } - for ( ArtifactMetadata artifact : storageArtifacts ) + MetadataRepository metadataRepository = session.getRepository(); + Collection artifacts = + metadataRepository.getArtifacts( repoId, namespace, projectId, projectVersion ); + ExcludesFilter filter = new ExcludesFilter( createArtifactIdList( artifacts ) ); + Collection storageArtifacts = + repositoryStorage.readArtifactsMetadata( repoId, namespace, projectId, projectVersion, filter ); + if ( storageArtifacts != null && !storageArtifacts.isEmpty() ) { - try + if ( log.isDebugEnabled() ) { - metadataRepository.updateArtifact( repoId, namespace, projectId, projectVersion, artifact ); + log.debug( "Resolved artifacts from storage: " + storageArtifacts ); } - catch ( MetadataRepositoryException e ) + for ( ArtifactMetadata artifact : storageArtifacts ) { - log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + try + { + metadataRepository.updateArtifact( repoId, namespace, projectId, projectVersion, artifact ); + } + catch ( MetadataRepositoryException e ) + { + log.warn( "Unable to persist resolved information: " + e.getMessage(), e ); + } } - } - session.markDirty(); + session.markDirty(); - artifacts = new ArrayList( artifacts ); - artifacts.addAll( storageArtifacts ); + artifacts = new ArrayList( artifacts ); + artifacts.addAll( storageArtifacts ); + } + return artifacts; + } + catch ( RepositoryStorageRuntimeException e ) + { + for ( RepositoryListener listener : listeners ) + { + listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e ); + } + throw new MetadataResolutionException( e.getMessage(), e ); } - return artifacts; } private Collection createArtifactIdList( Collection artifacts ) diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java index f31f14aaf..e115812da 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java @@ -19,7 +19,6 @@ package org.apache.archiva.metadata.repository.storage; * under the License. */ -import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.ProjectMetadata; import org.apache.archiva.metadata.model.ProjectVersionMetadata; @@ -35,25 +34,25 @@ public interface RepositoryStorage ProjectVersionMetadata readProjectVersionMetadata( String repoId, String namespace, String projectId, String projectVersion ) throws RepositoryStorageMetadataInvalidException, RepositoryStorageMetadataNotFoundException, - RepositoryAdminException; + RepositoryStorageRuntimeException; Collection listRootNamespaces( String repoId, Filter filter ) - throws RepositoryAdminException; + throws RepositoryStorageRuntimeException; Collection listNamespaces( String repoId, String namespace, Filter filter ) - throws RepositoryAdminException; + throws RepositoryStorageRuntimeException; Collection listProjects( String repoId, String namespace, Filter filter ) - throws RepositoryAdminException; + throws RepositoryStorageRuntimeException; Collection listProjectVersions( String repoId, String namespace, String projectId, Filter filter ) - throws RepositoryAdminException; + throws RepositoryStorageRuntimeException; Collection readArtifactsMetadata( String repoId, String namespace, String projectId, String projectVersion, Filter filter ) - throws RepositoryAdminException; + throws RepositoryStorageRuntimeException; // FIXME: reconsider this API, do we want to expose storage format in the form of a path? ArtifactMetadata readArtifactMetadataFromPath( String repoId, String path ) - throws RepositoryAdminException; + throws RepositoryStorageRuntimeException; } diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorageRuntimeException.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorageRuntimeException.java new file mode 100644 index 000000000..401449ba1 --- /dev/null +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorageRuntimeException.java @@ -0,0 +1,38 @@ +package org.apache.archiva.metadata.repository.storage; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @since 1.4-M3 + * @author Olivier Lamy + */ +public class RepositoryStorageRuntimeException + extends RepositoryStorageMetadataException +{ + public RepositoryStorageRuntimeException( String id, String msg ) + { + super( id, msg ); + } + + public RepositoryStorageRuntimeException( String id, String msg, Throwable throwable ) + { + super( id, msg, throwable ); + } +} diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index 67f82fbb0..cf7a7fe87 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -104,6 +104,11 @@ wagon-http provided + + org.apache.maven.wagon + wagon-http-lightweight + provided + org.springframework spring-test @@ -129,6 +134,21 @@ mockito-all test + + net.sf.beanlib + beanlib + test + + + cglib + cglib + + + aopalliance + aopalliance + + + diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index d84b6eec5..b1a1f78ce 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -39,6 +39,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.metadata.repository.storage.RepositoryStorage; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; +import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.archiva.reports.RepositoryProblemFacet; import org.apache.archiva.xml.XMLException; @@ -141,190 +142,196 @@ public class Maven2RepositoryStorage public ProjectVersionMetadata readProjectVersionMetadata( String repoId, String namespace, String projectId, String projectVersion ) throws RepositoryStorageMetadataNotFoundException, RepositoryStorageMetadataInvalidException, - RepositoryAdminException + RepositoryStorageRuntimeException { + try + { + ManagedRepository repositoryConfiguration = managedRepositoryAdmin.getManagedRepository( repoId ); - ManagedRepository repositoryConfiguration = managedRepositoryAdmin.getManagedRepository( repoId ); - - String artifactVersion = projectVersion; + String artifactVersion = projectVersion; - File basedir = new File( repositoryConfiguration.getLocation() ); - if ( VersionUtil.isSnapshot( projectVersion ) ) - { - File metadataFile = - pathTranslator.toFile( basedir, namespace, projectId, projectVersion, METADATA_FILENAME ); - try + File basedir = new File( repositoryConfiguration.getLocation() ); + if ( VersionUtil.isSnapshot( projectVersion ) ) { - MavenRepositoryMetadata metadata = MavenRepositoryMetadataReader.read( metadataFile ); + File metadataFile = + pathTranslator.toFile( basedir, namespace, projectId, projectVersion, METADATA_FILENAME ); + try + { + MavenRepositoryMetadata metadata = MavenRepositoryMetadataReader.read( metadataFile ); - // re-adjust to timestamp if present, otherwise retain the original -SNAPSHOT filename - MavenRepositoryMetadata.Snapshot snapshotVersion = metadata.getSnapshotVersion(); - if ( snapshotVersion != null ) + // re-adjust to timestamp if present, otherwise retain the original -SNAPSHOT filename + MavenRepositoryMetadata.Snapshot snapshotVersion = metadata.getSnapshotVersion(); + if ( snapshotVersion != null ) + { + artifactVersion = + artifactVersion.substring( 0, artifactVersion.length() - 8 ); // remove SNAPSHOT from end + artifactVersion = + artifactVersion + snapshotVersion.getTimestamp() + "-" + snapshotVersion.getBuildNumber(); + } + } + catch ( XMLException e ) { - artifactVersion = - artifactVersion.substring( 0, artifactVersion.length() - 8 ); // remove SNAPSHOT from end - artifactVersion = - artifactVersion + snapshotVersion.getTimestamp() + "-" + snapshotVersion.getBuildNumber(); + // unable to parse metadata - log it, and continue with the version as the original SNAPSHOT version + log.warn( "Invalid metadata: " + metadataFile + " - " + e.getMessage() ); } } - catch ( XMLException e ) - { - // unable to parse metadata - log it, and continue with the version as the original SNAPSHOT version - log.warn( "Invalid metadata: " + metadataFile + " - " + e.getMessage() ); - } - } - // TODO: won't work well with some other layouts, might need to convert artifact parts to ID by path translator - String id = projectId + "-" + artifactVersion + ".pom"; - File file = pathTranslator.toFile( basedir, namespace, projectId, projectVersion, id ); + // TODO: won't work well with some other layouts, might need to convert artifact parts to ID by path translator + String id = projectId + "-" + artifactVersion + ".pom"; + File file = pathTranslator.toFile( basedir, namespace, projectId, projectVersion, id ); - if ( !file.exists() ) - { - // metadata could not be resolved - throw new RepositoryStorageMetadataNotFoundException( - "The artifact's POM file '" + file.getAbsolutePath() + "' was missing" ); - } + if ( !file.exists() ) + { + // metadata could not be resolved + throw new RepositoryStorageMetadataNotFoundException( + "The artifact's POM file '" + file.getAbsolutePath() + "' was missing" ); + } - // TODO: this is a workaround until we can properly resolve using proxies as well - this doesn't cache - // anything locally! - List remoteRepositories = new ArrayList(); - Map networkProxies = new HashMap(); + // TODO: this is a workaround until we can properly resolve using proxies as well - this doesn't cache + // anything locally! + List remoteRepositories = new ArrayList(); + Map networkProxies = new HashMap(); - Map> proxyConnectorsMap = proxyConnectorAdmin.getProxyConnectorAsMap(); - List proxyConnectors = proxyConnectorsMap.get( repoId ); - if ( proxyConnectors != null ) - { - for ( ProxyConnector proxyConnector : proxyConnectors ) + Map> proxyConnectorsMap = proxyConnectorAdmin.getProxyConnectorAsMap(); + List proxyConnectors = proxyConnectorsMap.get( repoId ); + if ( proxyConnectors != null ) { - RemoteRepository remoteRepoConfig = - remoteRepositoryAdmin.getRemoteRepository( proxyConnector.getTargetRepoId() ); - - if ( remoteRepoConfig != null ) + for ( ProxyConnector proxyConnector : proxyConnectors ) { - remoteRepositories.add( remoteRepoConfig ); - - NetworkProxy networkProxyConfig = networkProxyAdmin.getNetworkProxy( proxyConnector.getProxyId() ); + RemoteRepository remoteRepoConfig = + remoteRepositoryAdmin.getRemoteRepository( proxyConnector.getTargetRepoId() ); - if ( networkProxyConfig != null ) + if ( remoteRepoConfig != null ) { - // key/value: remote repo ID/proxy info - networkProxies.put( proxyConnector.getTargetRepoId(), networkProxyConfig ); + remoteRepositories.add( remoteRepoConfig ); + + NetworkProxy networkProxyConfig = + networkProxyAdmin.getNetworkProxy( proxyConnector.getProxyId() ); + + if ( networkProxyConfig != null ) + { + // key/value: remote repo ID/proxy info + networkProxies.put( proxyConnector.getTargetRepoId(), networkProxyConfig ); + } } } } - } - - ModelBuildingRequest req = new DefaultModelBuildingRequest(); - req.setProcessPlugins( false ); - req.setPomFile( file ); - // MRM-1411 - req.setModelResolver( - new RepositoryModelResolver( basedir, pathTranslator, wagonFactory, remoteRepositories, networkProxies, - repositoryConfiguration ) ); - req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); + ModelBuildingRequest req = new DefaultModelBuildingRequest(); + req.setProcessPlugins( false ); + req.setPomFile( file ); - Model model; - try - { - model = builder.build( req ).getEffectiveModel(); - } - catch ( ModelBuildingException e ) - { - String msg = "The artifact's POM file '" + file + "' was invalid: " + e.getMessage(); + // MRM-1411 + req.setModelResolver( + new RepositoryModelResolver( basedir, pathTranslator, wagonFactory, remoteRepositories, networkProxies, + repositoryConfiguration ) ); + req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); - List modelProblems = e.getProblems(); - for ( ModelProblem problem : modelProblems ) + Model model; + try { - // MRM-1411, related to MRM-1335 - // this means that the problem was that the parent wasn't resolved! - if ( problem.getException() instanceof FileNotFoundException && e.getModelId() != null && - !e.getModelId().equals( problem.getModelId() ) ) - { - log.warn( "The artifact's parent POM file '" + file + "' cannot be resolved. " + - "Using defaults for project version metadata.." ); - - ProjectVersionMetadata metadata = new ProjectVersionMetadata(); - metadata.setId( projectVersion ); - - MavenProjectFacet facet = new MavenProjectFacet(); - facet.setGroupId( namespace ); - facet.setArtifactId( projectId ); - facet.setPackaging( "jar" ); - metadata.addFacet( facet ); - - String errMsg = - "Error in resolving artifact's parent POM file. " + problem.getException().getMessage(); - RepositoryProblemFacet repoProblemFacet = new RepositoryProblemFacet(); - repoProblemFacet.setRepositoryId( repoId ); - repoProblemFacet.setId( repoId ); - repoProblemFacet.setMessage( errMsg ); - repoProblemFacet.setProblem( errMsg ); - repoProblemFacet.setProject( projectId ); - repoProblemFacet.setVersion( projectVersion ); - repoProblemFacet.setNamespace( namespace ); - - metadata.addFacet( repoProblemFacet ); - - return metadata; - } + model = builder.build( req ).getEffectiveModel(); } + catch ( ModelBuildingException e ) + { + String msg = "The artifact's POM file '" + file + "' was invalid: " + e.getMessage(); - throw new RepositoryStorageMetadataInvalidException( "invalid-pom", msg, e ); - } + List modelProblems = e.getProblems(); + for ( ModelProblem problem : modelProblems ) + { + // MRM-1411, related to MRM-1335 + // this means that the problem was that the parent wasn't resolved! + if ( problem.getException() instanceof FileNotFoundException && e.getModelId() != null && + !e.getModelId().equals( problem.getModelId() ) ) + { + log.warn( "The artifact's parent POM file '" + file + "' cannot be resolved. " + + "Using defaults for project version metadata.." ); + + ProjectVersionMetadata metadata = new ProjectVersionMetadata(); + metadata.setId( projectVersion ); + + MavenProjectFacet facet = new MavenProjectFacet(); + facet.setGroupId( namespace ); + facet.setArtifactId( projectId ); + facet.setPackaging( "jar" ); + metadata.addFacet( facet ); + + String errMsg = + "Error in resolving artifact's parent POM file. " + problem.getException().getMessage(); + RepositoryProblemFacet repoProblemFacet = new RepositoryProblemFacet(); + repoProblemFacet.setRepositoryId( repoId ); + repoProblemFacet.setId( repoId ); + repoProblemFacet.setMessage( errMsg ); + repoProblemFacet.setProblem( errMsg ); + repoProblemFacet.setProject( projectId ); + repoProblemFacet.setVersion( projectVersion ); + repoProblemFacet.setNamespace( namespace ); + + metadata.addFacet( repoProblemFacet ); + + return metadata; + } + } - // Check if the POM is in the correct location - boolean correctGroupId = namespace.equals( model.getGroupId() ); - boolean correctArtifactId = projectId.equals( model.getArtifactId() ); - boolean correctVersion = projectVersion.equals( model.getVersion() ); - if ( !correctGroupId || !correctArtifactId || !correctVersion ) - { - StringBuilder message = new StringBuilder( "Incorrect POM coordinates in '" + file + "':" ); - if ( !correctGroupId ) - { - message.append( "\nIncorrect group ID: " ).append( model.getGroupId() ); + throw new RepositoryStorageMetadataInvalidException( "invalid-pom", msg, e ); } - if ( !correctArtifactId ) + + // Check if the POM is in the correct location + boolean correctGroupId = namespace.equals( model.getGroupId() ); + boolean correctArtifactId = projectId.equals( model.getArtifactId() ); + boolean correctVersion = projectVersion.equals( model.getVersion() ); + if ( !correctGroupId || !correctArtifactId || !correctVersion ) { - message.append( "\nIncorrect artifact ID: " ).append( model.getArtifactId() ); + StringBuilder message = new StringBuilder( "Incorrect POM coordinates in '" + file + "':" ); + if ( !correctGroupId ) + { + message.append( "\nIncorrect group ID: " ).append( model.getGroupId() ); + } + if ( !correctArtifactId ) + { + message.append( "\nIncorrect artifact ID: " ).append( model.getArtifactId() ); + } + if ( !correctVersion ) + { + message.append( "\nIncorrect version: " ).append( model.getVersion() ); + } + + throw new RepositoryStorageMetadataInvalidException( "mislocated-pom", message.toString() ); } - if ( !correctVersion ) + + ProjectVersionMetadata metadata = new ProjectVersionMetadata(); + metadata.setCiManagement( convertCiManagement( model.getCiManagement() ) ); + metadata.setDescription( model.getDescription() ); + metadata.setId( projectVersion ); + metadata.setIssueManagement( convertIssueManagement( model.getIssueManagement() ) ); + metadata.setLicenses( convertLicenses( model.getLicenses() ) ); + metadata.setMailingLists( convertMailingLists( model.getMailingLists() ) ); + metadata.setDependencies( convertDependencies( model.getDependencies() ) ); + metadata.setName( model.getName() ); + metadata.setOrganization( convertOrganization( model.getOrganization() ) ); + metadata.setScm( convertScm( model.getScm() ) ); + metadata.setUrl( model.getUrl() ); + + MavenProjectFacet facet = new MavenProjectFacet(); + facet.setGroupId( model.getGroupId() != null ? model.getGroupId() : model.getParent().getGroupId() ); + facet.setArtifactId( model.getArtifactId() ); + facet.setPackaging( model.getPackaging() ); + if ( model.getParent() != null ) { - message.append( "\nIncorrect version: " ).append( model.getVersion() ); + MavenProjectParent parent = new MavenProjectParent(); + parent.setGroupId( model.getParent().getGroupId() ); + parent.setArtifactId( model.getParent().getArtifactId() ); + parent.setVersion( model.getParent().getVersion() ); + facet.setParent( parent ); } + metadata.addFacet( facet ); - throw new RepositoryStorageMetadataInvalidException( "mislocated-pom", message.toString() ); + return metadata; } - - ProjectVersionMetadata metadata = new ProjectVersionMetadata(); - metadata.setCiManagement( convertCiManagement( model.getCiManagement() ) ); - metadata.setDescription( model.getDescription() ); - metadata.setId( projectVersion ); - metadata.setIssueManagement( convertIssueManagement( model.getIssueManagement() ) ); - metadata.setLicenses( convertLicenses( model.getLicenses() ) ); - metadata.setMailingLists( convertMailingLists( model.getMailingLists() ) ); - metadata.setDependencies( convertDependencies( model.getDependencies() ) ); - metadata.setName( model.getName() ); - metadata.setOrganization( convertOrganization( model.getOrganization() ) ); - metadata.setScm( convertScm( model.getScm() ) ); - metadata.setUrl( model.getUrl() ); - - MavenProjectFacet facet = new MavenProjectFacet(); - facet.setGroupId( model.getGroupId() != null ? model.getGroupId() : model.getParent().getGroupId() ); - facet.setArtifactId( model.getArtifactId() ); - facet.setPackaging( model.getPackaging() ); - if ( model.getParent() != null ) + catch ( RepositoryAdminException e ) { - MavenProjectParent parent = new MavenProjectParent(); - parent.setGroupId( model.getParent().getGroupId() ); - parent.setArtifactId( model.getParent().getArtifactId() ); - parent.setVersion( model.getParent().getVersion() ); - facet.setParent( parent ); + throw new RepositoryStorageRuntimeException( "repo-admin", e.getMessage() ); } - metadata.addFacet( facet ); - - return metadata; - } public void setWagonFactory( WagonFactory wagonFactory ) @@ -435,7 +442,7 @@ public class Maven2RepositoryStorage } public Collection listRootNamespaces( String repoId, Filter filter ) - throws RepositoryAdminException + throws RepositoryStorageRuntimeException { File dir = getRepositoryBasedir( repoId ); @@ -459,15 +466,22 @@ public class Maven2RepositoryStorage } private File getRepositoryBasedir( String repoId ) - throws RepositoryAdminException + throws RepositoryStorageRuntimeException { - ManagedRepository repositoryConfiguration = managedRepositoryAdmin.getManagedRepository( repoId ); + try + { + ManagedRepository repositoryConfiguration = managedRepositoryAdmin.getManagedRepository( repoId ); - return new File( repositoryConfiguration.getLocation() ); + return new File( repositoryConfiguration.getLocation() ); + } + catch ( RepositoryAdminException e ) + { + throw new RepositoryStorageRuntimeException( "repo-admin", e.getMessage() ); + } } public Collection listNamespaces( String repoId, String namespace, Filter filter ) - throws RepositoryAdminException + throws RepositoryStorageRuntimeException { File dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace ); @@ -489,7 +503,7 @@ public class Maven2RepositoryStorage } public Collection listProjects( String repoId, String namespace, Filter filter ) - throws RepositoryAdminException + throws RepositoryStorageRuntimeException { File dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace ); @@ -512,7 +526,7 @@ public class Maven2RepositoryStorage public Collection listProjectVersions( String repoId, String namespace, String projectId, Filter filter ) - throws RepositoryAdminException + throws RepositoryStorageRuntimeException { File dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace, projectId ); @@ -522,7 +536,7 @@ public class Maven2RepositoryStorage public Collection readArtifactsMetadata( String repoId, String namespace, String projectId, String projectVersion, Filter filter ) - throws RepositoryAdminException + throws RepositoryStorageRuntimeException { File dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace, projectId, projectVersion ); @@ -542,7 +556,7 @@ public class Maven2RepositoryStorage } public ArtifactMetadata readArtifactMetadataFromPath( String repoId, String path ) - throws RepositoryAdminException + throws RepositoryStorageRuntimeException { ArtifactMetadata metadata = pathTranslator.getArtifactForPath( repoId, path ); diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/configuration/MockRepoAdmin.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/configuration/MockRepoAdmin.java new file mode 100644 index 000000000..fe6a4a557 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/configuration/MockRepoAdmin.java @@ -0,0 +1,283 @@ +package org.apache.archiva.configuration; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import net.sf.beanlib.provider.replicator.BeanReplicator; +import org.apache.archiva.admin.model.AuditInformation; +import org.apache.archiva.admin.model.RepositoryAdminException; +import org.apache.archiva.admin.model.beans.ManagedRepository; +import org.apache.archiva.admin.model.beans.NetworkProxy; +import org.apache.archiva.admin.model.beans.ProxyConnector; +import org.apache.archiva.admin.model.beans.RemoteRepository; +import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; +import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; +import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin; +import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorOrderComparator; +import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; +import org.apache.commons.lang.StringUtils; +import org.apache.maven.index.context.IndexingContext; +import org.springframework.stereotype.Service; + +import javax.inject.Inject; +import javax.inject.Named; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * @author Olivier Lamy + */ +@Service +public class MockRepoAdmin + implements RemoteRepositoryAdmin, ManagedRepositoryAdmin, ProxyConnectorAdmin, NetworkProxyAdmin +{ + @Inject + @Named( value = "archivaConfiguration#test" ) + private ArchivaConfiguration archivaConfiguration; + + public List getRemoteRepositories() + throws RepositoryAdminException + { + List remoteRepositories = + new ArrayList( archivaConfiguration.getConfiguration().getRemoteRepositories().size() ); + for ( RemoteRepositoryConfiguration repositoryConfiguration : archivaConfiguration.getConfiguration().getRemoteRepositories() ) + { + RemoteRepository remoteRepository = + new RemoteRepository( repositoryConfiguration.getId(), repositoryConfiguration.getName(), + repositoryConfiguration.getUrl(), repositoryConfiguration.getLayout(), + repositoryConfiguration.getUsername(), repositoryConfiguration.getPassword(), + repositoryConfiguration.getTimeout() ); + remoteRepository.setDownloadRemoteIndex( repositoryConfiguration.isDownloadRemoteIndex() ); + remoteRepository.setRemoteIndexUrl( repositoryConfiguration.getRemoteIndexUrl() ); + remoteRepository.setCronExpression( repositoryConfiguration.getRefreshCronExpression() ); + remoteRepository.setIndexDirectory( repositoryConfiguration.getIndexDir() ); + remoteRepository.setRemoteDownloadNetworkProxyId( + repositoryConfiguration.getRemoteDownloadNetworkProxyId() ); + remoteRepository.setRemoteDownloadTimeout( repositoryConfiguration.getRemoteDownloadTimeout() ); + remoteRepository.setDownloadRemoteIndexOnStartup( + repositoryConfiguration.isDownloadRemoteIndexOnStartup() ); + remoteRepositories.add( remoteRepository ); + } + return remoteRepositories; + } + + public RemoteRepository getRemoteRepository( String repositoryId ) + throws RepositoryAdminException + { + for ( RemoteRepository remoteRepository : getRemoteRepositories() ) + { + if ( StringUtils.equals( repositoryId, remoteRepository.getId() ) ) + { + return remoteRepository; + } + } + return null; + } + + public Boolean deleteRemoteRepository( String repositoryId, AuditInformation auditInformation ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Boolean addRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Boolean updateRemoteRepository( RemoteRepository remoteRepository, AuditInformation auditInformation ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Map getRemoteRepositoriesAsMap() + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public IndexingContext createIndexContext( RemoteRepository repository ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public List getManagedRepositories() + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Map getManagedRepositoriesAsMap() + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ManagedRepository getManagedRepository( String repositoryId ) + throws RepositoryAdminException + { + for ( ManagedRepositoryConfiguration repoConfig : archivaConfiguration.getConfiguration().getManagedRepositories() ) + { + if ( StringUtils.equals( repositoryId, repoConfig.getId() ) ) + { + return new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(), + repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(), + repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(), + repoConfig.getIndexDir(), repoConfig.isScanned(), + repoConfig.getDaysOlder(), repoConfig.getRetentionCount(), + repoConfig.isDeleteReleasedSnapshots(), false ); + } + } + return null; + } + + public Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation, + boolean deleteContent ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo, + AuditInformation auditInformation ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo, + AuditInformation auditInformation, boolean resetStats ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public IndexingContext createIndexContext( ManagedRepository repository ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public List getProxyConnectors() + throws RepositoryAdminException + { + List proxyConnectorConfigurations = + archivaConfiguration.getConfiguration().getProxyConnectors(); + List proxyConnectors = new ArrayList( proxyConnectorConfigurations.size() ); + for ( ProxyConnectorConfiguration configuration : proxyConnectorConfigurations ) + { + proxyConnectors.add( getProxyConnector( configuration ) ); + } + Collections.sort( proxyConnectors, ProxyConnectorOrderComparator.getInstance() ); + return proxyConnectors; + } + + public ProxyConnector getProxyConnector( String sourceRepoId, String targetRepoId ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Boolean addProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Boolean deleteProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Boolean updateProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Map> getProxyConnectorAsMap() + throws RepositoryAdminException + { + Map> proxyConnectorMap = new HashMap>(); + + Iterator it = getProxyConnectors().iterator(); + while ( it.hasNext() ) + { + ProxyConnector proxyConfig = it.next(); + String key = proxyConfig.getSourceRepoId(); + + List connectors = proxyConnectorMap.get( key ); + if ( connectors == null ) + { + connectors = new ArrayList( 1 ); + proxyConnectorMap.put( key, connectors ); + } + + connectors.add( proxyConfig ); + + Collections.sort( connectors, ProxyConnectorOrderComparator.getInstance() ); + } + + return proxyConnectorMap; + } + + public List getNetworkProxies() + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public NetworkProxy getNetworkProxy( String networkProxyId ) + throws RepositoryAdminException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation ) + throws RepositoryAdminException + { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void updateNetworkProxy( NetworkProxy networkProxy, AuditInformation auditInformation ) + throws RepositoryAdminException + { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void deleteNetworkProxy( String networkProxyId, AuditInformation auditInformation ) + throws RepositoryAdminException + { + //To change body of implemented methods use File | Settings | File Templates. + } + + protected ProxyConnector getProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration ) + { + return proxyConnectorConfiguration == null + ? null + : new BeanReplicator().replicateBean( proxyConnectorConfiguration, ProxyConnector.class ); + } +} diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java index 712aa45c2..1f864cd72 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java @@ -20,6 +20,12 @@ package org.apache.archiva.metadata.repository.storage.maven2; */ import junit.framework.TestCase; +import org.apache.archiva.common.utils.FileUtil; +import org.apache.archiva.configuration.ArchivaConfiguration; +import org.apache.archiva.configuration.Configuration; +import org.apache.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.archiva.configuration.ProxyConnectorConfiguration; +import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.Dependency; import org.apache.archiva.metadata.model.License; @@ -32,12 +38,6 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataI import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.commons.io.FileUtils; -import org.apache.archiva.common.utils.FileUtil; -import org.apache.archiva.configuration.ArchivaConfiguration; -import org.apache.archiva.configuration.Configuration; -import org.apache.archiva.configuration.ManagedRepositoryConfiguration; -import org.apache.archiva.configuration.ProxyConnectorConfiguration; -import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.maven.wagon.Wagon; import org.junit.Before; import org.junit.Test; @@ -45,9 +45,6 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import javax.inject.Inject; import javax.inject.Named; import java.io.File; @@ -59,15 +56,18 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + @RunWith( SpringJUnit4ClassRunner.class ) -@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath:/spring-context.xml"} ) +@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class Maven2RepositoryMetadataResolverTest extends TestCase { private static final Filter ALL = new AllFilter(); @Inject - @Named(value = "repositoryStorage#maven2") + @Named( value = "repositoryStorage#maven2" ) private Maven2RepositoryStorage storage; private static final String TEST_REPO_ID = "test"; @@ -135,8 +135,8 @@ public class Maven2RepositoryMetadataResolverTest public void testGetProjectVersionMetadata() throws Exception { - ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "org.apache.archiva", - "archiva-common", "1.2.1" ); + ProjectVersionMetadata metadata = + storage.readProjectVersionMetadata( TEST_REPO_ID, "org.apache.archiva", "archiva-common", "1.2.1" ); MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID ); assertEquals( "jar", facet.getPackaging() ); assertEquals( "http://archiva.apache.org/ref/1.2.1/archiva-base/archiva-common", metadata.getUrl() ); @@ -190,9 +190,8 @@ public class Maven2RepositoryMetadataResolverTest public void testGetArtifactMetadata() throws Exception { - Collection springArtifacts = storage.readArtifactsMetadata( TEST_REPO_ID, - "org.codehaus.plexus", - "plexus-spring", "1.2", ALL ); + Collection springArtifacts = + storage.readArtifactsMetadata( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2", ALL ); List artifacts = new ArrayList( springArtifacts ); Collections.sort( artifacts, new Comparator() { @@ -233,9 +232,8 @@ public class Maven2RepositoryMetadataResolverTest public void testGetArtifactMetadataSnapshots() throws Exception { - Collection testArtifacts = storage.readArtifactsMetadata( TEST_REPO_ID, "com.example.test", - "test-artifact", "1.0-SNAPSHOT", - ALL ); + Collection testArtifacts = + storage.readArtifactsMetadata( TEST_REPO_ID, "com.example.test", "test-artifact", "1.0-SNAPSHOT", ALL ); List artifacts = new ArrayList( testArtifacts ); Collections.sort( artifacts, new Comparator() { @@ -317,8 +315,8 @@ public class Maven2RepositoryMetadataResolverTest public void testGetProjectVersionMetadataForTimestampedSnapshot() throws Exception { - ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "org.apache", "apache", - "5-SNAPSHOT" ); + ProjectVersionMetadata metadata = + storage.readProjectVersionMetadata( TEST_REPO_ID, "org.apache", "apache", "5-SNAPSHOT" ); MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID ); assertEquals( "pom", facet.getPackaging() ); assertEquals( "http://www.apache.org/", metadata.getUrl() ); @@ -451,8 +449,8 @@ public class Maven2RepositoryMetadataResolverTest copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a", "target/test-repository/com/example/test/test-artifact-module-a" ); - ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", - "test-artifact-module-a", "1.0" ); + ProjectVersionMetadata metadata = + storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "test-artifact-module-a", "1.0" ); MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID ); assertEquals( "jar", facet.getPackaging() ); @@ -489,7 +487,7 @@ public class Maven2RepositoryMetadataResolverTest @Test public void testGetProjectVersionMetadataWithParentNoRemoteReposConfigured() - throws Exception + throws Exception { // remove configuration Configuration config = configuration.getConfiguration(); @@ -501,11 +499,11 @@ public class Maven2RepositoryMetadataResolverTest copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a", "target/test-repository/com/example/test/test-artifact-module-a" ); - ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", - "test-artifact-module-a", "1.0" ); + ProjectVersionMetadata metadata = + storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "test-artifact-module-a", "1.0" ); assertEquals( "1.0", metadata.getId() ); - MavenProjectFacet facet = ( MavenProjectFacet ) metadata.getFacet( MavenProjectFacet.FACET_ID ); + MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID ); assertNotNull( facet ); assertEquals( "com.example.test", facet.getGroupId() ); assertEquals( "test-artifact-module-a", facet.getArtifactId() ); @@ -521,16 +519,17 @@ public class Maven2RepositoryMetadataResolverTest @Test public void testGetProjectVersionMetadataWithParentNotInAnyRemoteRepo() - throws Exception + throws Exception { copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a", "target/test-repository/com/example/test/test-artifact-module-a" ); - ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "missing-parent", "1.1" ); + ProjectVersionMetadata metadata = + storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "missing-parent", "1.1" ); assertEquals( "1.1", metadata.getId() ); - MavenProjectFacet facet = ( MavenProjectFacet ) metadata.getFacet( MavenProjectFacet.FACET_ID ); + MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID ); assertNotNull( facet ); assertEquals( "com.example.test", facet.getGroupId() ); assertEquals( "missing-parent", facet.getArtifactId() ); @@ -551,8 +550,9 @@ public class Maven2RepositoryMetadataResolverTest copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-module-a", "target/test-repository/com/example/test/test-snapshot-artifact-module-a" ); - ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", - "test-snapshot-artifact-module-a", "1.1-SNAPSHOT" ); + ProjectVersionMetadata metadata = + storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a", + "1.1-SNAPSHOT" ); MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID ); assertEquals( "jar", facet.getPackaging() ); @@ -589,95 +589,94 @@ public class Maven2RepositoryMetadataResolverTest @Test public void testGetRootNamespaces() + throws Exception { assertEquals( Arrays.asList( "com", "org" ), storage.listRootNamespaces( TEST_REPO_ID, ALL ) ); } @Test public void testGetNamespaces() + throws Exception { assertEquals( Arrays.asList( "example" ), storage.listNamespaces( TEST_REPO_ID, "com", ALL ) ); assertEquals( Arrays.asList( "test" ), storage.listNamespaces( TEST_REPO_ID, "com.example", ALL ) ); - assertEquals( Collections.emptyList(), storage.listNamespaces( TEST_REPO_ID, "com.example.test", - ALL ) ); + assertEquals( Collections.emptyList(), + storage.listNamespaces( TEST_REPO_ID, "com.example.test", ALL ) ); assertEquals( Arrays.asList( "apache", "codehaus" ), storage.listNamespaces( TEST_REPO_ID, "org", ALL ) ); assertEquals( Arrays.asList( "archiva", "maven" ), storage.listNamespaces( TEST_REPO_ID, "org.apache", ALL ) ); - assertEquals( Collections.emptyList(), storage.listNamespaces( TEST_REPO_ID, "org.apache.archiva", - ALL ) ); - assertEquals( Arrays.asList( "plugins", "shared" ), storage.listNamespaces( TEST_REPO_ID, "org.apache.maven", - ALL ) ); - assertEquals( Collections.emptyList(), storage.listNamespaces( TEST_REPO_ID, "org.apache.maven.plugins", - ALL ) ); - assertEquals( Collections.emptyList(), storage.listNamespaces( TEST_REPO_ID, "org.apache.maven.shared", - ALL ) ); + assertEquals( Collections.emptyList(), + storage.listNamespaces( TEST_REPO_ID, "org.apache.archiva", ALL ) ); + assertEquals( Arrays.asList( "plugins", "shared" ), + storage.listNamespaces( TEST_REPO_ID, "org.apache.maven", ALL ) ); + assertEquals( Collections.emptyList(), + storage.listNamespaces( TEST_REPO_ID, "org.apache.maven.plugins", ALL ) ); + assertEquals( Collections.emptyList(), + storage.listNamespaces( TEST_REPO_ID, "org.apache.maven.shared", ALL ) ); assertEquals( Arrays.asList( "plexus" ), storage.listNamespaces( TEST_REPO_ID, "org.codehaus", ALL ) ); - assertEquals( Collections.emptyList(), storage.listNamespaces( TEST_REPO_ID, "org.codehaus.plexus", - ALL ) ); + assertEquals( Collections.emptyList(), + storage.listNamespaces( TEST_REPO_ID, "org.codehaus.plexus", ALL ) ); } @Test public void testGetProjects() + throws Exception { assertEquals( Collections.emptyList(), storage.listProjects( TEST_REPO_ID, "com", ALL ) ); assertEquals( Collections.emptyList(), storage.listProjects( TEST_REPO_ID, "com.example", ALL ) ); assertEquals( Arrays.asList( "incomplete-metadata", "invalid-pom", "malformed-metadata", "mislocated-pom", - "missing-metadata", "missing-parent", "test-artifact" ), storage.listProjects( TEST_REPO_ID, - "com.example.test", - ALL ) ); + "missing-metadata", "missing-parent", "test-artifact" ), + storage.listProjects( TEST_REPO_ID, "com.example.test", ALL ) ); assertEquals( Collections.emptyList(), storage.listProjects( TEST_REPO_ID, "org", ALL ) ); assertEquals( Arrays.asList( "apache" ), storage.listProjects( TEST_REPO_ID, "org.apache", ALL ) ); assertEquals( Arrays.asList( "archiva", "archiva-base", "archiva-common", "archiva-modules", "archiva-parent" ), storage.listProjects( TEST_REPO_ID, "org.apache.archiva", ALL ) ); assertEquals( Collections.emptyList(), storage.listProjects( TEST_REPO_ID, "org.apache.maven", ALL ) ); - assertEquals( Collections.emptyList(), storage.listProjects( TEST_REPO_ID, "org.apache.maven.plugins", - ALL ) ); - assertEquals( Arrays.asList( "maven-downloader" ), storage.listProjects( TEST_REPO_ID, - "org.apache.maven.shared", ALL ) ); + assertEquals( Collections.emptyList(), + storage.listProjects( TEST_REPO_ID, "org.apache.maven.plugins", ALL ) ); + assertEquals( Arrays.asList( "maven-downloader" ), + storage.listProjects( TEST_REPO_ID, "org.apache.maven.shared", ALL ) ); } @Test public void testGetProjectVersions() + throws Exception { - assertEquals( Arrays.asList( "1.0-SNAPSHOT" ), storage.listProjectVersions( TEST_REPO_ID, "com.example.test", - "incomplete-metadata", ALL ) ); - assertEquals( Arrays.asList( "1.0-SNAPSHOT" ), storage.listProjectVersions( TEST_REPO_ID, "com.example.test", - "malformed-metadata", ALL ) ); - assertEquals( Arrays.asList( "1.0-SNAPSHOT" ), storage.listProjectVersions( TEST_REPO_ID, "com.example.test", - "missing-metadata", ALL ) ); - assertEquals( Arrays.asList( "1.0" ), storage.listProjectVersions( TEST_REPO_ID, "com.example.test", - "invalid-pom", ALL ) ); - - assertEquals( Arrays.asList( "4", "5-SNAPSHOT" ), storage.listProjectVersions( TEST_REPO_ID, "org.apache", - "apache", ALL ) ); - - assertEquals( Arrays.asList( "1.2.1", "1.2.2" ), storage.listProjectVersions( TEST_REPO_ID, - "org.apache.archiva", "archiva", - ALL ) ); - assertEquals( Arrays.asList( "1.2.1" ), storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", - "archiva-base", ALL ) ); - assertEquals( Arrays.asList( "1.2.1" ), storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", - "archiva-common", ALL ) ); - assertEquals( Arrays.asList( "1.2.1" ), storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", - "archiva-modules", ALL ) ); - assertEquals( Arrays.asList( "3" ), storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", - "archiva-parent", ALL ) ); - - assertEquals( Collections.emptyList(), storage.listProjectVersions( TEST_REPO_ID, - "org.apache.maven.shared", - "maven-downloader", ALL ) ); + assertEquals( Arrays.asList( "1.0-SNAPSHOT" ), + storage.listProjectVersions( TEST_REPO_ID, "com.example.test", "incomplete-metadata", ALL ) ); + assertEquals( Arrays.asList( "1.0-SNAPSHOT" ), + storage.listProjectVersions( TEST_REPO_ID, "com.example.test", "malformed-metadata", ALL ) ); + assertEquals( Arrays.asList( "1.0-SNAPSHOT" ), + storage.listProjectVersions( TEST_REPO_ID, "com.example.test", "missing-metadata", ALL ) ); + assertEquals( Arrays.asList( "1.0" ), + storage.listProjectVersions( TEST_REPO_ID, "com.example.test", "invalid-pom", ALL ) ); + + assertEquals( Arrays.asList( "4", "5-SNAPSHOT" ), + storage.listProjectVersions( TEST_REPO_ID, "org.apache", "apache", ALL ) ); + + assertEquals( Arrays.asList( "1.2.1", "1.2.2" ), + storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", "archiva", ALL ) ); + assertEquals( Arrays.asList( "1.2.1" ), + storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", "archiva-base", ALL ) ); + assertEquals( Arrays.asList( "1.2.1" ), + storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", "archiva-common", ALL ) ); + assertEquals( Arrays.asList( "1.2.1" ), + storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", "archiva-modules", ALL ) ); + assertEquals( Arrays.asList( "3" ), + storage.listProjectVersions( TEST_REPO_ID, "org.apache.archiva", "archiva-parent", ALL ) ); + + assertEquals( Collections.emptyList(), + storage.listProjectVersions( TEST_REPO_ID, "org.apache.maven.shared", "maven-downloader", ALL ) ); } @Test public void testGetArtifacts() + throws Exception { - List artifacts = new ArrayList( storage.readArtifactsMetadata( TEST_REPO_ID, - "org.codehaus.plexus", - "plexus-spring", - "1.2", - ALL ) ); + List artifacts = new ArrayList( + storage.readArtifactsMetadata( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2", ALL ) ); assertEquals( 3, artifacts.size() ); Collections.sort( artifacts, new Comparator() { @@ -695,14 +694,12 @@ public class Maven2RepositoryMetadataResolverTest @Test public void testGetArtifactsFiltered() + throws Exception { - ExcludesFilter filter = new ExcludesFilter( Collections.singletonList( - "plexus-spring-1.2.pom" ) ); - List artifacts = new ArrayList( storage.readArtifactsMetadata( TEST_REPO_ID, - "org.codehaus.plexus", - "plexus-spring", - "1.2", - filter ) ); + ExcludesFilter filter = + new ExcludesFilter( Collections.singletonList( "plexus-spring-1.2.pom" ) ); + List artifacts = new ArrayList( + storage.readArtifactsMetadata( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2", filter ) ); assertEquals( 2, artifacts.size() ); Collections.sort( artifacts, new Comparator() { @@ -718,12 +715,11 @@ public class Maven2RepositoryMetadataResolverTest @Test public void testGetArtifactsTimestampedSnapshots() + throws Exception { - List artifacts = new ArrayList( storage.readArtifactsMetadata( TEST_REPO_ID, - "com.example.test", - "missing-metadata", - "1.0-SNAPSHOT", - ALL ) ); + List artifacts = new ArrayList( + storage.readArtifactsMetadata( TEST_REPO_ID, "com.example.test", "missing-metadata", "1.0-SNAPSHOT", + ALL ) ); assertEquals( 1, artifacts.size() ); ArtifactMetadata artifact = artifacts.get( 0 ); @@ -793,17 +789,18 @@ public class Maven2RepositoryMetadataResolverTest } private void deleteTestArtifactWithParent( List pathsToBeDeleted ) - throws IOException + throws IOException { - for( String path : pathsToBeDeleted ) + for ( String path : pathsToBeDeleted ) { - File dir = new File( FileUtil.getBasedir(), path ); + File dir = new File( FileUtil.getBasedir(), path ); FileUtils.deleteDirectory( dir ); assertFalse( dir.exists() ); } File dest = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-module-a" ); - File parentPom = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-parent" ); + File parentPom = + new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-parent" ); File rootPom = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-root" ); FileUtils.deleteDirectory( dest ); @@ -816,7 +813,7 @@ public class Maven2RepositoryMetadataResolverTest } private File copyTestArtifactWithParent( String srcPath, String destPath ) - throws IOException + throws IOException { File src = new File( FileUtil.getBasedir(), srcPath ); File dest = new File( FileUtil.getBasedir(), destPath ); diff --git a/pom.xml b/pom.xml index 1e99f7fbe..1b0b66052 100644 --- a/pom.xml +++ b/pom.xml @@ -1444,7 +1444,6 @@ org.codehaus.plexus.registry:plexus-registry-api org.codehaus.plexus.registry:plexus-registry-commons >org.codehaus.plexus:plexus-taskqueue - org.apache.maven.wagon:wagon-http-lightweight -- 2.39.5