diff --git a/archiva-base/archiva-common/pom.xml b/archiva-base/archiva-common/pom.xml index 17a20abd5..c5f3ff269 100644 --- a/archiva-base/archiva-common/pom.xml +++ b/archiva-base/archiva-common/pom.xml @@ -35,24 +35,14 @@ archiva-dev@maven.apache.org mailing-list. joakime@apache.org --> - - org.codehaus.plexus - plexus-component-api - - commons-lang commons-lang + + org.codehaus.plexus + plexus-component-api + org.codehaus.plexus plexus-container-default diff --git a/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java b/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java index ab8c6718c..613e89012 100644 --- a/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java +++ b/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java @@ -19,8 +19,9 @@ package org.apache.maven.archiva.common.utils; * under the License. */ +import org.apache.commons.lang.StringUtils; + import junit.framework.TestCase; -import org.codehaus.plexus.util.StringUtils; import java.io.File; diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/pom.xml b/archiva-base/archiva-consumers/archiva-database-consumers/pom.xml index 15df257bd..32ab1336e 100644 --- a/archiva-base/archiva-consumers/archiva-database-consumers/pom.xml +++ b/archiva-base/archiva-consumers/archiva-database-consumers/pom.xml @@ -30,6 +30,10 @@ jar + + org.codehaus.plexus + plexus-digest + org.apache.maven.archiva archiva-database diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java index 0ad7448bb..69fee0c85 100644 --- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java @@ -28,9 +28,10 @@ import org.apache.maven.archiva.database.ArchivaDAO; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArchivaRepository; -import org.apache.maven.archiva.model.RepositoryContent; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.LayoutException; +import org.codehaus.plexus.digest.Digester; +import org.codehaus.plexus.digest.DigesterException; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import org.codehaus.plexus.registry.Registry; @@ -38,6 +39,7 @@ import org.codehaus.plexus.registry.RegistryListener; import java.io.File; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Map; @@ -50,13 +52,16 @@ import java.util.Map; * @plexus.component role-hint="update-db-artifact" * instantiation-strategy="per-lookup" */ -public class ArtifactUpdateDatabaseConsumer extends AbstractMonitoredConsumer +public class ArtifactUpdateDatabaseConsumer + extends AbstractMonitoredConsumer implements RepositoryContentConsumer, RegistryListener, Initializable { private static final String TYPE_NOT_ARTIFACT = "file-not-artifact"; private static final String DB_ERROR = "db-error"; - + + private static final String CHECKSUM_CALCULATION = null; + /** * @plexus.configuration default-value="update-db-artifact" */ @@ -66,7 +71,7 @@ public class ArtifactUpdateDatabaseConsumer extends AbstractMonitoredConsumer * @plexus.configuration default-value="Update the Artifact in the Database" */ private String description; - + /** * @plexus.requirement role-hint="jdo" */ @@ -82,6 +87,16 @@ public class ArtifactUpdateDatabaseConsumer extends AbstractMonitoredConsumer */ private Map bidirectionalLayoutMap; + /** + * @plexus.requirement role-hint="sha1" + */ + private Digester digestSha1; + + /** + * @plexus.requirement role-hint="md5"; + */ + private Digester digestMd5; + private ArchivaRepository repository; private File repositoryDir; @@ -117,7 +132,8 @@ public class ArtifactUpdateDatabaseConsumer extends AbstractMonitoredConsumer return this.includes; } - public void beginScan( ArchivaRepository repository ) throws ConsumerException + public void beginScan( ArchivaRepository repository ) + throws ConsumerException { if ( !repository.isManaged() ) { @@ -131,31 +147,53 @@ public class ArtifactUpdateDatabaseConsumer extends AbstractMonitoredConsumer if ( !bidirectionalLayoutMap.containsKey( layoutName ) ) { throw new ConsumerException( "Unable to process repository with layout [" + layoutName - + "] as there is no coresponding " + BidirectionalRepositoryLayout.class.getName() - + " implementation available." ); + + "] as there is no coresponding " + BidirectionalRepositoryLayout.class.getName() + + " implementation available." ); } this.layout = (BidirectionalRepositoryLayout) bidirectionalLayoutMap.get( layoutName ); } - public void processFile( String path ) throws ConsumerException + public void processFile( String path ) + throws ConsumerException { try { ArchivaArtifact artifact = layout.toArtifact( path ); - - RepositoryContent repoContent = artifact.getModel().getContentKey(); - repoContent.setRepositoryId( this.repository.getId() ); - + + artifact.getModel().setRepositoryId( this.repository.getId() ); + // Calculate the hashcodes. - - + File artifactFile = new File( this.repositoryDir, path ); + try + { + artifact.getModel().setChecksumMD5( digestMd5.calc( artifactFile ) ); + } + catch ( DigesterException e ) + { + triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the MD5 checksum: " + e.getMessage() ); + } + + try + { + artifact.getModel().setChecksumSHA1( digestSha1.calc( artifactFile ) ); + } + catch ( DigesterException e ) + { + triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the SHA1 checksum: " + + e.getMessage() ); + } + + artifact.getModel().setLastModified( new Date( artifactFile.lastModified() ) ); + artifact.getModel().setSize( artifactFile.length() ); + artifact.getModel().setOrigin( "FileSystem" ); + dao.saveArtifact( artifact.getModel() ); } catch ( LayoutException e ) { triggerConsumerError( TYPE_NOT_ARTIFACT, "Path " + path + " cannot be converted to artifact: " - + e.getMessage() ); + + e.getMessage() ); } catch ( ArchivaDatabaseException e ) { @@ -192,7 +230,8 @@ public class ArtifactUpdateDatabaseConsumer extends AbstractMonitoredConsumer } } - public void initialize() throws InitializationException + public void initialize() + throws InitializationException { propertyNameTriggers = new ArrayList(); propertyNameTriggers.add( "repositoryScanning" ); diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java index e3920f45c..34ce2e8fc 100644 --- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java @@ -71,7 +71,10 @@ public class ArchivaArtifact model.setGroupId( groupId ); model.setArtifactId( artifactId ); model.setVersion( version ); - model.setRepositoryId( repository.getId() ); + if ( repository != null ) + { + model.setRepositoryId( repository.getId() ); + } model.setClassifier( StringUtils.defaultString( classifier ) ); model.setType( type ); diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java index 8b50de846..cdad4f850 100644 --- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java @@ -45,7 +45,7 @@ public class ArchivaModelCloner cloned.setGroupId( model.getGroupId() ); cloned.setArtifactId( model.getArtifactId() ); cloned.setVersion( model.getVersion() ); - + cloned.setParentProject( clone( model.getParentProject() ) ); cloned.setName( model.getName() ); @@ -75,15 +75,15 @@ public class ArchivaModelCloner { return null; } - + ArtifactReference cloned = new ArtifactReference(); - + cloned.setGroupId( artifactReference.getGroupId() ); cloned.setArtifactId( artifactReference.getArtifactId() ); cloned.setVersion( artifactReference.getVersion() ); cloned.setClassifier( artifactReference.getClassifier() ); cloned.setType( artifactReference.getType() ); - + return cloned; } @@ -102,6 +102,30 @@ public class ArchivaModelCloner return cloned; } + public static Dependency clone( Dependency dependency ) + { + if ( dependency == null ) + { + return null; + } + + Dependency cloned = new Dependency(); + + cloned.setGroupId( dependency.getGroupId() ); + cloned.setArtifactId( dependency.getArtifactId() ); + cloned.setVersion( dependency.getVersion() ); + + cloned.setClassifier( dependency.getClassifier() ); + cloned.setType( dependency.getType() ); + cloned.setScope( dependency.getScope() ); + cloned.setOptional( dependency.isOptional() ); + cloned.setSystemPath( dependency.getSystemPath() ); + cloned.setUrl( dependency.getUrl() ); + cloned.setExclusions( cloneExclusions( dependency.getExclusions() ) ); + + return cloned; + } + public static IssueManagement clone( IssueManagement issueManagement ) { if ( issueManagement == null ) @@ -175,13 +199,13 @@ public class ArchivaModelCloner { return null; } - + VersionedReference cloned = new VersionedReference(); - + cloned.setGroupId( versionedReference.getGroupId() ); cloned.setArtifactId( versionedReference.getArtifactId() ); cloned.setVersion( versionedReference.getVersion() ); - + return cloned; } @@ -217,21 +241,13 @@ public class ArchivaModelCloner while ( it.hasNext() ) { Dependency dep = (Dependency) it.next(); - Dependency cloned = new Dependency(); - - cloned.setGroupId( dep.getGroupId() ); - cloned.setArtifactId( dep.getArtifactId() ); - cloned.setVersion( dep.getVersion() ); - - cloned.setClassifier( dep.getClassifier() ); - cloned.setType( dep.getType() ); - cloned.setScope( dep.getScope() ); - cloned.setOptional( dep.isOptional() ); - cloned.setSystemPath( dep.getSystemPath() ); - cloned.setUrl( dep.getUrl() ); - cloned.setExclusions( cloneExclusions( dep.getExclusions() ) ); - ret.add( cloned ); + Dependency cloned = clone( dep ); + + if ( cloned != null ) + { + ret.add( cloned ); + } } return ret; diff --git a/archiva-base/archiva-model/src/test/java/org/apache/maven/archiva/model/ArchivaModelClonerTest.java b/archiva-base/archiva-model/src/test/java/org/apache/maven/archiva/model/ArchivaModelClonerTest.java new file mode 100644 index 000000000..263cd3253 --- /dev/null +++ b/archiva-base/archiva-model/src/test/java/org/apache/maven/archiva/model/ArchivaModelClonerTest.java @@ -0,0 +1,60 @@ +package org.apache.maven.archiva.model; + +/* + * 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 org.codehaus.plexus.PlexusTestCase; + +/** + * ArchivaModelClonerTest + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArchivaModelClonerTest + extends PlexusTestCase +{ + public void testCloneProjectModelWithParent() + { + ArchivaProjectModel actualModel = new ArchivaProjectModel(); + actualModel.setGroupId( null ); + actualModel.setArtifactId( "archiva-common" ); + actualModel.setVersion( null ); + actualModel.setParentProject( new VersionedReference() ); + actualModel.getParentProject().setGroupId( "org.apache.maven.archiva" ); + actualModel.getParentProject().setArtifactId( "archiva-parent" ); + actualModel.getParentProject().setVersion( "1.0" ); + + ArchivaProjectModel clonedModel = ArchivaModelCloner.clone( actualModel ); + + // Should not be the same object (in memory) + assertNotSame( clonedModel, actualModel ); + + // Should be equal in value. + assertEquals( clonedModel, actualModel ); + + // Test specific fields. + assertNull( "Group Id", clonedModel.getGroupId() ); + assertNull( "Version", clonedModel.getVersion() ); + assertNotNull( "Parent Reference", clonedModel.getParentProject() ); + assertEquals( "Parent Group Id", "org.apache.maven.archiva", clonedModel.getParentProject().getGroupId() ); + assertEquals( "Parent Artifact Id", "archiva-parent", clonedModel.getParentProject().getArtifactId() ); + assertEquals( "Parent Version", "1.0", clonedModel.getParentProject().getVersion() ); + } +} diff --git a/archiva-base/archiva-repository-layer/pom.xml b/archiva-base/archiva-repository-layer/pom.xml index 6ec87f431..33b2aaee9 100644 --- a/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-base/archiva-repository-layer/pom.xml @@ -43,6 +43,11 @@ archiva-xml-tools 1.0-SNAPSHOT + + org.codehaus.plexus + plexus-expression-evaluator + 1.0-alpha-1 + org.codehaus.plexus plexus-utils diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java index 659a7de67..795c3a2c1 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java @@ -20,7 +20,6 @@ package org.apache.maven.archiva.repository.metadata; */ import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; -import org.apache.maven.archiva.model.RepositoryContent; import org.apache.maven.archiva.xml.XMLException; import org.apache.maven.archiva.xml.XMLReader; @@ -49,13 +48,9 @@ public class RepositoryMetadataReader XMLReader xml = new XMLReader( "metadata", metadataFile ); ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata(); - - RepositoryContent contentKey = new RepositoryContent(); - contentKey.setGroupId( xml.getElementText( "//metadata/groupId" ) ); - contentKey.setArtifactId( xml.getElementText( "//metadata/artifactId" ) ); - metadata.setContentKey( contentKey ); - + metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) ); + metadata.setArtifactId( xml.getElementText( "//metadata/artifactId" ) ); metadata.setLastModified( new Date( metadataFile.lastModified() ) ); metadata.setSize( metadataFile.length() ); metadata.setWhenIndexed( new Date() ); diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelFilter.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelFilter.java new file mode 100644 index 000000000..e00943360 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelFilter.java @@ -0,0 +1,39 @@ +package org.apache.maven.archiva.repository.project; + +/* + * 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 org.apache.maven.archiva.model.ArchivaProjectModel; + +/** + * Generic Filtering interface for {@link ArchivaProjectModel} objects. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public interface ProjectModelFilter +{ + /** + * Filter a model and return the results of the filtering. + * + * @param model the model to filter. + * @return a new model representing the filtered state of the model. + */ + public ArchivaProjectModel filter( final ArchivaProjectModel model ); +} diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java new file mode 100644 index 000000000..ba32cf407 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java @@ -0,0 +1,661 @@ +package org.apache.maven.archiva.repository.project; + +/* + * 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 org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.model.ArchivaModelCloner; +import org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.ArtifactReference; +import org.apache.maven.archiva.model.CiManagement; +import org.apache.maven.archiva.model.Dependency; +import org.apache.maven.archiva.model.Exclusion; +import org.apache.maven.archiva.model.Individual; +import org.apache.maven.archiva.model.IssueManagement; +import org.apache.maven.archiva.model.License; +import org.apache.maven.archiva.model.Organization; +import org.apache.maven.archiva.model.ProjectRepository; +import org.apache.maven.archiva.model.Scm; + +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Map.Entry; + +/** + * ProjectModelMerge + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ProjectModelMerge +{ + /** + * Merge the contents of a project with it's parent project. + * + * @param mainProject the main project. + * @param parentProject the parent project to merge. + * @throws ProjectModelException if there was a problem merging the model. + */ + public static ArchivaProjectModel merge( ArchivaProjectModel mainProject, ArchivaProjectModel parentProject ) + throws ProjectModelException + { + System.out.println( "## Merging: " + mainProject + " with " + parentProject ); + if ( mainProject == null ) + { + throw new ProjectModelException( "Cannot copy a null main project." ); + } + + if ( parentProject == null ) + { + throw new ProjectModelException( "Cannot copy to a null parent project." ); + } + + ArchivaProjectModel merged = new ArchivaProjectModel(); + + // Unmerged. + merged.setArtifactId( mainProject.getArtifactId() ); + merged.setPackaging( StringUtils.defaultIfEmpty( mainProject.getPackaging(), "jar" ) ); + + // Merged + merged.setGroupId( merge( mainProject.getGroupId(), parentProject.getGroupId() ) ); + merged.setVersion( merge( mainProject.getVersion(), parentProject.getVersion() ) ); + merged.setName( merge( mainProject.getName(), parentProject.getName() ) ); + merged.setUrl( merge( mainProject.getUrl(), parentProject.getUrl() ) ); + merged.setDescription( merge( mainProject.getDescription(), parentProject.getDescription() ) ); + + merged.setOrigin( "merged" ); + + merged.setCiManagement( merge( mainProject.getCiManagement(), parentProject.getCiManagement() ) ); + merged.setIndividuals( mergeIndividuals( mainProject.getIndividuals(), parentProject.getIndividuals() ) ); + merged.setIssueManagement( merge( mainProject.getIssueManagement(), parentProject.getIssueManagement() ) ); + merged.setLicenses( mergeLicenses( mainProject.getLicenses(), parentProject.getLicenses() ) ); + merged.setOrganization( merge( mainProject.getOrganization(), parentProject.getOrganization() ) ); + merged.setScm( merge( mainProject.getScm(), parentProject.getScm() ) ); + merged.setRepositories( mergeRepositories( mainProject.getRepositories(), parentProject.getRepositories() ) ); + merged.setDependencies( mergeDependencies( mainProject.getDependencies(), parentProject.getDependencies() ) ); + merged.setDependencyManagement( mergeDependencyManagement( mainProject.getDependencyManagement(), parentProject + .getDependencyManagement() ) ); + merged.setPlugins( mergePlugins( mainProject.getPlugins(), parentProject.getPlugins() ) ); + merged.setReports( mergeReports( mainProject.getReports(), parentProject.getReports() ) ); + merged.setProperties( merge( mainProject.getProperties(), parentProject.getProperties() ) ); + + return merged; + } + + private static Map createArtifactReferenceMap( List artifactReferences ) + { + Map ret = new HashMap(); + + Iterator it = artifactReferences.iterator(); + while ( it.hasNext() ) + { + ArtifactReference artifactReference = (ArtifactReference) it.next(); + String key = toVersionlessArtifactKey( artifactReference ); + ret.put( key, artifactReference ); + } + + return ret; + } + + private static Map createDependencyMap( List dependencies ) + { + Map ret = new HashMap(); + + Iterator it = dependencies.iterator(); + while ( it.hasNext() ) + { + Dependency dep = (Dependency) it.next(); + String key = toVersionlessDependencyKey( dep ); + ret.put( key, dep ); + } + + return ret; + } + + private static Map createExclusionMap( List exclusions ) + { + Map ret = new HashMap(); + + Iterator it = exclusions.iterator(); + while ( it.hasNext() ) + { + Exclusion exclusion = (Exclusion) it.next(); + String key = exclusion.getGroupId() + ":" + exclusion.getArtifactId(); + ret.put( key, exclusion ); + } + + return ret; + } + + private static Map createLicensesMap( List licenses ) + { + Map ret = new HashMap(); + + Iterator it = licenses.iterator(); + while ( it.hasNext() ) + { + License license = (License) it.next(); + // TODO: Change to 'id' when LicenseTypeMapper is created. + String key = license.getName(); + ret.put( key, license ); + } + + return ret; + } + + private static Map createRepositoriesMap( List repositories ) + { + Map ret = new HashMap(); + + Iterator it = repositories.iterator(); + while ( it.hasNext() ) + { + ProjectRepository repo = (ProjectRepository) it.next(); + // Should this really be using repo.id ? + String key = repo.getUrl(); + ret.put( key, repo ); + } + + return ret; + } + + private static boolean empty( String val ) + { + if ( val == null ) + { + return true; + } + + return ( val.trim().length() <= 0 ); + } + + private static ArtifactReference merge( ArtifactReference mainArtifactReference, + ArtifactReference parentArtifactReference ) + { + if ( parentArtifactReference == null ) + { + return mainArtifactReference; + } + + if ( mainArtifactReference == null ) + { + return ArchivaModelCloner.clone( parentArtifactReference ); + } + + ArtifactReference merged = new ArtifactReference(); + + // Unmerged. + merged.setGroupId( mainArtifactReference.getGroupId() ); + merged.setArtifactId( mainArtifactReference.getArtifactId() ); + + // Merged. + merged.setVersion( merge( mainArtifactReference.getVersion(), parentArtifactReference.getVersion() ) ); + merged.setClassifier( merge( mainArtifactReference.getClassifier(), parentArtifactReference.getClassifier() ) ); + merged.setType( merge( mainArtifactReference.getType(), parentArtifactReference.getType() ) ); + + return merged; + } + + private static CiManagement merge( CiManagement mainCim, CiManagement parentCim ) + { + if ( parentCim == null ) + { + return mainCim; + } + + if ( mainCim == null ) + { + return ArchivaModelCloner.clone( parentCim ); + } + + CiManagement merged = new CiManagement(); + + merged.setSystem( merge( mainCim.getSystem(), parentCim.getSystem() ) ); + merged.setUrl( merge( mainCim.getUrl(), parentCim.getUrl() ) ); + + return merged; + } + + private static Dependency merge( Dependency mainDep, Dependency parentDep ) + { + if ( parentDep == null ) + { + return mainDep; + } + + if ( mainDep == null ) + { + return ArchivaModelCloner.clone( parentDep ); + } + + Dependency merged = new Dependency(); + + // Unmerged. + merged.setGroupId( mainDep.getGroupId() ); + merged.setArtifactId( mainDep.getArtifactId() ); + + // Merged. + merged.setVersion( merge( mainDep.getVersion(), parentDep.getVersion() ) ); + merged.setClassifier( merge( mainDep.getClassifier(), parentDep.getClassifier() ) ); + merged.setType( merge( mainDep.getType(), parentDep.getType() ) ); + merged.setScope( merge( mainDep.getScope(), parentDep.getScope() ) ); + if ( parentDep.isOptional() ) + { + merged.setOptional( true ); + } + + merged.setSystemPath( merge( mainDep.getSystemPath(), parentDep.getSystemPath() ) ); + merged.setUrl( merge( mainDep.getUrl(), parentDep.getUrl() ) ); + merged.setExclusions( mergeExclusions( mainDep.getExclusions(), parentDep.getExclusions() ) ); + + return merged; + } + + private static IssueManagement merge( IssueManagement mainIssueManagement, IssueManagement parentIssueManagement ) + { + if ( parentIssueManagement == null ) + { + return mainIssueManagement; + } + + if ( mainIssueManagement == null ) + { + return ArchivaModelCloner.clone( parentIssueManagement ); + } + + IssueManagement merged = new IssueManagement(); + + merged.setSystem( merge( mainIssueManagement.getSystem(), parentIssueManagement.getSystem() ) ); + merged.setUrl( merge( mainIssueManagement.getUrl(), parentIssueManagement.getUrl() ) ); + + return merged; + } + + private static Organization merge( Organization mainOrganization, Organization parentOrganization ) + { + if ( parentOrganization == null ) + { + return mainOrganization; + } + + if ( mainOrganization == null ) + { + return ArchivaModelCloner.clone( parentOrganization ); + } + + Organization merged = new Organization(); + + merged.setFavicon( merge( mainOrganization.getFavicon(), parentOrganization.getFavicon() ) ); + merged.setName( merge( mainOrganization.getName(), parentOrganization.getName() ) ); + merged.setUrl( merge( mainOrganization.getUrl(), parentOrganization.getUrl() ) ); + + return merged; + } + + private static Properties merge( Properties mainProperties, Properties parentProperties ) + { + if ( parentProperties == null ) + { + return mainProperties; + } + + if ( mainProperties == null ) + { + return ArchivaModelCloner.clone( parentProperties ); + } + + Properties merged = new Properties(); + + Enumeration keys = parentProperties.propertyNames(); + while ( keys.hasMoreElements() ) + { + String key = (String) keys.nextElement(); + merged.put( key, merge( mainProperties.getProperty( key ), parentProperties.getProperty( key ) ) ); + } + + return merged; + } + + private static Scm merge( Scm mainScm, Scm parentScm ) + { + if ( parentScm == null ) + { + return mainScm; + } + + if ( mainScm == null ) + { + return ArchivaModelCloner.clone( parentScm ); + } + + Scm merged = new Scm(); + + merged.setConnection( merge( mainScm.getConnection(), parentScm.getConnection() ) ); + merged.setDeveloperConnection( merge( mainScm.getDeveloperConnection(), parentScm.getDeveloperConnection() ) ); + merged.setUrl( merge( mainScm.getUrl(), parentScm.getUrl() ) ); + + return merged; + } + + private static String merge( String main, String parent ) + { + if ( empty( main ) && !empty( parent ) ) + { + return parent; + } + + return main; + } + + private static List mergeArtifactReferences( List mainArtifactReferences, List parentArtifactReferences ) + { + if ( parentArtifactReferences == null ) + { + return mainArtifactReferences; + } + + if ( mainArtifactReferences == null ) + { + return ArchivaModelCloner.cloneLicenses( parentArtifactReferences ); + } + + List merged = new ArrayList(); + + Map mainArtifactReferenceMap = createArtifactReferenceMap( mainArtifactReferences ); + Map parentArtifactReferenceMap = createArtifactReferenceMap( parentArtifactReferences ); + + Iterator it = mainArtifactReferenceMap.entrySet().iterator(); + while ( it.hasNext() ) + { + Map.Entry entry = (Entry) it.next(); + String key = (String) entry.getKey(); + ArtifactReference mainArtifactReference = (ArtifactReference) entry.getValue(); + ArtifactReference parentArtifactReference = (ArtifactReference) parentArtifactReferenceMap.get( key ); + + if ( parentArtifactReference == null ) + { + merged.add( mainArtifactReference ); + } + else + { + // Not merging. Local wins. + merged.add( merge( mainArtifactReference, parentArtifactReference ) ); + } + } + + return merged; + } + + private static List mergeDependencies( List mainDependencies, List parentDependencies ) + { + if ( parentDependencies == null ) + { + return mainDependencies; + } + + if ( mainDependencies == null ) + { + return ArchivaModelCloner.cloneDependencies( parentDependencies ); + } + + List merged = ArchivaModelCloner.cloneDependencies( mainDependencies ); + + Map mainDepMap = createDependencyMap( mainDependencies ); + Map parentDepMap = createDependencyMap( parentDependencies ); + + Iterator it = parentDepMap.entrySet().iterator(); + while ( it.hasNext() ) + { + Map.Entry entry = (Entry) it.next(); + String key = (String) entry.getKey(); + Dependency parentDep = (Dependency) entry.getValue(); + Dependency mainDep = (Dependency) mainDepMap.get( key ); + + if ( parentDep == null ) + { + merged.add( mainDep ); + } + else + { + merged.add( merge( mainDep, parentDep ) ); + } + } + + return merged; + } + + private static List mergeDependencyManagement( List mainDepMgmt, List parentDepMgmt ) + { + if ( parentDepMgmt == null ) + { + return mainDepMgmt; + } + + if ( mainDepMgmt == null ) + { + return ArchivaModelCloner.cloneDependencies( parentDepMgmt ); + } + + List merged = ArchivaModelCloner.cloneDependencies( mainDepMgmt ); + + Map mainDepMap = createDependencyMap( mainDepMgmt ); + Map parentDepMap = createDependencyMap( parentDepMgmt ); + + Iterator it = parentDepMap.entrySet().iterator(); + while ( it.hasNext() ) + { + Map.Entry entry = (Entry) it.next(); + String key = (String) entry.getKey(); + Dependency parentDep = (Dependency) entry.getValue(); + Dependency mainDep = (Dependency) mainDepMap.get( key ); + + if ( parentDep == null ) + { + merged.add( mainDep ); + } + else + { + merged.add( merge( mainDep, parentDep ) ); + } + } + + return merged; + } + + public static List mergeExclusions( List mainExclusions, List parentExclusions ) + { + if ( parentExclusions == null ) + { + return mainExclusions; + } + + if ( mainExclusions == null ) + { + return ArchivaModelCloner.cloneExclusions( parentExclusions ); + } + + List merged = new ArrayList(); + + Map mainExclusionMap = createExclusionMap( mainExclusions ); + Map parentExclusionMap = createExclusionMap( parentExclusions ); + + Iterator it = mainExclusionMap.entrySet().iterator(); + while ( it.hasNext() ) + { + Map.Entry entry = (Entry) it.next(); + String key = (String) entry.getKey(); + Exclusion mainExclusion = (Exclusion) entry.getValue(); + Exclusion parentExclusion = (Exclusion) parentExclusionMap.get( key ); + + if ( parentExclusion == null ) + { + merged.add( mainExclusion ); + } + else + { + merged.add( parentExclusion ); + } + } + + return merged; + } + + private static List mergeIndividuals( List mainIndividuals, List parentIndividuals ) + { + if ( parentIndividuals == null ) + { + return mainIndividuals; + } + + if ( mainIndividuals == null ) + { + return ArchivaModelCloner.cloneIndividuals( parentIndividuals ); + } + + List merged = ArchivaModelCloner.cloneIndividuals( mainIndividuals ); + + Iterator it = parentIndividuals.iterator(); + while ( it.hasNext() ) + { + Individual parentIndividual = (Individual) it.next(); + + if ( !mainIndividuals.contains( parentIndividual ) ) + { + merged.add( parentIndividual ); + } + } + + return merged; + } + + private static List mergeLicenses( List mainLicenses, List parentLicenses ) + { + if ( parentLicenses == null ) + { + return mainLicenses; + } + + if ( mainLicenses == null ) + { + return ArchivaModelCloner.cloneLicenses( parentLicenses ); + } + + List merged = new ArrayList(); + + Map mainLicensesMap = createLicensesMap( mainLicenses ); + Map parentLicensesMap = createLicensesMap( parentLicenses ); + + Iterator it = mainLicensesMap.entrySet().iterator(); + while ( it.hasNext() ) + { + Map.Entry entry = (Entry) it.next(); + String key = (String) entry.getKey(); + License mainLicense = (License) entry.getValue(); + License parentLicense = (License) parentLicensesMap.get( key ); + + if ( parentLicense == null ) + { + merged.add( mainLicense ); + } + else + { + // Not merging. Local wins. + merged.add( parentLicense ); + } + } + + return merged; + } + + private static List mergePlugins( List mainPlugins, List parentPlugins ) + { + return mergeArtifactReferences( mainPlugins, parentPlugins ); + } + + private static List mergeReports( List mainReports, List parentReports ) + { + return mergeArtifactReferences( mainReports, parentReports ); + } + + private static List mergeRepositories( List mainRepositories, List parentRepositories ) + { + if ( parentRepositories == null ) + { + return mainRepositories; + } + + if ( mainRepositories == null ) + { + return ArchivaModelCloner.cloneLicenses( parentRepositories ); + } + + List merged = new ArrayList(); + + Map mainRepositoriesMap = createRepositoriesMap( mainRepositories ); + Map parentRepositoriesMap = createRepositoriesMap( parentRepositories ); + + Iterator it = mainRepositoriesMap.entrySet().iterator(); + while ( it.hasNext() ) + { + Map.Entry entry = (Entry) it.next(); + String key = (String) entry.getKey(); + ProjectRepository mainProjectRepository = (ProjectRepository) entry.getValue(); + ProjectRepository parentProjectRepository = (ProjectRepository) parentRepositoriesMap.get( key ); + + if ( parentProjectRepository == null ) + { + merged.add( mainProjectRepository ); + } + else + { + // Not merging. Local wins. + merged.add( parentProjectRepository ); + } + } + + return merged; + } + + private static String toVersionlessArtifactKey( ArtifactReference artifactReference ) + { + StringBuffer key = new StringBuffer(); + + key.append( artifactReference.getGroupId() ).append( ":" ).append( artifactReference.getArtifactId() ); + key.append( StringUtils.defaultString( artifactReference.getClassifier() ) ).append( ":" ); + key.append( artifactReference.getType() ); + + return key.toString(); + } + + private static String toVersionlessDependencyKey( Dependency dep ) + { + StringBuffer key = new StringBuffer(); + + key.append( dep.getGroupId() ).append( ":" ).append( dep.getArtifactId() ); + key.append( StringUtils.defaultString( dep.getClassifier() ) ).append( ":" ); + key.append( dep.getType() ); + + return key.toString(); + } +} diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMonitor.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMonitor.java new file mode 100644 index 000000000..316f144f2 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMonitor.java @@ -0,0 +1,40 @@ +package org.apache.maven.archiva.repository.project; + +/* + * 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 org.apache.maven.archiva.model.ArchivaProjectModel; + +/** + * ProjectModelMonitor + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public interface ProjectModelMonitor +{ + /** + * Report a problem encountered with a model. + * + * @param model the model that caused the problem. + * @param type the type of problem. + * @param problem the problem description. + */ + public void modelProblem( ArchivaProjectModel model, String type, String problem ); +} \ No newline at end of file diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolver.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolver.java new file mode 100644 index 000000000..de2fc43a8 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolver.java @@ -0,0 +1,42 @@ +package org.apache.maven.archiva.repository.project; + +/* + * 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 org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.VersionedReference; + +/** + * Interface for ProjectModel resolution. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public interface ProjectModelResolver +{ + /** + * Get the ProjectModel given a specific {@link RepositoryContent} key. + * + * @param reference the reference to the other project. + * @return the ArchivaProjectModel representing the provided {@link RepositoryContent} key. + * @throws ProjectModelException if the project model cannot be resolved. + */ + public ArchivaProjectModel resolveProjectModel( VersionedReference reference ) + throws ProjectModelException; +} diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelBuilder.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelBuilder.java new file mode 100644 index 000000000..549c049a0 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelBuilder.java @@ -0,0 +1,269 @@ +package org.apache.maven.archiva.repository.project.filters; + +/* + * 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 org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.model.ArchivaModelCloner; +import org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.Dependency; +import org.apache.maven.archiva.model.VersionedReference; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.apache.maven.archiva.repository.project.ProjectModelMerge; +import org.apache.maven.archiva.repository.project.ProjectModelResolver; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * Builder for the Effective Project Model. + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class EffectiveProjectModelBuilder +{ + private List projectModelResolvers; + + public EffectiveProjectModelBuilder() + { + projectModelResolvers = new ArrayList(); + } + + public void addProjectModelResolver( ProjectModelResolver resolver ) + { + if ( resolver == null ) + { + return; + } + + this.projectModelResolvers.add( resolver ); + } + + /** + * Take the provided {@link ArchivaProjectModel} and build the effective {@link ArchivaProjectModel}. + * + * Steps: + * 1) Expand any expressions / properties. + * 2) Walk the parent project references and merge. + * 3) Apply dependency management settings. + * + * @param project the project to create the effective {@link ArchivaProjectModel} from. + * @return a the effective {@link ArchivaProjectModel}. + * @throws ProjectModelException if there was a problem building the effective pom. + */ + public ArchivaProjectModel buildEffectiveProjectModel( ArchivaProjectModel project ) + throws ProjectModelException + { + if ( project == null ) + { + return null; + } + + if ( this.projectModelResolvers.isEmpty() ) + { + throw new IllegalStateException( "Unable to build effective pom with no project model resolvers defined." ); + } + + // Clone submitted project (so that we don't mess with it) + ArchivaProjectModel effectiveProject = ArchivaModelCloner.clone( project ); + + // Setup Expression Evaluation pieces. + ProjectModelExpressionExpander.evaluateExpressions( effectiveProject ); + + debug( "Starting build of effective with: " + effectiveProject ); + + // Merge in all the parent poms. + effectiveProject = mergeParent( effectiveProject ); + + // Resolve dependency versions from dependency management. + applyDependencyManagement( effectiveProject ); + + // Return what we got. + return effectiveProject; + } + + public void removeResolver( ProjectModelResolver resolver ) + { + this.projectModelResolvers.remove( resolver ); + } + + private void applyDependencyManagement( ArchivaProjectModel pom ) + { + if ( ( pom.getDependencyManagement() == null ) || ( pom.getDependencies() == null ) ) + { + // Nothing to do. All done! + return; + } + + if ( pom.getDependencyManagement().isEmpty() || pom.getDependencies().isEmpty() ) + { + // Nothing to do. All done! + return; + } + + Map managedDependencies = createDependencyMap( pom.getDependencyManagement() ); + Iterator it = pom.getDependencies().iterator(); + while ( it.hasNext() ) + { + Dependency dep = (Dependency) it.next(); + String key = toVersionlessDependencyKey( dep ); + + // Do we need to do anything? + if ( managedDependencies.containsKey( key ) ) + { + Dependency mgmtDep = (Dependency) managedDependencies.get( key ); + + dep.setVersion( mgmtDep.getVersion() ); + dep.setScope( mgmtDep.getScope() ); + dep.setExclusions( ProjectModelMerge.mergeExclusions( dep.getExclusions(), mgmtDep.getExclusions() ) ); + } + } + } + + private void debug( String msg ) + { + System.out.println( "## " + msg ); + } + + private ArchivaProjectModel findProject( VersionedReference projectRef ) + { + debug( "Trying to find project: " + projectRef ); + Iterator it = this.projectModelResolvers.iterator(); + + while ( it.hasNext() ) + { + ProjectModelResolver resolver = (ProjectModelResolver) it.next(); + + try + { + debug( "Trying to find in " + resolver.getClass().getName() ); + ArchivaProjectModel model = resolver.resolveProjectModel( projectRef ); + + if ( model != null ) + { + debug( "Found it!: " + model ); + return model; + } + debug( "Not found." ); + } + catch ( ProjectModelException e ) + { + // TODO: trigger notifier of problem? + e.printStackTrace(); + } + } + + // TODO: Document that project was not found. (Use monitor?) + + return null; + } + + private ArchivaProjectModel mergeParent( ArchivaProjectModel pom ) + throws ProjectModelException + { + ArchivaProjectModel mixedProject; + + debug( "Parent: " + pom.getParentProject() ); + + if ( pom.getParentProject() != null ) + { + // Use parent reference. + VersionedReference parentRef = pom.getParentProject(); + + debug( "Has parent: " + parentRef ); + + // Find parent using resolvers. + ArchivaProjectModel parentProject = findProject( parentRef ); + + if ( parentProject != null ) + { + ProjectModelExpressionExpander.evaluateExpressions( parentProject ); + parentProject = mergeParent( parentProject ); + mixedProject = ProjectModelMerge.merge( pom, parentProject ); + } + else + { + // Shortcircuit due to missing parent pom. + // TODO: Document this via monitor. + mixedProject = mixinSuperPom( pom ); + } + } + else + { + debug( "No parent found" ); + + /* Mix in the super-pom. + * + * Super POM from maven/components contains many things. + * However, for purposes of archiva, only the + * and sections are of any value. + */ + + mixedProject = mixinSuperPom( pom ); + } + + return mixedProject; + } + + /** + * Super POM from maven/components contains many things. + * However, for purposes of archiva, only the + * and sections are of any value. + * + * @param pom + * @return + */ + private ArchivaProjectModel mixinSuperPom( ArchivaProjectModel pom ) + { + // TODO: add super pom repositories. + debug( "Mix in Super POM: " + pom ); + + return pom; + } + + private static Map createDependencyMap( List dependencies ) + { + Map ret = new HashMap(); + + Iterator it = dependencies.iterator(); + while ( it.hasNext() ) + { + Dependency dep = (Dependency) it.next(); + String key = toVersionlessDependencyKey( dep ); + ret.put( key, dep ); + } + + return ret; + } + + private static String toVersionlessDependencyKey( Dependency dep ) + { + StringBuffer key = new StringBuffer(); + + key.append( dep.getGroupId() ).append( ":" ).append( dep.getArtifactId() ); + key.append( StringUtils.defaultString( dep.getClassifier() ) ).append( ":" ); + key.append( dep.getType() ); + + return key.toString(); + } +} diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpander.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpander.java new file mode 100644 index 000000000..764c7302e --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpander.java @@ -0,0 +1,92 @@ +package org.apache.maven.archiva.repository.project.filters; + +/* + * 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 org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.Dependency; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.codehaus.plexus.evaluator.DefaultExpressionEvaluator; +import org.codehaus.plexus.evaluator.EvaluatorException; +import org.codehaus.plexus.evaluator.ExpressionEvaluator; +import org.codehaus.plexus.evaluator.sources.PropertiesExpressionSource; +import org.codehaus.plexus.evaluator.sources.SystemPropertyExpressionSource; + +import java.util.Iterator; +import java.util.List; + +/** + * ProjectModelExpressionExpander + * + * @author Joakim Erdfelt + * @version $Id$ + * @plexus.component role="org.apache.maven.archiva.repository.project.ProjectModelExpressionExpander" + */ +public class ProjectModelExpressionExpander +{ + /** + * Find and Evaluate the Expressions present in the model. + * + * @param model the model to correct. + */ + public static void evaluateExpressions( ArchivaProjectModel model ) + throws ProjectModelException + { + ExpressionEvaluator evaluator = new DefaultExpressionEvaluator(); + + if ( model.getProperties() != null ) + { + PropertiesExpressionSource propsSource = new PropertiesExpressionSource(); + propsSource.setProperties( model.getProperties() ); + evaluator.addExpressionSource( propsSource ); + } + + evaluator.addExpressionSource( new SystemPropertyExpressionSource() ); + + try + { + model.setVersion( evaluator.expand( model.getVersion() ) ); + model.setGroupId( evaluator.expand( model.getGroupId() ) ); + + evaluateExpressionsInDependencyList( evaluator, model.getDependencies() ); + evaluateExpressionsInDependencyList( evaluator, model.getDependencyManagement() ); + } + catch ( EvaluatorException e ) + { + throw new ProjectModelException( "Unable to evaluate expression in model: " + e.getMessage(), e ); + } + } + + private static void evaluateExpressionsInDependencyList( ExpressionEvaluator evaluator, List dependencies ) + throws EvaluatorException + { + if ( dependencies == null ) + { + return; + } + + Iterator it = dependencies.iterator(); + while ( it.hasNext() ) + { + Dependency dependency = (Dependency) it.next(); + dependency.setGroupId( evaluator.expand( dependency.getGroupId() ) ); + dependency.setVersion( evaluator.expand( dependency.getVersion() ) ); + } + } +} diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java similarity index 85% rename from archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java rename to archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java index 1cb9d86e8..b3ad6bbd6 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel300Reader.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java @@ -1,4 +1,4 @@ -package org.apache.maven.archiva.repository.project; +package org.apache.maven.archiva.repository.project.readers; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,6 +20,8 @@ package org.apache.maven.archiva.repository.project; */ import org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.apache.maven.archiva.repository.project.ProjectModelReader; import java.io.File; diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java similarity index 62% rename from archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java rename to archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java index 0e64d11fb..77c28c84f 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModel400Reader.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java @@ -1,4 +1,4 @@ -package org.apache.maven.archiva.repository.project; +package org.apache.maven.archiva.repository.project.readers; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -21,6 +21,7 @@ package org.apache.maven.archiva.repository.project; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.CiManagement; import org.apache.maven.archiva.model.Dependency; import org.apache.maven.archiva.model.DependencyScope; @@ -30,8 +31,10 @@ import org.apache.maven.archiva.model.IssueManagement; import org.apache.maven.archiva.model.License; import org.apache.maven.archiva.model.Organization; import org.apache.maven.archiva.model.ProjectRepository; -import org.apache.maven.archiva.model.RepositoryContent; import org.apache.maven.archiva.model.Scm; +import org.apache.maven.archiva.model.VersionedReference; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.apache.maven.archiva.repository.project.ProjectModelReader; import org.apache.maven.archiva.xml.XMLException; import org.apache.maven.archiva.xml.XMLReader; import org.dom4j.Element; @@ -40,17 +43,20 @@ import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Properties; /** - * ProjectModel400Reader + * ProjectModel400Reader - read in modelVersion 4.0.0 pom files into archiva-model structures. * * @author Joakim Erdfelt * @version $Id$ */ -public class ProjectModel400Reader implements ProjectModelReader +public class ProjectModel400Reader + implements ProjectModelReader { - public ArchivaProjectModel read( File pomFile ) throws ProjectModelException + public ArchivaProjectModel read( File pomFile ) + throws ProjectModelException { try { @@ -58,18 +64,26 @@ public class ProjectModel400Reader implements ProjectModelReader ArchivaProjectModel model = new ArchivaProjectModel(); - RepositoryContent contentKey = new RepositoryContent(); - contentKey.setGroupId( xml.getElementText( "//project/groupId" ) ); - contentKey.setArtifactId( xml.getElementText( "//project/artifactId" ) ); - contentKey.setVersion( xml.getElementText( "//project/version" ) ); - model.setContentKey( contentKey ); + if ( !"http://maven.apache.org/POM/4.0.0".equals( xml.getDefaultNamespaceURI() ) ) + { + // TODO: Output to monitor the problem with the Namespace. + System.out.println( "No namespace defined: " + pomFile ); + } - model.setName( xml.getElementText( "//project/name" ) ); - model.setDescription( xml.getElementText( "//project/description" ) ); - model.setUrl( xml.getElementText( "//project/url" ) ); - model.setPackaging( StringUtils.defaultIfEmpty( xml.getElementText( "//project/packaging" ), "jar" ) ); + xml.removeNamespaces(); - model.setParentContentKey( getParentContentKey( xml ) ); + Element project = xml.getElement( "//project" ); + + model.setGroupId( project.elementTextTrim( "groupId" ) ); + model.setArtifactId( project.elementTextTrim( "artifactId" ) ); + model.setVersion( project.elementTextTrim( "version" ) ); + model.setName( project.elementTextTrim( "name" ) ); + model.setDescription( project.elementTextTrim( "description" ) ); + model.setUrl( project.elementTextTrim( "url" ) ); + + model.setPackaging( StringUtils.defaultIfEmpty( project.elementTextTrim( "packaging" ), "jar" ) ); + + model.setParentProject( getParentProject( xml ) ); model.setCiManagement( getCiManagement( xml ) ); model.setIndividuals( getIndividuals( xml ) ); @@ -80,8 +94,10 @@ public class ProjectModel400Reader implements ProjectModelReader model.setRepositories( getRepositories( xml ) ); model.setDependencies( getDependencies( xml ) ); + model.setDependencyManagement( getDependencyManagement( xml ) ); model.setPlugins( getPlugins( xml ) ); model.setReports( getReports( xml ) ); + model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) ); return model; } @@ -91,7 +107,21 @@ public class ProjectModel400Reader implements ProjectModelReader } } - private CiManagement getCiManagement( XMLReader xml ) throws XMLException + private ArtifactReference getArtifactReference( Element elemPlugin ) + { + ArtifactReference reference = new ArtifactReference(); + + reference.setGroupId( elemPlugin.elementTextTrim( "groupId" ) ); + reference.setArtifactId( elemPlugin.elementTextTrim( "artifactId" ) ); + reference.setVersion( elemPlugin.elementTextTrim( "version" ) ); + reference.setClassifier( elemPlugin.elementTextTrim( "classifier" ) ); + reference.setType( elemPlugin.elementTextTrim( "type" ) ); + + return reference; + } + + private CiManagement getCiManagement( XMLReader xml ) + throws XMLException { Element elemCiMgmt = xml.getElement( "//project/ciManagement" ); if ( elemCiMgmt != null ) @@ -105,22 +135,45 @@ public class ProjectModel400Reader implements ProjectModelReader return null; } - private List getDependencies( XMLReader xml ) throws XMLException + private List getDependencies( XMLReader xml ) + throws XMLException { - List dependencies = new ArrayList(); + return getDependencyList( xml, new String[] { "dependencies" } ); + } - Iterator it = xml.getElementList( "//project/dependencies/dependency" ).iterator(); + private List getDependencyList( XMLReader xml, String parts[] ) + throws XMLException + { + List dependencyList = new ArrayList(); + + Element project = xml.getElement( "//project" ); + + Element depsParent = project; + + for ( int i = 0; i < parts.length; i++ ) + { + String part = parts[i]; + depsParent = depsParent.element( part ); + if ( depsParent == null ) + { + return dependencyList; + } + } + + Iterator it = depsParent.elementIterator( "dependency" ); while ( it.hasNext() ) { Element elemDependency = (Element) it.next(); Dependency dependency = new Dependency(); - dependency.setContentKey( getContentKey( elemDependency ) ); + dependency.setGroupId( elemDependency.elementTextTrim( "groupId" ) ); + dependency.setArtifactId( elemDependency.elementTextTrim( "artifactId" ) ); + dependency.setVersion( elemDependency.elementTextTrim( "version" ) ); dependency.setClassifier( elemDependency.elementTextTrim( "classifier" ) ); dependency.setType( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "type" ), "jar" ) ); dependency.setScope( StringUtils.defaultIfEmpty( elemDependency.elementTextTrim( "scope" ), "compile" ) ); - // Not for v4.0.0 -> dependency.setUrl( elemDependency.elementTextTrim( "url" ) ); + // Not for v4.0.0 -> dependency.setUrl( elemDependency.elementTextTrim("url") ); dependency.setOptional( toBoolean( elemDependency.elementTextTrim( "optional" ), false ) ); if ( DependencyScope.isSystemScoped( dependency ) ) { @@ -129,10 +182,26 @@ public class ProjectModel400Reader implements ProjectModelReader dependency.setExclusions( getExclusions( elemDependency ) ); - dependencies.add( dependency ); + if ( dependencyList.contains( dependency ) ) + { + // TODO: throw into monitor as issue. + System.err.println( "Duplicate non-unique dependency detected [" + StringUtils.join(parts, ":") + "]: " + + toDependencyKey( dependency ) ); + } + + dependencyList.add( dependency ); + System.out.println( "Added (list.size:" + dependencyList.size() + ") dependency: " + + toDependencyKey( dependency ) ); } - return dependencies; + System.out.println( "## Returning dependency list: size=" + dependencyList.size() ); + return dependencyList; + } + + private List getDependencyManagement( XMLReader xml ) + throws XMLException + { + return getDependencyList( xml, new String[] { "dependencyManagement", "dependencies" } ); } private List getExclusions( Element elemDependency ) @@ -159,7 +228,8 @@ public class ProjectModel400Reader implements ProjectModelReader return exclusions; } - private List getIndividuals( XMLReader xml ) throws XMLException + private List getIndividuals( XMLReader xml ) + throws XMLException { List individuals = new ArrayList(); @@ -169,7 +239,8 @@ public class ProjectModel400Reader implements ProjectModelReader return individuals; } - private List getIndividuals( XMLReader xml, boolean isCommitor, String xpathExpr ) throws XMLException + private List getIndividuals( XMLReader xml, boolean isCommitor, String xpathExpr ) + throws XMLException { List ret = new ArrayList(); @@ -203,16 +274,7 @@ public class ProjectModel400Reader implements ProjectModelReader } // Properties - Element elemProperties = elemPerson.element( "properties" ); - if ( elemProperties != null ) - { - Iterator itProps = elemProperties.elements().iterator(); - while ( itProps.hasNext() ) - { - Element elemProp = (Element) itProps.next(); - individual.addProperty( elemProp.getName(), elemProp.getText() ); - } - } + individual.setProperties( getProperties( elemPerson.element( "properties" ) ) ); ret.add( individual ); } @@ -220,7 +282,8 @@ public class ProjectModel400Reader implements ProjectModelReader return ret; } - private IssueManagement getIssueManagement( XMLReader xml ) throws XMLException + private IssueManagement getIssueManagement( XMLReader xml ) + throws XMLException { Element elemIssueMgmt = xml.getElement( "//project/issueManagement" ); if ( elemIssueMgmt != null ) @@ -236,7 +299,8 @@ public class ProjectModel400Reader implements ProjectModelReader return null; } - private List getLicenses( XMLReader xml ) throws XMLException + private List getLicenses( XMLReader xml ) + throws XMLException { List licenses = new ArrayList(); @@ -251,7 +315,7 @@ public class ProjectModel400Reader implements ProjectModelReader License license = new License(); // TODO: Create LicenseIdentity class to managed license ids. - // license.setId( elemLicense.elementTextTrim( "id" ) ); + // license.setId( elemLicense.elementTextTrim("id") ); license.setName( elemLicense.elementTextTrim( "name" ) ); license.setUrl( elemLicense.elementTextTrim( "url" ) ); license.setComments( elemLicense.elementTextTrim( "comments" ) ); @@ -263,7 +327,8 @@ public class ProjectModel400Reader implements ProjectModelReader return licenses; } - private Organization getOrganization( XMLReader xml ) throws XMLException + private Organization getOrganization( XMLReader xml ) + throws XMLException { Element elemOrg = xml.getElement( "//project/organization" ); if ( elemOrg != null ) @@ -279,43 +344,30 @@ public class ProjectModel400Reader implements ProjectModelReader return null; } - private RepositoryContent getParentContentKey( XMLReader xml ) throws XMLException + private VersionedReference getParentProject( XMLReader xml ) + throws XMLException { Element elemParent = xml.getElement( "//project/parent" ); if ( elemParent != null ) { - return getContentKey( elemParent ); + return getVersionedReference( elemParent ); } return null; } - private RepositoryContent getContentKey( Element elem ) - { - RepositoryContent contentKey = new RepositoryContent(); - - contentKey.setGroupId( elem.elementTextTrim( "groupId" ) ); - contentKey.setArtifactId( elem.elementTextTrim( "artifactId" ) ); - contentKey.setVersion( elem.elementTextTrim( "version" ) ); - - return contentKey; - } - - private List getPlugins( XMLReader xml ) throws XMLException + private List getPlugins( XMLReader xml ) + throws XMLException { return getPlugins( xml, "//project/build/plugins/plugin" ); } - private List getReports( XMLReader xml ) throws XMLException - { - return getPlugins( xml, "//project/reporting/plugins/plugin" ); - } - /** * Get List of {@link RepositoryContent} objects from plugin definitions. */ - private List getPlugins( XMLReader xml, String xpathExpr ) throws XMLException + private List getPlugins( XMLReader xml, String xpathExpr ) + throws XMLException { List plugins = new ArrayList(); @@ -324,13 +376,39 @@ public class ProjectModel400Reader implements ProjectModelReader { Element elemPlugin = (Element) it.next(); - plugins.add( getContentKey( elemPlugin ) ); + plugins.add( getArtifactReference( elemPlugin ) ); } return plugins; } - private List getRepositories( XMLReader xml ) throws XMLException + private Properties getProperties( Element elemProperties ) + { + if ( elemProperties == null ) + { + return null; + } + + Properties ret = new Properties(); + + Iterator itProps = elemProperties.elements().iterator(); + while ( itProps.hasNext() ) + { + Element elemProp = (Element) itProps.next(); + ret.setProperty( elemProp.getName(), elemProp.getText() ); + } + + return ret; + } + + private List getReports( XMLReader xml ) + throws XMLException + { + return getPlugins( xml, "//project/reporting/plugins/plugin" ); + } + + private List getRepositories( XMLReader xml ) + throws XMLException { List repos = new ArrayList(); @@ -340,7 +418,8 @@ public class ProjectModel400Reader implements ProjectModelReader return repos; } - private List getRepositories( XMLReader xml, boolean isPluginRepo, String xpathExpr ) throws XMLException + private List getRepositories( XMLReader xml, boolean isPluginRepo, String xpathExpr ) + throws XMLException { List ret = new ArrayList(); @@ -359,7 +438,7 @@ public class ProjectModel400Reader implements ProjectModelReader repo.setPlugins( isPluginRepo ); repo.setReleases( toBoolean( xml.getElementText( elemRepo, "releases/enabled" ), true ) ); - repo.setReleases( toBoolean( xml.getElementText( elemRepo, "snapshots/enabled" ), false ) ); + repo.setSnapshots( toBoolean( xml.getElementText( elemRepo, "snapshots/enabled" ), false ) ); ret.add( repo ); } @@ -367,7 +446,8 @@ public class ProjectModel400Reader implements ProjectModelReader return ret; } - private Scm getSCM( XMLReader xml ) throws XMLException + private Scm getSCM( XMLReader xml ) + throws XMLException { Element elemScm = xml.getElement( "//project/scm" ); @@ -385,6 +465,17 @@ public class ProjectModel400Reader implements ProjectModelReader return null; } + private VersionedReference getVersionedReference( Element elem ) + { + VersionedReference reference = new VersionedReference(); + + reference.setGroupId( elem.elementTextTrim( "groupId" ) ); + reference.setArtifactId( elem.elementTextTrim( "artifactId" ) ); + reference.setVersion( elem.elementTextTrim( "version" ) ); + + return reference; + } + private boolean toBoolean( String value, boolean defaultValue ) { if ( StringUtils.equalsIgnoreCase( value, "true" ) ) @@ -402,4 +493,10 @@ public class ProjectModel400Reader implements ProjectModelReader } } + private String toDependencyKey( Dependency dep ) + { + return "[" + dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getVersion() + ":" + dep.getClassifier() + + ":" + dep.getType() + "]"; + } + } diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java new file mode 100644 index 000000000..d33d74102 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java @@ -0,0 +1,69 @@ +package org.apache.maven.archiva.repository.project.resolvers; + +/* + * 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 org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.model.VersionedReference; +import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; +import org.apache.maven.archiva.repository.layout.DefaultBidirectionalRepositoryLayout; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.apache.maven.archiva.repository.project.ProjectModelReader; +import org.apache.maven.archiva.repository.project.ProjectModelResolver; +import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; + +import java.io.File; + +/** + * RepositoryProjectResolver + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class RepositoryProjectResolver + implements ProjectModelResolver +{ + private ArchivaRepository repository; + + private ProjectModelReader reader; + + private BidirectionalRepositoryLayout layout; + + public RepositoryProjectResolver( ArchivaRepository repository ) + { + this.repository = repository; + this.reader = new ProjectModel400Reader(); + this.layout = new DefaultBidirectionalRepositoryLayout(); + } + + public ArchivaProjectModel resolveProjectModel( VersionedReference reference ) + throws ProjectModelException + { + ArchivaArtifact artifact = new ArchivaArtifact( reference.getGroupId(), reference.getArtifactId(), reference + .getVersion(), "", "pom" ); + + String path = layout.pathOf( artifact ); + File repoFile = new File( this.repository.getUrl().getPath(), path ); + + return reader.read( repoFile ); + } + +} diff --git a/archiva-base/archiva-repository-layer/src/test/effective-poms/archiva-model-effective.pom b/archiva-base/archiva-repository-layer/src/test/effective-poms/archiva-model-effective.pom new file mode 100644 index 000000000..9129a9db4 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/effective-poms/archiva-model-effective.pom @@ -0,0 +1,794 @@ + + + + archiva-base + org.apache.maven.archiva + 1.0-SNAPSHOT + + 4.0.0 + org.apache.maven.archiva + archiva-model + Archiva Base :: Model + 1.0-SNAPSHOT + Archiva is an application for managing one or more remote repositories, including + administration, artifact handling, + browsing and searching. + http://maven.apache.org/archiva/archiva-base/archiva-model + + jira + http://jira.codehaus.org/browse/MRM + + + continuum + http://maven.zones.apache.org:8080/continuum + + + +
notifications@maven.apache.org
+
+
+
+
+ 2002 + + + Maven Archiva User List + archiva-users-subscribe@maven.apache.org + archiva-users-unsubscribe@maven.apache.org + archiva-users@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-users + + + Maven Archiva Developer List + archiva-dev-subscribe@maven.apache.org + archiva-dev-unsubscribe@maven.apache.org + archiva-dev@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-dev + + + Maven Archiva Commits List + archiva-commits-subscribe@maven.apache.org + archiva-commits-unsubscribe@maven.apache.org + archiva-commits@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-commits + + + + + jvanzyl + Jason van Zyl + jason@maven.org + ASF + + PMC Chair + + -5 + + + brett + Brett Porter + brett@apache.org + ASF + + PMC Member + + +10 + + + evenisse + Emmanuel Venisse + evenisse@apache.org + ASF + + PMC Member + + +1 + + + kenney + Kenney Westerhof + kenney@apache.org + Neonics + + PMC Member + + + + snicoll + Stephane Nicoll + snicoll@apache.org + ASF + + PMC Member + + +1 + + + vmassol + Vincent Massol + vmassol@apache.org + ASF + + PMC Member + + +1 + + + fgiust + Fabrizio Giustina + fgiust@apache.org + openmind + + PMC Member + + +1 + + + epunzalan + Edwin Punzalan + epunzalan@mergere.com + Mergere + + Committer + + +8 + + + mperham + Mike Perham + mperham@gmail.com + IBM + + PMC Member + + -6 + + + jdcasey + John Casey + jdcasey@apache.org + ASF + + PMC Member + + -5 + + + trygvis + Trygve Laugstol + trygvis@apache.org + ASF + + PMC Member + + +1 + + + vsiveton + Vincent Siveton + vsiveton@apache.org + ASF + + PMC Member + + -5 + + + carlos + Carlos Sanchez + carlos@apache.org + ASF + + PMC Member + + +1 + + + dennisl + Dennis Lundberg + dennisl@apache.org + ASF + + PMC Member + + +1 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + scm:svn:http://svn.apache.org/repos/asf/maven/archiva/trunk/archiva-base/archiva-model + scm:svn:https://svn.apache.org/repos/asf/maven/archiva/trunk/archiva-base/archiva-model + http://svn.apache.org/viewcvs.cgi/maven/archiva/trunk/archiva-base/archiva-model + + + Apache Software Foundation + http://www.apache.org/ + + + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java + src/main/scripts + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/test/java + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/target/classes + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/target/test-classes + + + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/resources + + + + + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/test/resources + + + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/target + archiva-model-1.0-SNAPSHOT + + + + maven-idea-plugin + + 1.4 + + + + maven-release-plugin + + https://svn.apache.org/repos/asf/maven/archiva/tags + + + + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.3 + + + generate + + descriptor + + + + + + maven-compiler-plugin + + 1.4 + 1.4 + + + + maven-surefire-plugin + 2.2 + + + org.codehaus.modello + modello-maven-plugin + 1.0-alpha-15-SNAPSHOT + + + archiva-base + + java + xsd + jpox-jdo-mapping + jpox-metadata-class + + + + + 1.0.0 + false + src/main/mdo/archiva-base.xml + + + + org.codehaus.mojo + jpox-maven-plugin + 1.1.6 + + + create-ddl + generate-test-resources + + schema-create + + + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/target/classes/org/apache/maven/archiva/model/schema.ddl + + + javax.jdo.option.ConnectionDriverName + org.apache.derby.jdbc.EmbeddedDriver + + + javax.jdo.option.ConnectionURL + jdbc:derby:target/jdo-schema-create;create=true + + + javax.jdo.option.ConnectionUserName + sa + + + javax.jdo.option.ConnectionPassword + + + + log4j.configuration + /home/joakim/code/maven/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/test/resources/log4j.xml + + + org.jpox.autoCreateTables + true + + + + + + enhance + + enhance + + + + + + org.apache.derby + derby + 10.2.1.6 + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + org/apache/maven/archiva/reporting/model/** + + + + + + maven-help-plugin + 2.0.1 + + + + + + + + false + + codehaus.org + http://repository.codehaus.org + + + + false + + + snapshots.codehaus.org + http://snapshots.repository.codehaus.org + + + + false + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + + + false + + central + Maven Repository Switchboard + http://repo1.maven.org/maven2 + + + + + + false + + + snapshots.codehaus.org + http://snapshots.repository.codehaus.org + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + junit + junit + 3.8.1 + test + + + org.apache.maven.archiva + archiva-common + 1.0-SNAPSHOT + + + org.codehaus.plexus + plexus-utils + 1.4 + + + javax.jdo + jdo2-api + 2.0 + + + org.codehaus.plexus + plexus-container-default + 1.0-alpha-18 + + + commons-lang + commons-lang + 2.2 + + + commons-io + commons-io + 1.2 + + + + target/site + + + maven-checkstyle-plugin + + config/maven_checks.xml + + + + maven-javadoc-plugin + + 1.4 + true + + + + maven-jxr-plugin + + true + + + + maven-pmd-plugin + + + maven-surefire-report-plugin + + + org.codehaus.mojo + changelog-maven-plugin + + + org.codehaus.mojo + cobertura-maven-plugin + + + org.codehaus.mojo + taglist-maven-plugin + + + + + + + org.apache.maven.shared + maven-app-configuration-model + 1.0-SNAPSHOT + + + org.apache.maven.shared + maven-app-configuration-web + 1.0-SNAPSHOT + + + org.codehaus.plexus + plexus-container-default + 1.0-alpha-18 + + + org.codehaus.plexus + plexus-component-api + 1.0-alpha-18 + + + org.codehaus.plexus + plexus-utils + 1.4 + + + org.slf4j + slf4j-log4j12 + 1.2 + + + org.apache.maven + maven-repository-metadata + 2.0.5 + + + org.apache.maven + maven-model + 2.0.5 + + + org.apache.maven + maven-artifact + 2.0.5 + + + org.apache.maven + maven-artifact-manager + 2.0.5 + + + org.apache.maven + maven-project + 2.0.5 + + + org.apache.maven.shared + maven-model-converter + 2.0.5-SNAPSHOT + + + org.apache.maven.wagon + wagon-provider-api + 1.0-beta-2 + + + org.apache.maven.wagon + wagon-ssh + 1.0-beta-2 + + + org.apache.maven.wagon + wagon-file + 1.0-beta-2 + + + org.apache.maven.wagon + wagon-http-lightweight + 1.0-beta-2 + + + org.apache.maven.archiva + archiva-common + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-core + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-reports-standard + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-model + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-database + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-consumer-api + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-model + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-database + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-discoverer + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-repository-layer + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-indexer + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-proxy + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-applet + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-security + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-configuration + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-converter + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-utils + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-webapp + 1.0-SNAPSHOT + war + + + org.codehaus.plexus + plexus-digest + 1.1-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-rbac-profile + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-system + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-system + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-ui-web + 1.0-alpha-11-SNAPSHOT + war + + + org.codehaus.plexus.security + plexus-security-ui-web-integration + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-ui-web-taglib + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-authentication-provider-user-manager + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-authentication-provider-keystore + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-user-management-api + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-user-management-provider-jdo + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-store-cached + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-store-jdo + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-authorization-api + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-authorizer + 1.0-alpha-11-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-keys-jdo + 1.0-alpha-11-SNAPSHOT + + + commons-lang + commons-lang + 2.2 + + + commons-io + commons-io + 1.2 + + + org.apache.derby + derby + 10.1.3.1 + + + + + + apache.releases + Apache Release Distribution Repository + scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository + + + apache.snapshots + Apache Development Snapshot Repository + scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository + + + apache.website + scpexe://people.apache.org/www/maven.apache.org/archiva/archiva-base/archiva-model + + + + 1.0-alpha-11-SNAPSHOT + 1.0-beta-2 + 2.0.5 + 1.0-SNAPSHOT + +
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReaderTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReaderTest.java index 5b6af02a8..676872b2d 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReaderTest.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReaderTest.java @@ -42,8 +42,8 @@ public class RepositoryMetadataReaderTest extends PlexusTestCase ArchivaRepositoryMetadata metadata = reader.read( metadataFile ); assertNotNull( metadata ); - assertEquals( "Group Id", "org.apache.maven.shared", metadata.getContentKey().getGroupId() ); - assertEquals( "Artifact Id", "maven-downloader", metadata.getContentKey().getArtifactId() ); + assertEquals( "Group Id", "org.apache.maven.shared", metadata.getGroupId() ); + assertEquals( "Artifact Id", "maven-downloader", metadata.getArtifactId() ); assertEquals( "Released Version", "1.1", metadata.getReleasedVersion() ); assertEquals( "List of Available Versions", 2, metadata.getAvailableVersions().size() ); assertTrue( "Available version 1.0", metadata.getAvailableVersions().contains( "1.0" ) ); diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/AllTests.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/AllTests.java index a9646e935..7ff3c1ccf 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/AllTests.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/AllTests.java @@ -35,7 +35,8 @@ public class AllTests { TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.repository.project" ); //$JUnit-BEGIN$ - suite.addTestSuite( ProjectModel400ReaderTest.class ); + suite.addTest( org.apache.maven.archiva.repository.project.filters.AllTests.suite() ); + suite.addTest( org.apache.maven.archiva.repository.project.readers.AllTests.suite() ); //$JUnit-END$ return suite; } diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/ProjectModel400ReaderTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/ProjectModel400ReaderTest.java deleted file mode 100644 index a413ed2a1..000000000 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/ProjectModel400ReaderTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.apache.maven.archiva.repository.project; - -/* - * 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 org.apache.maven.archiva.model.ArchivaProjectModel; -import org.codehaus.plexus.PlexusTestCase; - -import java.io.File; - -/** - * ProjectModel400ReaderTest - * - * @author Joakim Erdfelt - * @version $Id$ - */ -public class ProjectModel400ReaderTest extends PlexusTestCase -{ - public void testLoadSimple() throws ProjectModelException - { - File defaultRepoDir = new File( getBasedir(), "src/test/repositories/default-repository" ); - File pomFile = new File( defaultRepoDir, "org/apache/maven/shared/maven-downloader/1.0/maven-downloader-1.0.pom" ); - - ProjectModelReader reader = new ProjectModel400Reader(); - - ArchivaProjectModel project = reader.read( pomFile ); - - assertNotNull( project ); - assertEquals( "Group Id", "org.apache.maven.shared", project.getContentKey().getGroupId() ); - assertEquals( "Artifact Id", "maven-downloader", project.getContentKey().getArtifactId() ); - assertEquals( "Released Version", "1.0", project.getContentKey().getVersion() ); - assertEquals( "Name", "Maven Downloader", project.getName() ); - assertEquals( "Description", "Provide a super simple interface for downloading a single artifact.", project.getDescription() ); -// assertTrue( "Available version 1.0", project.getAvailableVersions().contains( "1.0" ) ); -// assertTrue( "Available version 1.1", project.getAvailableVersions().contains( "1.1" ) ); - } -} diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/AllTests.java similarity index 59% rename from archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java rename to archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/AllTests.java index bbb5610bd..a4bf59f96 100644 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/AllTests.java @@ -1,6 +1,4 @@ -package org.apache.maven.archiva.consumers; - -import org.apache.maven.archiva.repository.consumer.ConsumerFactory; +package org.apache.maven.archiva.repository.project.filters; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -21,33 +19,26 @@ import org.apache.maven.archiva.repository.consumer.ConsumerFactory; * under the License. */ +import junit.framework.Test; +import junit.framework.TestSuite; /** - * AbstractGenericConsumerTestCase + * AllTests * * @author Joakim Erdfelt * @version $Id$ */ -public abstract class AbstractGenericConsumerTestCase - extends AbstractConsumerTestCase +public class AllTests { - protected ConsumerFactory consumerFactory; - protected void setUp() - throws Exception + public static Test suite() { - super.setUp(); - - consumerFactory = (ConsumerFactory) lookup( ConsumerFactory.ROLE ); + TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.repository.project.filters" ); + //$JUnit-BEGIN$ + suite.addTestSuite( ProjectModelExpressionExpanderTest.class ); + suite.addTestSuite( EffectiveProjectModelBuilderTest.class ); + //$JUnit-END$ + return suite; } - protected void tearDown() - throws Exception - { - if ( consumerFactory != null ) - { - release( consumerFactory ); - } - super.tearDown(); - } } diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelBuilderTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelBuilderTest.java new file mode 100644 index 000000000..fd82b345a --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelBuilderTest.java @@ -0,0 +1,143 @@ +package org.apache.maven.archiva.repository.project.filters; + +/* + * 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 org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.model.Dependency; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.apache.maven.archiva.repository.project.ProjectModelReader; +import org.apache.maven.archiva.repository.project.ProjectModelResolver; +import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelBuilder; +import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; +import org.apache.maven.archiva.repository.project.resolvers.RepositoryProjectResolver; +import org.codehaus.plexus.PlexusTestCase; + +import java.io.File; +import java.util.Iterator; +import java.util.List; + +/** + * EffectiveProjectModelBuilderTest + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class EffectiveProjectModelBuilderTest + extends PlexusTestCase +{ + private static final String DEFAULT_REPOSITORY = "src/test/repositories/default-repository"; + + private ArchivaProjectModel createArchivaProjectModel( String path ) + throws ProjectModelException + { + ProjectModelReader reader = new ProjectModel400Reader(); + + File pomFile = new File( getBasedir(), path ); + + return reader.read( pomFile ); + } + + private ProjectModelResolver createDefaultRepositoryResolver() + { + File defaultRepoDir = new File( getBasedir(), DEFAULT_REPOSITORY ); + + ArchivaRepository repo = new ArchivaRepository( "defaultTestRepo", "Default Test Repo", "file://" + + defaultRepoDir.getAbsolutePath() ); + + RepositoryProjectResolver resolver = new RepositoryProjectResolver( repo ); + + return resolver; + } + + public void testBuildEffectiveProject() + throws Exception + { + EffectiveProjectModelBuilder builder = new EffectiveProjectModelBuilder(); + builder.addProjectModelResolver( createDefaultRepositoryResolver() ); + + ArchivaProjectModel startModel = createArchivaProjectModel( DEFAULT_REPOSITORY + + "/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom" ); + + ArchivaProjectModel effectiveModel = builder.buildEffectiveProjectModel( startModel ); + + ArchivaProjectModel expectedModel = createArchivaProjectModel( "src/test/effective-poms/" + + "/archiva-model-effective.pom" ); + + assertModel( expectedModel, effectiveModel ); + } + + private void assertModel( ArchivaProjectModel expectedModel, ArchivaProjectModel effectiveModel ) + { + assertEquals( "Equivalent Models", expectedModel, effectiveModel ); + + assertContainsSame( "Individuals", expectedModel.getIndividuals(), effectiveModel.getIndividuals() ); + dumpDependencyList( "Expected", expectedModel.getDependencies() ); + dumpDependencyList( "Effective", effectiveModel.getDependencies() ); + assertContainsSame( "Dependencies", expectedModel.getDependencies(), effectiveModel.getDependencies() ); + assertContainsSame( "DependencyManagement", expectedModel.getDependencyManagement(), effectiveModel + .getDependencyManagement() ); + } + + private void dumpDependencyList( String type, List deps ) + { + System.out.println( ".\\ [" + type + "] Dependency List (size:" + deps.size() + ") \\.________________" ); + Iterator it = deps.iterator(); + while ( it.hasNext() ) + { + Dependency dep = (Dependency) it.next(); + System.out.println( " " + toDependencyKey( dep ) ); + } + System.out.println( "" ); + } + + private String toDependencyKey( Dependency dep ) + { + return "[" + dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getVersion() + ":" + dep.getClassifier() + + ":" + dep.getType() + "]"; + } + + private void assertContainsSame( String listId, List expectedList, List effectiveList ) + { + if ( ( expectedList == null ) && ( effectiveList == null ) ) + { + return; + } + + if ( ( expectedList == null ) && ( effectiveList != null ) ) + { + fail( "Effective [" + listId + "] List is instantiated, while expected List is null." ); + } + + if ( ( expectedList != null ) && ( effectiveList == null ) ) + { + fail( "Effective [" + listId + "] List is null, while expected List is instantiated." ); + } + + assertEquals( "[" + listId + "] List Size", expectedList.size(), expectedList.size() ); + + Iterator it = expectedList.iterator(); + while ( it.hasNext() ) + { + Object o = it.next(); + assertTrue( "Should exist in Effective [" + listId + "] list: " + o, effectiveList.contains( o ) ); + } + } +} diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java new file mode 100644 index 000000000..ed06ac95a --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionExpanderTest.java @@ -0,0 +1,84 @@ +package org.apache.maven.archiva.repository.project.filters; + +/* + * 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 org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.Dependency; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.apache.maven.archiva.repository.project.filters.ProjectModelExpressionExpander; + +import java.util.Iterator; + +import junit.framework.TestCase; + +/** + * ProjectModelExpressionExpanderTest + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ProjectModelExpressionExpanderTest + extends TestCase +{ + public void testExpressionEvaluation() + throws ProjectModelException + { + ArchivaProjectModel model = new ArchivaProjectModel(); + model.setGroupId( "org.apache.maven.archiva" ); + model.setArtifactId( "archiva-test-project" ); + model.setVersion( "1.0-SNAPSHOT" ); + + model.addDependency( createDependency( "org.apache.maven.archiva", "archiva-model", "${archiva.version}" ) ); + model.addDependency( createDependency( "org.apache.maven.archiva", "archiva-common", "${archiva.version}" ) ); + model.addDependency( createDependency( "org.apache.maven.archiva", "archiva-indexer", "${archiva.version}" ) ); + + model.addProperty( "archiva.version", "1.0-SNAPSHOT" ); + + ProjectModelExpressionExpander.evaluateExpressions( model ); + + assertNotNull( model ); + assertEquals( "Group ID", "org.apache.maven.archiva", model.getGroupId() ); + assertEquals( "Artifact ID", "archiva-test-project", model.getArtifactId() ); + assertEquals( "Version", "1.0-SNAPSHOT", model.getVersion() ); + assertNotNull( "Dependencies", model.getDependencies() ); + assertEquals( "Dependencies Size", 3, model.getDependencies().size() ); + + Iterator it = model.getDependencies().iterator(); + while ( it.hasNext() ) + { + Dependency dep = (Dependency) it.next(); + assertEquals( "Dependency [" + dep.getArtifactId() + "] Group ID", "org.apache.maven.archiva", dep + .getGroupId() ); + assertEquals( "Dependency [" + dep.getArtifactId() + "] Version", "1.0-SNAPSHOT", dep.getVersion() ); + } + } + + private Dependency createDependency( String groupId, String artifactId, String version ) + { + Dependency dep = new Dependency(); + + dep.setGroupId( groupId ); + dep.setArtifactId( artifactId ); + dep.setVersion( version ); + + return dep; + } + +} diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AllTests.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/AllTests.java similarity index 87% rename from archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AllTests.java rename to archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/AllTests.java index 783fb8547..0c55a71c7 100644 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AllTests.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/AllTests.java @@ -1,4 +1,4 @@ -package org.apache.maven.archiva.consumers; +package org.apache.maven.archiva.repository.project.readers; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -33,9 +33,9 @@ public class AllTests public static Test suite() { - TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.common.consumers" ); + TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.repository.project.readers" ); //$JUnit-BEGIN$ - suite.addTestSuite( GenericArtifactConsumerTest.class ); + suite.addTestSuite( ProjectModel400ReaderTest.class ); //$JUnit-END$ return suite; } diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java new file mode 100644 index 000000000..3735ea766 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java @@ -0,0 +1,98 @@ +package org.apache.maven.archiva.repository.project.readers; + +/* + * 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 org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.VersionedReference; +import org.apache.maven.archiva.repository.project.ProjectModelException; +import org.apache.maven.archiva.repository.project.ProjectModelReader; +import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; +import org.codehaus.plexus.PlexusTestCase; + +import java.io.File; + +/** + * ProjectModel400ReaderTest + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ProjectModel400ReaderTest + extends PlexusTestCase +{ + public void testLoadSimple() + throws ProjectModelException + { + File defaultRepoDir = new File( getBasedir(), "src/test/repositories/default-repository" ); + File pomFile = new File( defaultRepoDir, + "org/apache/maven/shared/maven-downloader/1.0/maven-downloader-1.0.pom" ); + + ProjectModelReader reader = new ProjectModel400Reader(); + + ArchivaProjectModel project = reader.read( pomFile ); + + assertNotNull( project ); + assertEquals( "Group Id", "org.apache.maven.shared", project.getGroupId() ); + assertEquals( "Artifact Id", "maven-downloader", project.getArtifactId() ); + assertEquals( "Version", "1.0", project.getVersion() ); + assertEquals( "Name", "Maven Downloader", project.getName() ); + assertEquals( "Description", "Provide a super simple interface for downloading a single artifact.", project + .getDescription() ); + + // Test for parent + VersionedReference parentRef = project.getParentProject(); + assertNotNull( "Parent Reference", parentRef ); + assertEquals( "Parent Group ID", "org.apache.maven.shared", parentRef.getGroupId() ); + assertEquals( "Parent Artifact ID", "maven-shared-components", parentRef.getArtifactId() ); + assertEquals( "Parent Version", "4", parentRef.getVersion() ); + + assertNotNull( "Dependencies", project.getDependencies() ); + assertEquals( "Dependencies.size", 3, project.getDependencies().size() ); + } + + public void testLoadWithNamespace() + throws ProjectModelException + { + File defaultRepoDir = new File( getBasedir(), "src/test/repositories/default-repository" ); + File pomFile = new File( defaultRepoDir, + "org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom" ); + + ProjectModelReader reader = new ProjectModel400Reader(); + + ArchivaProjectModel project = reader.read( pomFile ); + + assertNotNull( project ); + assertEquals( "Group Id", null, project.getGroupId() ); + assertEquals( "Artifact Id", "archiva-model", project.getArtifactId() ); + assertEquals( "Version", null, project.getVersion() ); + assertEquals( "Name", "Archiva Base :: Model", project.getName() ); + assertEquals( "Description", null, project.getDescription() ); + + // Test for parent + VersionedReference parentRef = project.getParentProject(); + assertNotNull( "Parent Reference", parentRef ); + assertEquals( "Parent Group ID", "org.apache.maven.archiva", parentRef.getGroupId() ); + assertEquals( "Parent Artifact ID", "archiva-base", parentRef.getArtifactId() ); + assertEquals( "Parent Version", "1.0-SNAPSHOT", parentRef.getVersion() ); + + assertNotNull( "Dependencies", project.getDependencies() ); + assertEquals( "Dependencies.size", 6, project.getDependencies().size() ); + } +} diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/CentralScannerTiming.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/CentralScannerTiming.java deleted file mode 100644 index 1472313e1..000000000 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/CentralScannerTiming.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.apache.maven.archiva.repository.scanner; - -/* - * 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 org.apache.maven.archiva.common.utils.DateUtil; -import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; -import org.apache.maven.archiva.consumers.ConsumerException; -import org.apache.maven.archiva.consumers.RepositoryContentConsumer; -import org.apache.maven.archiva.model.ArchivaProjectModel; -import org.apache.maven.archiva.model.ArchivaRepository; -import org.apache.maven.archiva.model.RepositoryContentStatistics; -import org.apache.maven.archiva.repository.RepositoryException; -import org.apache.maven.archiva.repository.project.ProjectModel400Reader; -import org.apache.maven.archiva.repository.project.ProjectModelException; -import org.apache.maven.archiva.repository.project.ProjectModelReader; - -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * CentralScannerTiming - * - * @author Joakim Erdfelt - * @version $Id$ - */ -public class CentralScannerTiming -{ - public static void main( String[] args ) - { - String pathToCentral = "/home/repo1/ibiblio"; - - ( new CentralScannerTiming() ).scanIt( pathToCentral ); - } - - public void scanIt( String path ) - { - ArchivaRepository centralRepo = new ArchivaRepository( "central", "Central Mirror", "file://" + path ); - - List consumerList = new ArrayList(); - - // Basic - find the artifacts (no real processing) - - consumerList.add( new BasicConsumer() ); - timeIt( "Basic Scan", centralRepo, consumerList ); - - // POM - find the poms and read them. - - consumerList.clear(); - consumerList.add( new POMConsumer() ); - timeIt( "POM Read", centralRepo, consumerList ); - } - - private void timeIt( String type, ArchivaRepository repo, List consumerList ) - { - RepositoryScanner scanner = new RepositoryScanner(); - - try - { - RepositoryContentStatistics stats = scanner.scan( repo, consumerList, true ); - - SimpleDateFormat df = new SimpleDateFormat(); - System.out.println( ".\\ " + type + " \\.__________________________________________" ); - System.out.println( " Repository ID : " + stats.getRepositoryId() ); - System.out.println( " Duration : " + DateUtil.getDuration( stats.getDuration() ) ); - System.out.println( " When Gathered : " + df.format( stats.getWhenGathered() ) ); - System.out.println( " Total File Count: " + stats.getTotalFileCount() ); - System.out.println( " New File Count : " + stats.getNewFileCount() ); - System.out.println( "______________________________________________________________" ); - } - catch ( RepositoryException e ) - { - e.printStackTrace( System.err ); - } - } - - class POMConsumer extends AbstractMonitoredConsumer implements RepositoryContentConsumer - { - private int count = 0; - - private ProjectModelReader reader; - - private ArchivaRepository repo; - - public POMConsumer() - { - reader = new ProjectModel400Reader(); - } - - public List getExcludes() - { - return Collections.EMPTY_LIST; - } - - public List getIncludes() - { - List includes = new ArrayList(); - includes.add( "**/*.pom" ); - return includes; - } - - public String getId() - { - return "pom-consumer"; - } - - public String getDescription() - { - return "Basic POM Consumer"; - } - - public boolean isPermanent() - { - return false; - } - - public void beginScan( ArchivaRepository repository ) throws ConsumerException - { - repo = repository; - } - - public void processFile( String path ) throws ConsumerException - { - count++; - if ( ( count % 1000 ) == 0 ) - { - System.out.println( "Files Processed: " + count ); - } - - File pomFile = new File( repo.getUrl().getPath(), path ); - try - { - ArchivaProjectModel model = reader.read( pomFile ); - } - catch ( ProjectModelException e ) - { - System.err.println( "Unable to process: " + pomFile ); - e.printStackTrace( System.out ); - } - } - - public void completeScan() - { - /* do nothing */ - } - } - - class BasicConsumer extends AbstractMonitoredConsumer implements RepositoryContentConsumer - { - int count = 0; - - public List getExcludes() - { - return Collections.EMPTY_LIST; - } - - public List getIncludes() - { - List includes = new ArrayList(); - includes.add( "**/*.pom" ); - includes.add( "**/*.jar" ); - includes.add( "**/*.war" ); - includes.add( "**/*.ear" ); - includes.add( "**/*.sar" ); - includes.add( "**/*.car" ); - includes.add( "**/*.mar" ); - // includes.add( "**/*.sha1" ); - // includes.add( "**/*.md5" ); - // includes.add( "**/*.asc" ); - includes.add( "**/*.dtd" ); - includes.add( "**/*.tld" ); - includes.add( "**/*.gz" ); - includes.add( "**/*.bz2" ); - includes.add( "**/*.zip" ); - return includes; - } - - public String getId() - { - return "test-scan-timing"; - } - - public String getDescription() - { - return "Basic No-op Consumer"; - } - - public boolean isPermanent() - { - return false; - } - - public void beginScan( ArchivaRepository repository ) throws ConsumerException - { - /* do nothing */ - } - - public void processFile( String path ) throws ConsumerException - { - count++; - if ( ( count % 1000 ) == 0 ) - { - System.out.println( "Files Processed: " + count ); - } - } - - public void completeScan() - { - /* do nothing */ - } - } -} diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-applet/1.0-SNAPSHOT/archiva-applet-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-applet/1.0-SNAPSHOT/archiva-applet-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..d48ebf7a8 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-applet/1.0-SNAPSHOT/archiva-applet-1.0-SNAPSHOT.pom @@ -0,0 +1,69 @@ + + + + + 4.0.0 + + org.apache.maven.archiva + archiva + 1.0-SNAPSHOT + + archiva-applet + Archiva Applet + + Applet for performing local operations on files such as creating a checksum of an artifact + before uploading it. + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.1 + + src/keystore/keystore + mykey + password + password + + + + + sign + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + + **/** + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-base/1.0-SNAPSHOT/archiva-base-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-base/1.0-SNAPSHOT/archiva-base-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..cd51f1edc --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-base/1.0-SNAPSHOT/archiva-base-1.0-SNAPSHOT.pom @@ -0,0 +1,42 @@ + + + + + 4.0.0 + + org.apache.maven.archiva + archiva-parent + 1.0-SNAPSHOT + ../pom.xml + + + archiva-base + Archiva Base + pom + + + archiva-common + archiva-configuration + archiva-consumers + archiva-indexer + archiva-model + + archiva-repository-layer + archiva-xml-tools + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-cli/1.0-SNAPSHOT/archiva-cli-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-cli/1.0-SNAPSHOT/archiva-cli-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..115bc99ea --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-cli/1.0-SNAPSHOT/archiva-cli-1.0-SNAPSHOT.pom @@ -0,0 +1,68 @@ + + + + + + org.apache.maven.archiva + archiva-parent + 1.0-SNAPSHOT + + 4.0.0 + archiva-cli + Archiva Command Line Client + + + org.apache.maven.archiva + archiva-converter + + + org.apache.maven.archiva + archiva-repository-layer + + + org.codehaus.plexus + plexus-component-api + + + org.codehaus.plexus + plexus-cli + 1.0 + + + commons-lang + commons-lang + + + + + + maven-assembly-plugin + + src/main/assembly/archiva-cli-assembly.xml + + + org.apache.maven.archiva.cli.ArchivaCli + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-common/1.0-SNAPSHOT/archiva-common-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-common/1.0-SNAPSHOT/archiva-common-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..17a20abd5 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-common/1.0-SNAPSHOT/archiva-common-1.0-SNAPSHOT.pom @@ -0,0 +1,98 @@ + + + + + + org.apache.maven.archiva + archiva-base + 1.0-SNAPSHOT + + 4.0.0 + archiva-common + Archiva Base :: Common + + + + org.codehaus.plexus + plexus-component-api + + + + commons-lang + commons-lang + + + org.codehaus.plexus + plexus-container-default + + + + + + + org.codehaus.plexus + plexus-maven-plugin + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-configuration/1.0-SNAPSHOT/archiva-configuration-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-configuration/1.0-SNAPSHOT/archiva-configuration-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..790d0cfa4 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-configuration/1.0-SNAPSHOT/archiva-configuration-1.0-SNAPSHOT.pom @@ -0,0 +1,109 @@ + + + + + + org.apache.maven.archiva + archiva-base + 1.0-SNAPSHOT + + 4.0.0 + archiva-configuration + Archiva Base :: Configuration + + + org.codehaus.plexus + plexus-component-api + + + org.codehaus.plexus + plexus-utils + + + commons-lang + commons-lang + + + commons-io + commons-io + + + org.codehaus.plexus.registry + plexus-registry-api + 1.0-alpha-2-SNAPSHOT + + + org.codehaus.plexus.registry + plexus-registry-commons + 1.0-alpha-2-SNAPSHOT + test + + + + easymock + easymock + 1.2_Java1.3 + test + + + org.codehaus.plexus + plexus-container-default + test + + + + + + org.codehaus.modello + modello-maven-plugin + 1.0-alpha-15-SNAPSHOT + + + + java + registry-reader + registry-writer + + + + + 1.0.0 + src/main/mdo/configuration.mdo + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + + org/apache/maven/archiva/configuration/io/** + org/apache/maven/archiva/configuration/*RepositoryConfiguration.* + org/apache/maven/archiva/configuration/Configuration.* + org/apache/maven/archiva/configuration/Proxy.* + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-consumer-api/1.0-SNAPSHOT/archiva-consumer-api-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-consumer-api/1.0-SNAPSHOT/archiva-consumer-api-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..f331ed074 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-consumer-api/1.0-SNAPSHOT/archiva-consumer-api-1.0-SNAPSHOT.pom @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + org.apache.maven.archiva + archiva-consumers + 1.0-SNAPSHOT + ../pom.xml + + + archiva-consumer-api + Archiva Consumer API + jar + + + + org.apache.maven.archiva + archiva-model + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-consumers/1.0-SNAPSHOT/archiva-consumers-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-consumers/1.0-SNAPSHOT/archiva-consumers-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..8969b9ed3 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-consumers/1.0-SNAPSHOT/archiva-consumers-1.0-SNAPSHOT.pom @@ -0,0 +1,41 @@ + + + + + 4.0.0 + + org.apache.maven.archiva + archiva-base + 1.0-SNAPSHOT + ../pom.xml + + + archiva-consumers + Archiva Consumers + pom + + + archiva-consumer-api + archiva-core-consumers + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-converter/1.0-SNAPSHOT/archiva-converter-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-converter/1.0-SNAPSHOT/archiva-converter-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..49bde7bd2 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-converter/1.0-SNAPSHOT/archiva-converter-1.0-SNAPSHOT.pom @@ -0,0 +1,79 @@ + + + + + + org.apache.maven.archiva + archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-converter + Archiva Repository Converter + + + org.apache.maven.archiva + archiva-discoverer + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-component-api + + + org.apache.maven + maven-artifact + + + org.apache.maven.shared + maven-model-converter + + + org.codehaus.plexus + plexus-digest + + + org.codehaus.plexus + plexus-i18n + 1.0-beta-6 + + + commons-io + commons-io + + + + hsqldb + hsqldb + 1.7.3.3 + test + + + + org.codehaus.plexus + plexus-container-default + test + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-core-consumers/1.0-SNAPSHOT/archiva-core-consumers-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-core-consumers/1.0-SNAPSHOT/archiva-core-consumers-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..182578f57 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-core-consumers/1.0-SNAPSHOT/archiva-core-consumers-1.0-SNAPSHOT.pom @@ -0,0 +1,50 @@ + + + + + 4.0.0 + + org.apache.maven.archiva + archiva-consumers + 1.0-SNAPSHOT + ../pom.xml + + + archiva-core-consumers + Archiva Consumers :: Core Consumers + jar + + + + org.apache.maven.archiva + archiva-configuration + + + org.apache.maven.archiva + archiva-consumer-api + + + org.apache.maven.archiva + archiva-repository-layer + + + org.codehaus.plexus + plexus-digest + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-core/1.0-SNAPSHOT/archiva-core-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-core/1.0-SNAPSHOT/archiva-core-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..18b98fc7b --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-core/1.0-SNAPSHOT/archiva-core-1.0-SNAPSHOT.pom @@ -0,0 +1,113 @@ + + + + + + archiva + org.apache.maven.archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-core + Archiva Core + + + org.apache.maven.archiva + archiva-configuration + + + org.apache.maven.archiva + archiva-discoverer + + + org.apache.maven.archiva + archiva-proxy + + + org.apache.maven.archiva + archiva-reports-standard + + + org.codehaus.plexus + plexus-component-api + + + org.codehaus.plexus + plexus-quartz + 1.0-alpha-3 + + + org.codehaus.plexus.cache + plexus-cache-ehcache + 1.0-alpha-1-SNAPSHOT + + + org.codehaus.plexus + plexus-taskqueue + 1.0-alpha-6 + + + commons-lang + commons-lang + + + org.codehaus.plexus.registry + plexus-registry-commons + 1.0-SNAPSHOT + test + + + + hsqldb + hsqldb + 1.7.3.3 + test + + + + org.codehaus.plexus + plexus-container-default + test + + + + + + org.codehaus.plexus + plexus-maven-plugin + + + merge + + merge-descriptors + + + + ${basedir}/src/main/resources/META-INF/plexus/components.xml + ${project.build.directory}/generated-resources/plexus/META-INF/plexus/components.xml + + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-discoverer/1.0-SNAPSHOT/archiva-discoverer-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-discoverer/1.0-SNAPSHOT/archiva-discoverer-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..8a96e39c5 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-discoverer/1.0-SNAPSHOT/archiva-discoverer-1.0-SNAPSHOT.pom @@ -0,0 +1,65 @@ + + + + + + org.apache.maven.archiva + archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-discoverer + Archiva Discoverer + + + org.apache.maven.archiva + archiva-common + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-container-default + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-repository-metadata + + + org.apache.maven + maven-artifact-manager + + + org.apache.maven + maven-model + + + commons-lang + commons-lang + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-indexer/1.0-SNAPSHOT/archiva-indexer-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-indexer/1.0-SNAPSHOT/archiva-indexer-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..7d77d445f --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-indexer/1.0-SNAPSHOT/archiva-indexer-1.0-SNAPSHOT.pom @@ -0,0 +1,81 @@ + + + + + + org.apache.maven.archiva + archiva-base + 1.0-SNAPSHOT + + 4.0.0 + archiva-indexer + Archiva Base :: Indexer + + + org.apache.maven.archiva + archiva-configuration + + + org.apache.maven.archiva + archiva-model + + + org.apache.lucene + lucene-core + 2.0.0 + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-container-default + + + org.codehaus.plexus + plexus-digest + + + commons-lang + commons-lang + + + commons-io + commons-io + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + 80 + 80 + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..52c185ea7 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom @@ -0,0 +1,159 @@ + + + + + + org.apache.maven.archiva + archiva-base + 1.0-SNAPSHOT + + 4.0.0 + archiva-model + Archiva Base :: Model + + + org.apache.maven.archiva + archiva-common + + + org.codehaus.plexus + plexus-utils + + + javax.jdo + jdo2-api + 2.0 + + + org.codehaus.plexus + plexus-container-default + + + commons-lang + commons-lang + + + commons-io + commons-io + + + + + + org.codehaus.plexus + plexus-maven-plugin + + + org.codehaus.modello + modello-maven-plugin + 1.0-alpha-15-SNAPSHOT + + 1.0.0 + false + src/main/mdo/archiva-base.xml + + + + archiva-base + + java + xsd + jpox-jdo-mapping + jpox-metadata-class + + + + + + + org.codehaus.mojo + jpox-maven-plugin + 1.1.6 + + + org.apache.derby + derby + 10.2.1.6 + + + + + create-ddl + generate-test-resources + + schema-create + + + ${basedir}/target/classes/org/apache/maven/archiva/model/schema.ddl + + + javax.jdo.option.ConnectionDriverName + org.apache.derby.jdbc.EmbeddedDriver + + + javax.jdo.option.ConnectionURL + jdbc:derby:target/jdo-schema-create;create=true + + + javax.jdo.option.ConnectionUserName + sa + + + javax.jdo.option.ConnectionPassword + + + + log4j.configuration + ${basedir}/src/test/resources/log4j.xml + + + org.jpox.autoCreateTables + true + + + + + + enhance + + enhance + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + + org/apache/maven/archiva/reporting/model/** + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-parent/1.0-SNAPSHOT/archiva-parent-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-parent/1.0-SNAPSHOT/archiva-parent-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..c3a69b1a2 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-parent/1.0-SNAPSHOT/archiva-parent-1.0-SNAPSHOT.pom @@ -0,0 +1,567 @@ + + + + + 4.0.0 + + org.apache.maven + maven-parent + 4 + ../pom/maven/pom.xml + + org.apache.maven.archiva + archiva-parent + pom + Archiva + 1.0-SNAPSHOT + + Archiva is an application for managing one or more remote repositories, including + administration, artifact handling, + browsing and searching. + + http://maven.apache.org/archiva + + jira + http://jira.codehaus.org/browse/MRM + + + + Maven Archiva User List + archiva-users-subscribe@maven.apache.org + archiva-users-unsubscribe@maven.apache.org + archiva-users@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-users + + + Maven Archiva Developer List + archiva-dev-subscribe@maven.apache.org + archiva-dev-unsubscribe@maven.apache.org + archiva-dev@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-dev + + + Maven Archiva Commits List + archiva-commits-subscribe@maven.apache.org + archiva-commits-unsubscribe@maven.apache.org + archiva-commits@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-commits + + + + scm:svn:http://svn.apache.org/repos/asf/maven/archiva/trunk + scm:svn:https://svn.apache.org/repos/asf/maven/archiva/trunk + http://svn.apache.org/viewcvs.cgi/maven/archiva/trunk + + + + apache.website + scpexe://people.apache.org/www/maven.apache.org/archiva/ + + + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.3 + + + generate + + descriptor + + + + + + maven-compiler-plugin + + 1.4 + 1.4 + + + + maven-surefire-plugin + 2.2 + + + + + + maven-idea-plugin + + 1.4 + + + + maven-release-plugin + + https://svn.apache.org/repos/asf/maven/archiva/tags + + + + + + + archiva-api + archiva-base + archiva-database + archiva-reporting + archiva-web + archiva-cli + maven-meeper + + + + junit + junit + 3.8.1 + test + + + + + + org.apache.maven.shared + maven-app-configuration-model + 1.0-SNAPSHOT + + + org.apache.maven.shared + maven-app-configuration-web + 1.0-SNAPSHOT + + + org.codehaus.plexus + plexus-container-default + 1.0-alpha-18 + + + org.codehaus.plexus + plexus-component-api + 1.0-alpha-18 + + + org.codehaus.plexus + plexus-utils + 1.4 + + + org.slf4j + slf4j-log4j12 + 1.2 + + + org.apache.maven + maven-repository-metadata + ${maven.version} + + + org.apache.maven + maven-model + ${maven.version} + + + org.apache.maven + maven-artifact + ${maven.version} + + + org.apache.maven + maven-artifact-manager + ${maven.version} + + + org.apache.maven + maven-project + ${maven.version} + + + org.apache.maven.shared + maven-model-converter + 2.0.5-SNAPSHOT + + + org.apache.maven.wagon + wagon-provider-api + ${wagon.version} + + + org.apache.maven.wagon + wagon-ssh + ${wagon.version} + + + org.apache.maven.wagon + wagon-file + ${wagon.version} + + + org.apache.maven.wagon + wagon-http-lightweight + ${wagon.version} + + + org.apache.maven.archiva + archiva-common + ${archiva.version} + + + org.apache.maven.archiva + archiva-core + ${archiva.version} + + + org.apache.maven.archiva + archiva-reports-standard + ${archiva.version} + + + org.apache.maven.archiva + archiva-model + ${archiva.version} + + + org.apache.maven.archiva + archiva-database + ${archiva.version} + + + org.apache.maven.archiva + archiva-consumer-api + ${archiva.version} + + + org.apache.maven.archiva + archiva-model + ${archiva.version} + + + org.apache.maven.archiva + archiva-database + ${archiva.version} + + + org.apache.maven.archiva + archiva-discoverer + ${archiva.version} + + + org.apache.maven.archiva + archiva-repository-layer + ${archiva.version} + + + org.apache.maven.archiva + archiva-indexer + ${archiva.version} + + + org.apache.maven.archiva + archiva-proxy + ${archiva.version} + + + org.apache.maven.archiva + archiva-applet + ${archiva.version} + + + org.apache.maven.archiva + archiva-security + ${archiva.version} + + + org.apache.maven.archiva + archiva-configuration + ${archiva.version} + + + org.apache.maven.archiva + archiva-converter + ${archiva.version} + + + org.apache.maven.archiva + archiva-utils + ${archiva.version} + + + org.apache.maven.archiva + archiva-webapp + ${archiva.version} + war + + + org.codehaus.plexus + plexus-digest + 1.1-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-rbac-profile + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-system + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-system + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-ui-web + ${plexus-security.version} + war + + + org.codehaus.plexus.security + plexus-security-ui-web-integration + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-ui-web-taglib + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authentication-provider-user-manager + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authentication-provider-keystore + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-user-management-api + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-user-management-provider-jdo + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-store-cached + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-store-jdo + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-api + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-authorizer + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-keys-jdo + ${plexus-security.version} + + + commons-lang + commons-lang + 2.2 + + + commons-io + commons-io + 1.2 + + + org.apache.derby + derby + 10.1.3.1 + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + maven-checkstyle-plugin + + config/maven_checks.xml + + + + org.codehaus.mojo + changelog-maven-plugin + + + org.codehaus.mojo + taglist-maven-plugin + + + maven-jxr-plugin + + true + + + + maven-surefire-report-plugin + + + maven-javadoc-plugin + + 1.4 + true + + + + maven-pmd-plugin + + + + + + + ci + + + enableCiProfile + true + + + + + + org.apache.maven.plugins + maven-pmd-plugin + + + process-sources + + + cpd-check + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + process-sources + + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + 77 + 95 + + + + + **/*$* + + + + + + clean + + clean + + + + check + + check + + + + + + + + + + + codehaus.org + http://repository.codehaus.org + + true + + + false + + + + + snapshots.codehaus.org + http://snapshots.repository.codehaus.org + + false + + + true + + + + + + + snapshots.codehaus.org + http://snapshots.repository.codehaus.org + + false + + + true + + + + + 1.0-SNAPSHOT + 2.0.5 + 1.0-beta-2 + 1.0-alpha-11-SNAPSHOT + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-plexus-application/1.0-SNAPSHOT/archiva-plexus-application-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-plexus-application/1.0-SNAPSHOT/archiva-plexus-application-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..21edbff05 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-plexus-application/1.0-SNAPSHOT/archiva-plexus-application-1.0-SNAPSHOT.pom @@ -0,0 +1,62 @@ + + + + + + archiva + org.apache.maven.archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-plexus-application + plexus-application + Archiva Plexus Application + + + + org.codehaus.plexus + plexus-appserver-maven-plugin + 2.0-alpha-7 + true + + src/conf/application.xml + src/conf + src/plexus.properties + archiva + src/conf/plexus.xml + src/plexus.properties + target/plexus-archiva-runtime + + + + + + + org.apache.maven.archiva + archiva-webapp + war + + + + + ${project.version} + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-plexus-runtime/1.0-SNAPSHOT/archiva-plexus-runtime-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-plexus-runtime/1.0-SNAPSHOT/archiva-plexus-runtime-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..1c675dc62 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-plexus-runtime/1.0-SNAPSHOT/archiva-plexus-runtime-1.0-SNAPSHOT.pom @@ -0,0 +1,145 @@ + + + + + + org.apache.maven.archiva + archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-plexus-runtime + Archiva Runtime Generator + + + org.codehaus.plexus + plexus-container-default + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-appserver-host + 2.0-alpha-7 + + + + org.codehaus.plexus + plexus-appserver-service-jetty + 2.0-alpha-7 + plexus-service + + + + org.apache.maven.archiva + archiva-plexus-application + ${project.version} + plexus-application + + + + + log4j + log4j + 1.2.8 + + + commons-logging + commons-logging-api + 1.0.4 + + + org.apache.derby + derby + runtime + + + org.codehaus.plexus + plexus-naming + 1.0-alpha-3-SNAPSHOT + runtime + + + javax.mail + mail + 1.4 + runtime + + + + + + org.codehaus.plexus + plexus-appserver-maven-plugin + 2.0-alpha-7 + true + + + process-resources + + assemble-runtime + add-services + add-apps + + + + + src/conf/plexus.xml + src/plexus.properties + target/plexus-archiva-runtime + + commons-logging:commons-logging-api + log4j:log4j + org.apache.derby:derby + org.codehaus.plexus:plexus-naming + commons-pool:commons-pool + commons-dbcp:commons-dbcp + commons-collections:commons-collections + directory-naming:naming-core + directory-naming:naming-factory + directory-naming:naming-java + directory-naming:naming-config + javax.mail:mail + javax.activation:activation + + + + + maven-assembly-plugin + 2.1 + + + package + + single + + + + + src/main/assembly/bin.xml + archiva + + + + + diff --git a/archiva-consumer-api/pom.xml b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-proxy/1.0-SNAPSHOT/archiva-proxy-1.0-SNAPSHOT.pom old mode 100755 new mode 100644 similarity index 75% rename from archiva-consumer-api/pom.xml rename to archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-proxy/1.0-SNAPSHOT/archiva-proxy-1.0-SNAPSHOT.pom index e20018f76..23488ee0a --- a/archiva-consumer-api/pom.xml +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-proxy/1.0-SNAPSHOT/archiva-proxy-1.0-SNAPSHOT.pom @@ -26,36 +26,35 @@ 1.0-SNAPSHOT 4.0.0 - archiva-consumer-api-OLD - Archiva Consumer API + archiva-proxy + Archiva Proxy org.apache.maven.archiva - archiva-model + archiva-common + + + org.apache.maven.wagon + wagon-file + test + + + org.apache.maven.wagon + wagon-provider-api org.codehaus.plexus - plexus-utils + plexus-digest - org.codehaus.plexus - plexus-container-default - - - commons-lang - commons-lang + easymock + easymock + 1.2_Java1.3 + test commons-io commons-io - - - - org.codehaus.plexus - plexus-maven-plugin - - - diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-reports-standard/1.0-SNAPSHOT/archiva-reports-standard-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-reports-standard/1.0-SNAPSHOT/archiva-reports-standard-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..24eb19954 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-reports-standard/1.0-SNAPSHOT/archiva-reports-standard-1.0-SNAPSHOT.pom @@ -0,0 +1,176 @@ + + + + + + org.apache.maven.archiva + archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-reports-standard + Archiva Standard Reports + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-container-default + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-artifact-manager + + + org.apache.maven + maven-model + + + org.apache.maven + maven-repository-metadata + + + org.apache.maven.wagon + wagon-provider-api + + + org.apache.maven.archiva + archiva-repository-layer + + + org.apache.maven.archiva + archiva-indexer + + + org.apache.maven.archiva + archiva-discoverer + + + commons-lang + commons-lang + + + commons-io + commons-io + + + org.codehaus.plexus + plexus-jdo2 + 1.0-alpha-8 + + + xerces + xercesImpl + + + xerces + xmlParserAPIs + + + + + jpox + jpox + 1.1.6 + compile + + + + javax.sql + jdbc-stdext + + + + + + hsqldb + hsqldb + 1.7.3.3 + test + + + + + + org.codehaus.modello + modello-maven-plugin + 1.0-alpha-14-SNAPSHOT + + 1.0.0 + false + src/main/mdo/reporting.mdo + + + + modello-java + + java + jpox-metadata-class + + + + + jpox-jdo-mapping + + jpox-jdo-mapping + + + ${basedir}/target/classes/org/apache/maven/archiva/reporting/model/ + + + + + + org.codehaus.mojo + jpox-maven-plugin + 1.1.6-SNAPSHOT + + + + enhance + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + + org/apache/maven/archiva/reporting/model/** + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-repository-layer/1.0-SNAPSHOT/archiva-repository-layer-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-repository-layer/1.0-SNAPSHOT/archiva-repository-layer-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..6ec87f431 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-repository-layer/1.0-SNAPSHOT/archiva-repository-layer-1.0-SNAPSHOT.pom @@ -0,0 +1,103 @@ + + + + + + org.apache.maven.archiva + archiva-base + 1.0-SNAPSHOT + + 4.0.0 + archiva-repository-layer + Archiva Repository Interface Layer + + + org.apache.maven.archiva + archiva-consumer-api + + + org.apache.maven.archiva + archiva-model + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-xml-tools + 1.0-SNAPSHOT + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus.cache + plexus-cache-api + 1.0-alpha-2-SNAPSHOT + compile + + + org.codehaus.plexus.cache + plexus-cache-ehcache + 1.0-alpha-2-SNAPSHOT + compile + + + + org.slf4j + slf4j-log4j12 + + + + + + org.codehaus.plexus + plexus-maven-plugin + + + merge + + merge-descriptors + + + + ${basedir}/src/main/resources/META-INF/plexus/components.xml + ${project.build.directory}/generated-resources/plexus/META-INF/plexus/components.xml + + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-security/1.0-SNAPSHOT/archiva-security-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-security/1.0-SNAPSHOT/archiva-security-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..78cbd1282 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-security/1.0-SNAPSHOT/archiva-security-1.0-SNAPSHOT.pom @@ -0,0 +1,45 @@ + + + + + + archiva + org.apache.maven.archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-security + Archiva Security Configuration + + + org.codehaus.plexus.security + plexus-security-rbac-profile + + + org.codehaus.plexus.security + plexus-security-system + + + org.codehaus.plexus + plexus-component-api + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-webapp/1.0-SNAPSHOT/archiva-webapp-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-webapp/1.0-SNAPSHOT/archiva-webapp-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..2d58dbf40 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-webapp/1.0-SNAPSHOT/archiva-webapp-1.0-SNAPSHOT.pom @@ -0,0 +1,335 @@ + + + + + 4.0.0 + + org.apache.maven.archiva + archiva + 1.0-SNAPSHOT + + archiva-webapp + war + Archiva Web Application + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.servlet + jsp-api + 2.0 + provided + + + opensymphony + sitemesh + 2.2.1 + + + taglibs + standard + 1.1.2 + + + javax.servlet + jstl + 1.1.2 + + + org.apache.maven.shared + maven-app-configuration-model + + + org.apache.maven.shared + maven-app-configuration-web + + + org.codehaus.plexus + plexus-log4j-logging + 1.1-alpha-2 + runtime + + + commons-logging + commons-logging + 1.0.4 + runtime + + + commons-lang + commons-lang + 2.2 + + + org.apache.maven.wagon + wagon-http-lightweight + runtime + + + org.apache.maven.wagon + wagon-file + runtime + + + opensymphony + webwork + 2.2.4 + + + org.codehaus.plexus.registry + plexus-registry-commons + 1.0-SNAPSHOT + + + org.codehaus.plexus + plexus-component-api + + + org.codehaus.plexus + plexus-container-default + + + org.apache.maven.archiva + archiva-proxy + + + org.apache.maven.archiva + archiva-core + + + org.apache.maven.archiva + archiva-common + + + org.apache.maven.archiva + archiva-security + + + org.apache.maven.archiva + archiva-applet + + provided + + + org.apache.maven + maven-project + + + org.apache.maven.shared + maven-dependency-tree + 1.0-alpha-2 + + + + org.codehaus.plexus.security + plexus-security-ui-web + war + runtime + + + org.codehaus.plexus.security + plexus-security-ui-web-taglib + + + + org.codehaus.plexus.webdav + plexus-webdav-simple + 1.0-alpha-1-SNAPSHOT + + + org.codehaus.plexus + plexus-xwork-integration + 1.0-alpha-5 + + + org.codehaus.plexus + plexus-utils + + + org.apache.derby + derby + 10.1.3.1 + provided + + + javax.mail + mail + 1.4 + provided + + + javax.activation + activation + 1.1 + provided + + + + + + org.apache.maven.plugins + maven-clean-plugin + 2.1.1 + + + + + ${basedir}/src/main/webapp + + + META-INF + images/pss + + template/pss + + WEB-INF/classes + + WEB-INF/lib + + WEB-INF/database + + WEB-INF/logs + + pss + + css/pss + WEB-INF/jsp/pss + + WEB-INF/template/pss + + WEB-INF/logs + + WEB-INF/temp + + + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.0.1 + + + false + META-INF/**,WEB-INF/web.xml,WEB-INF/classes/xwork.xml + + + + + compile + + + inplace + + + + + + org.mortbay.jetty + maven-jetty-plugin + 6.1.1 + + 10 + / + src/jetty-env.xml + + + 9091 + 60000 + + + + + appserver.base + ${project.build.directory}/appserver-base + + + derby.system.home + ${project.build.directory}/appserver-base/logs + + + + + + org.apache.derby + derby + 10.1.3.1 + + + + + org.codehaus.mojo + dependency-maven-plugin + + + copy + process-resources + + copy + + + + + ${project.groupId} + archiva-applet + ${project.version} + src/main/webapp + archiva-applet.jar + + + + + + + + org.codehaus.plexus + plexus-maven-plugin + + + + com.opensymphony.xwork.Action + per-lookup + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + + **/** + + + + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..efa42d3f0 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom @@ -0,0 +1,79 @@ + + + + + + org.apache.maven.archiva + archiva-base + 1.0-SNAPSHOT + + 4.0.0 + archiva-xml-tools + Archiva Base :: XML Tools + + + org.apache.maven.archiva + archiva-common + + + dom4j + dom4j + 1.6.1 + + + jaxen + jaxen + 1.1 + + + org.codehaus.plexus + plexus-utils + + + org.slf4j + slf4j-log4j12 + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-20061126.005254-2.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-20061126.005254-2.pom new file mode 100644 index 000000000..b99001024 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-20061126.005254-2.pom @@ -0,0 +1,506 @@ + + + + + 4.0.0 + + org.apache.maven + maven-parent + 4 + ../pom/maven/pom.xml + + org.apache.maven.archiva + archiva + pom + Archiva + 1.0-SNAPSHOT + + Archiva is an application for managing one or more remote repositories, including + administration, artifact handling, + browsing and searching. + + http://maven.apache.org/archiva + + jira + http://jira.codehaus.org/browse/MRM + + + + Maven Archiva User List + archiva-users-subscribe@maven.apache.org + archiva-users-unsubscribe@maven.apache.org + archiva-users@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-users + + + Maven Archiva Developer List + archiva-dev-subscribe@maven.apache.org + archiva-dev-unsubscribe@maven.apache.org + archiva-dev@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-dev + + + Maven Archiva Commits List + archiva-commits-subscribe@maven.apache.org + archiva-commits-unsubscribe@maven.apache.org + archiva-commits@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-commits + + + + scm:svn:http://svn.apache.org/repos/asf/maven/archiva/trunk + scm:svn:https://svn.apache.org/repos/asf/maven/archiva/trunk + http://svn.apache.org/viewcvs.cgi/maven/archiva/trunk + + + + apache.website + scpexe://people.apache.org/www/maven.apache.org/archiva/ + + + + + + org.apache.maven.wagon + wagon-ssh-external + 1.0-alpha-5 + + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3 + + + + descriptor + merge-descriptors + + + + + + maven-compiler-plugin + + 1.4 + 1.4 + + + + maven-surefire-plugin + 2.2 + + + + + + maven-idea-plugin + + 1.4 + + + + maven-release-plugin + + https://svn.apache.org/repos/asf/maven/archiva/tags + + + + + + + archiva-applet + archiva-converter + archiva-discoverer + archiva-reports-standard + archiva-indexer + archiva-webapp + archiva-proxy + archiva-core + archiva-configuration + maven-meeper + archiva-repository-layer + archiva-plexus-application + archiva-plexus-runtime + archiva-security + archiva-cli + + + + junit + junit + 3.8.1 + test + + + + + + org.codehaus.plexus + plexus-container-default + 1.0-alpha-10 + + + org.codehaus.plexus + plexus-utils + 1.3 + + + org.apache.maven + maven-repository-metadata + ${maven.version} + + + org.apache.maven + maven-model + ${maven.version} + + + org.apache.maven + maven-artifact + ${maven.version} + + + org.apache.maven + maven-artifact-manager + ${maven.version} + + + org.apache.maven + maven-project + ${maven.version} + + + org.apache.maven + maven-model-converter + 2.0.4 + + + org.apache.maven.wagon + wagon-provider-api + ${wagon.version} + + + org.apache.maven.wagon + wagon-ssh + ${wagon.version} + + + org.apache.maven.wagon + wagon-file + ${wagon.version} + + + org.apache.maven.wagon + wagon-http-lightweight + ${wagon.version} + + + org.apache.maven.archiva + archiva-core + ${pom.version} + + + org.apache.maven.archiva + archiva-reports-standard + ${pom.version} + + + org.apache.maven.archiva + archiva-discoverer + ${pom.version} + + + org.apache.maven.archiva + archiva-repository-layer + ${pom.version} + + + org.apache.maven.archiva + archiva-indexer + ${pom.version} + + + org.apache.maven.archiva + archiva-proxy + ${pom.version} + + + org.apache.maven.archiva + archiva-applet + ${pom.version} + + + org.apache.maven.archiva + archiva-security + ${pom.version} + + + org.apache.maven.archiva + archiva-configuration + ${pom.version} + + + org.apache.maven.archiva + archiva-converter + ${pom.version} + + + org.apache.maven.archiva + archiva-webapp + ${pom.version} + war + + + org.codehaus.plexus + plexus-digest + 1.0-SNAPSHOT + + + org.codehaus.plexus.security + plexus-security-rbac-profile + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-system + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-system + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-ui-web + ${plexus-security.version} + war + + + org.codehaus.plexus.security + plexus-security-ui-web-integration + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-ui-web-taglib + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authentication-provider-user-manager + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authentication-provider-keystore + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-user-management-api + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-user-management-provider-jdo + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-store-jdo + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-api + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-authorizer + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-keys-jdo + ${plexus-security.version} + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + maven-checkstyle-plugin + + config/maven_checks.xml + + + + org.codehaus.mojo + changelog-maven-plugin + + + org.codehaus.mojo + taglist-maven-plugin + + + maven-jxr-plugin + + true + + + + maven-surefire-report-plugin + + + maven-javadoc-plugin + + true + + + + maven-pmd-plugin + + + + + + + ci + + + enableCiProfile + true + + + + + + org.apache.maven.plugins + maven-pmd-plugin + + + process-sources + + + cpd-check + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + process-sources + + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + 77 + 95 + + + + + **/*$* + + + + + + clean + + clean + + + + check + + check + + + + + + + + + + + + codehaus.org + http://snapshots.repository.codehaus.org + + false + + + true + + + + + + codehaus.org + http://snapshots.repository.codehaus.org + + false + + + true + + + + + + apache.org + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + + 2.0.4 + 1.0-beta-1 + 1.0-alpha-6-SNAPSHOT + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-SNAPSHOT-site.xml b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-SNAPSHOT-site.xml new file mode 100644 index 000000000..ac3c2e716 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-SNAPSHOT-site.xml @@ -0,0 +1,28 @@ + + + Maven + http://maven.apache.org/images/apache-maven-project-2.png + http://maven.apache.org/ + + + images/archiva-logo-banner.jpg + + + + org.apache.maven.skins + maven-stylus-skin + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-SNAPSHOT.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..4992be115 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-SNAPSHOT.pom @@ -0,0 +1,557 @@ + + + + + 4.0.0 + + org.apache.maven + maven-parent + 4 + ../pom/maven/pom.xml + + + 2.0.5 + + org.apache.maven.archiva + archiva + pom + Archiva + 1.0-SNAPSHOT + + Archiva is an application for managing one or more remote repositories, including + administration, artifact handling, + browsing and searching. + + http://maven.apache.org/archiva + + jira + http://jira.codehaus.org/browse/MRM + + + + Maven Archiva User List + archiva-users-subscribe@maven.apache.org + archiva-users-unsubscribe@maven.apache.org + archiva-users@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-users + + + Maven Archiva Developer List + archiva-dev-subscribe@maven.apache.org + archiva-dev-unsubscribe@maven.apache.org + archiva-dev@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-dev + + + Maven Archiva Commits List + archiva-commits-subscribe@maven.apache.org + archiva-commits-unsubscribe@maven.apache.org + archiva-commits@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-archiva-commits + + + + scm:svn:http://svn.apache.org/repos/asf/maven/archiva/trunk + scm:svn:https://svn.apache.org/repos/asf/maven/archiva/trunk + http://svn.apache.org/viewcvs.cgi/maven/archiva/trunk + + + + apache.website + scpexe://people.apache.org/www/maven.apache.org/archiva/ + + + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.3 + + + generate + + descriptor + + + + + + maven-compiler-plugin + + 1.4 + 1.4 + + + + maven-surefire-plugin + 2.2 + + + + + + maven-idea-plugin + + 1.4 + + + + maven-release-plugin + + https://svn.apache.org/repos/asf/maven/archiva/tags + + + + + + + archiva-applet + archiva-converter + archiva-common + archiva-discoverer + archiva-reports-standard + archiva-indexer + archiva-webapp + archiva-proxy + archiva-core + archiva-configuration + maven-meeper + archiva-repository-layer + archiva-plexus-application + archiva-plexus-runtime + archiva-security + archiva-cli + + + + junit + junit + 3.8.1 + test + + + + + + org.apache.maven.shared + maven-app-configuration-model + 1.0-SNAPSHOT + + + org.apache.maven.shared + maven-app-configuration-web + 1.0-SNAPSHOT + + + org.codehaus.plexus + plexus-container-default + 1.0-alpha-17 + + + org.codehaus.plexus + plexus-component-api + 1.0-alpha-17 + + + org.codehaus.plexus + plexus-utils + 1.4 + + + org.apache.maven + maven-repository-metadata + ${maven.version} + + + org.apache.maven + maven-model + ${maven.version} + + + org.apache.maven + maven-artifact + ${maven.version} + + + org.apache.maven + maven-artifact-manager + ${maven.version} + + + org.apache.maven + maven-project + ${maven.version} + + + org.apache.maven.shared + maven-model-converter + 2.0.5-SNAPSHOT + + + org.apache.maven.wagon + wagon-provider-api + ${wagon.version} + + + org.apache.maven.wagon + wagon-ssh + ${wagon.version} + + + org.apache.maven.wagon + wagon-file + ${wagon.version} + + + org.apache.maven.wagon + wagon-http-lightweight + ${wagon.version} + + + org.apache.maven.archiva + archiva-common + ${pom.version} + + + + org.apache.maven.archiva + archiva-core + ${pom.version} + + + org.apache.maven.archiva + archiva-reports-standard + ${pom.version} + + + org.apache.maven.archiva + archiva-discoverer + ${pom.version} + + + org.apache.maven.archiva + archiva-repository-layer + ${pom.version} + + + org.apache.maven.archiva + archiva-indexer + ${pom.version} + + + org.apache.maven.archiva + archiva-proxy + ${pom.version} + + + org.apache.maven.archiva + archiva-applet + ${pom.version} + + + org.apache.maven.archiva + archiva-security + ${pom.version} + + + org.apache.maven.archiva + archiva-configuration + ${pom.version} + + + org.apache.maven.archiva + archiva-converter + ${pom.version} + + + org.apache.maven.archiva + archiva-utils + ${pom.version} + + + org.apache.maven.archiva + archiva-webapp + ${pom.version} + war + + + org.codehaus.plexus + plexus-digest + 1.0 + + + org.codehaus.plexus.security + plexus-security-rbac-profile + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-system + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-system + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-ui-web + ${plexus-security.version} + war + + + org.codehaus.plexus.security + plexus-security-ui-web-integration + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-ui-web-taglib + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authentication-provider-user-manager + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authentication-provider-keystore + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-user-management-api + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-user-management-provider-jdo + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-store-cached + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-store-jdo + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-api + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-authorization-rbac-authorizer + ${plexus-security.version} + + + org.codehaus.plexus.security + plexus-security-keys-jdo + ${plexus-security.version} + + + commons-lang + commons-lang + 2.2 + + + commons-io + commons-io + 1.2 + + + org.apache.derby + derby + 10.1.3.1 + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + maven-checkstyle-plugin + + config/maven_checks.xml + + + + org.codehaus.mojo + changelog-maven-plugin + + + org.codehaus.mojo + taglist-maven-plugin + + + maven-jxr-plugin + + true + + + + maven-surefire-report-plugin + + + maven-javadoc-plugin + + 1.4 + true + + + + maven-pmd-plugin + + + + + + + ci + + + enableCiProfile + true + + + + + + org.apache.maven.plugins + maven-pmd-plugin + + + process-sources + + + cpd-check + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + process-sources + + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + 77 + 95 + + + + + **/*$* + + + + + + clean + + clean + + + + check + + check + + + + + + + + + + + codehaus.org + http://repository.codehaus.org + + true + + + false + + + + + codehaus.org + http://snapshots.repository.codehaus.org + + false + + + true + + + + + + + codehaus.org + http://snapshots.repository.codehaus.org + + false + + + true + + + + + 2.0.5 + 1.0-beta-2 + 1.0-alpha-10-SNAPSHOT + + diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4-site.xml b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4-site.xml new file mode 100644 index 000000000..e69de29bb diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4-site_en.xml b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4-site_en.xml new file mode 100644 index 000000000..e69de29bb diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4.pom b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4.pom new file mode 100644 index 000000000..132d9d736 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4.pom @@ -0,0 +1,304 @@ + + + + + + 4.0.0 + + org.apache + apache + 3 + ../asf/pom.xml + + org.apache.maven + maven-parent + 4 + pom + Apache Maven + + Maven is a software project management and comprehension tool. Based on the concept of a project object model + (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. + + http://maven.apache.org/ + + jira + http://jira.codehaus.org/browse/MPA + + + continuum + http://maven.zones.apache.org:8080/continuum + + + mail + +
notifications@maven.apache.org
+
+
+
+
+ 2002 + + + Maven Announcements List + announce@maven.apache.org + announce-subscribe@maven.apache.org + announce-unsubscribe@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-announce/ + + + Maven Issues List + issues@maven.apache.org + issues-subscribe@maven.apache.org + issues-unsubscribe@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-issues/ + + + Maven Notifications List + notifications@maven.apache.org + notifications-subscribe@maven.apache.org + notifications-unsubscribe@maven.apache.org + http://mail-archives.apache.org/mod_mbox/maven-notifications/ + + + + + + jvanzyl + Jason van Zyl + jason@maven.org + ASF + + PMC Chair + + -5 + + + brett + Brett Porter + brett@apache.org + ASF + + PMC Member + + +10 + + + evenisse + Emmanuel Venisse + evenisse@apache.org + ASF + + PMC Member + + +1 + + + kenney + Kenney Westerhof + kenney@apache.org + Neonics + + PMC Member + + + + snicoll + Stephane Nicoll + snicoll@apache.org + ASF + + PMC Member + + +1 + + + vmassol + Vincent Massol + vmassol@apache.org + ASF + + PMC Member + + +1 + + + fgiust + Fabrizio Giustina + fgiust@apache.org + openmind + + PMC Member + + +1 + + + epunzalan + Edwin Punzalan + epunzalan@mergere.com + Mergere + + Committer + + +8 + + + mperham + Mike Perham + mperham@gmail.com + IBM + + PMC Member + + -6 + + + jdcasey + John Casey + jdcasey@apache.org + ASF + + PMC Member + + -5 + + + trygvis + Trygve Laugstol + trygvis@apache.org + ASF + + PMC Member + + +1 + + + vsiveton + Vincent Siveton + vsiveton@apache.org + ASF + + PMC Member + + -5 + + + carlos + Carlos Sanchez + carlos@apache.org + ASF + + PMC Member + + +1 + + + dennisl + Dennis Lundberg + dennisl@apache.org + ASF + + PMC Member + + +1 + + + + + + apache.website + scp://people.apache.org/www/maven.apache.org + + + + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml + http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt + + + + org.apache.maven.plugins + maven-pmd-plugin + + + org.codehaus.mojo + cobertura-maven-plugin + + + org.codehaus.mojo + taglist-maven-plugin + + + org.apache.maven.plugins + maven-jxr-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + http://java.sun.com/j2ee/1.4/docs/api + http://java.sun.com/j2se/1.5.0/docs/api + http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/ + http://jakarta.apache.org/commons/dbcp/apidocs/ + http://jakarta.apache.org/commons/fileupload/apidocs/ + http://jakarta.apache.org/commons/httpclient/apidocs/ + http://jakarta.apache.org/commons/logging/apidocs/ + http://jakarta.apache.org/commons/pool/apidocs/ + http://www.junit.org/junit/javadoc/ + http://logging.apache.org/log4j/docs/api/ + http://jakarta.apache.org/regexp/apidocs/ + http://jakarta.apache.org/velocity/api/ + + + + + + + + scm:svn:http://svn.apache.org/repos/asf/maven/pom/maven/tags/maven-parent-4 + scm:svn:https://svn.apache.org/repos/asf/maven/pom/maven/tags/maven-parent-4 + http://svn.apache.org/viewvc/maven/pom/maven/tags/maven-parent-4 + +
+ diff --git a/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4.pom.sha1 b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4.pom.sha1 new file mode 100644 index 000000000..b6caacf5e --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/maven-parent/4/maven-parent-4.pom.sha1 @@ -0,0 +1 @@ +0fc039b0bd4d17d7c147a30e1d83994629c5297c \ No newline at end of file diff --git a/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java b/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java index e06f872c7..6985ef06a 100644 --- a/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java +++ b/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java @@ -20,10 +20,13 @@ package org.apache.maven.archiva.xml; */ import org.apache.commons.lang.StringUtils; +import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; +import org.dom4j.Namespace; import org.dom4j.Node; +import org.dom4j.QName; import org.dom4j.XPath; import org.dom4j.io.SAXReader; @@ -34,8 +37,10 @@ import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * XMLReader - a set of common xml utility methods for reading content out of an xml file. @@ -51,6 +56,8 @@ public class XMLReader private Document document; + private Map namespaceMap = new HashMap(); + public XMLReader( String type, File file ) throws XMLException { @@ -121,10 +128,21 @@ public class XMLReader } } + public String getDefaultNamespaceURI() + { + Namespace namespace = this.document.getRootElement().getNamespace(); + return namespace.getURI(); + } + + public void addNamespaceMapping( String elementName, String uri ) + { + this.namespaceMap.put( elementName, uri ); + } + public Element getElement( String xpathExpr ) throws XMLException { - XPath xpath = document.createXPath( xpathExpr ); + XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( document ); if ( evaluated == null ) @@ -145,10 +163,20 @@ public class XMLReader } } + private XPath createXPath( String xpathExpr ) + { + XPath xpath = document.createXPath( xpathExpr ); + if ( !this.namespaceMap.isEmpty() ) + { + xpath.setNamespaceURIs( this.namespaceMap ); + } + return xpath; + } + public boolean hasElement( String xpathExpr ) throws XMLException { - XPath xpath = document.createXPath( xpathExpr ); + XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( document ); if ( evaluated == null ) @@ -159,10 +187,44 @@ public class XMLReader return true; } + /** + * Remove namespaces from entire document. + */ + public void removeNamespaces() + { + removeNamespaces( this.document.getRootElement() ); + } + + /** + * Remove namespaces from element recursively. + */ + public void removeNamespaces( Element elem ) + { + elem.setQName( QName.get( elem.getName(), Namespace.NO_NAMESPACE, elem.getQualifiedName() ) ); + + Node n; + + Iterator it = elem.elementIterator(); + while ( it.hasNext() ) + { + n = (Node) it.next(); + + switch ( n.getNodeType() ) + { + case Node.ATTRIBUTE_NODE: + ( (Attribute) n ).setNamespace( Namespace.NO_NAMESPACE ); + break; + case Node.ELEMENT_NODE: + removeNamespaces( (Element) n ); + break; + } + } + } + public String getElementText( Node context, String xpathExpr ) throws XMLException { - XPath xpath = document.createXPath( xpathExpr ); + XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( context ); if ( evaluated == null ) @@ -186,7 +248,7 @@ public class XMLReader public String getElementText( String xpathExpr ) throws XMLException { - XPath xpath = document.createXPath( xpathExpr ); + XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( document ); if ( evaluated == null ) @@ -210,7 +272,7 @@ public class XMLReader public List getElementList( String xpathExpr ) throws XMLException { - XPath xpath = document.createXPath( xpathExpr ); + XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.evaluate( document ); if ( evaluated == null ) @@ -230,7 +292,7 @@ public class XMLReader else if ( evaluated instanceof Node ) { List ret = new ArrayList(); - ret.add( (Node) evaluated ); + ret.add( evaluated ); return ret; } else diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java index 7832ff5be..23c66cef0 100644 --- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java +++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java @@ -23,9 +23,9 @@ import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.RepositoryContentConsumer; import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.model.ArchivaRepository; -import org.apache.maven.archiva.repository.project.ProjectModel400Reader; import org.apache.maven.archiva.repository.project.ProjectModelException; import org.apache.maven.archiva.repository.project.ProjectModelReader; +import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; import java.io.File; import java.util.ArrayList; diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java deleted file mode 100644 index a6a90e3f3..000000000 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.apache.maven.archiva.consumers; - -/* - * 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 org.apache.maven.archiva.repository.ArchivaRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.codehaus.plexus.PlexusTestCase; -import org.codehaus.plexus.util.FileUtils; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * AbstractConsumerTestCase - * - * @author Joakim Erdfelt - * @version $Id$ - */ -public class AbstractConsumerTestCase extends PlexusTestCase -{ - protected ArchivaRepository getLegacyRepository() throws Exception - { - File repoBaseDir = new File( getBasedir(), "src/test/legacy-repository" ); - ArchivaRepository repository = createRepository( repoBaseDir, "legacy" ); - resetRepositoryState( repository ); - return repository; - } - - protected ArchivaRepository getDefaultRepository() throws Exception - { - File repoBaseDir = new File( getBasedir(), "src/test/repository" ); - ArchivaRepository repository = createRepository( repoBaseDir, "default" ); - resetRepositoryState( repository ); - return repository; - } - - private void resetRepositoryState( ArchivaRepository repository ) throws IOException - { - File repoBaseDir = new File( repository.getRepositoryURL().getPath() ); - - List tmpfiles = FileUtils.getFiles( repoBaseDir, ".*", "" ); - for ( Iterator it = tmpfiles.iterator(); it.hasNext(); ) - { - File hit = (File) it.next(); - if ( hit.exists() ) - { - if ( hit.isFile() ) - { - hit.delete(); - } - - if ( hit.isDirectory() ) - { - FileUtils.deleteDirectory( hit ); - } - } - } - } - - protected ArchivaRepository createRepository( File basedir, String layout ) throws Exception - { - ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, layout ); - - ArchivaRepository repo = new ArchivaRepository(); - repo.setId( "discoveryRepo" ); - repo.setUrl( "file://" + basedir ); - repo.setLayout( repoLayout ); - - return repo; - } - - public List getLegacyLayoutArtifactPaths() - { - List files = new ArrayList(); - - files.add( "invalid/jars/1.0/invalid-1.0.jar" ); - files.add( "invalid/jars/invalid-1.0.rar" ); - files.add( "invalid/jars/invalid.jar" ); - files.add( "invalid/invalid-1.0.jar" ); - files.add( "javax.sql/jars/jdbc-2.0.jar" ); - files.add( "org.apache.maven/jars/some-ejb-1.0-client.jar" ); - files.add( "org.apache.maven/jars/testing-1.0.jar" ); - files.add( "org.apache.maven/jars/testing-1.0-sources.jar" ); - files.add( "org.apache.maven/jars/testing-UNKNOWN.jar" ); - files.add( "org.apache.maven/jars/testing-1.0.zip" ); - files.add( "org.apache.maven/jars/testing-1.0-20050611.112233-1.jar" ); - files.add( "org.apache.maven/jars/testing-1.0.tar.gz" ); - files.add( "org.apache.maven.update/jars/test-not-updated-1.0.jar" ); - files.add( "org.apache.maven.update/jars/test-updated-1.0.jar" ); - - return files; - } - - public List getDefaultLayoutArtifactPaths() - { - List files = new ArrayList(); - - files.add( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" ); - files.add( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar" ); - files.add( "invalid/invalid/1.0/invalid-1.0b.jar" ); - files.add( "invalid/invalid/1.0/invalid-2.0.jar" ); - files.add( "invalid/invalid-1.0.jar" ); - files.add( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar" ); - files.add( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar" ); - files.add( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar" ); - files.add( "org/apache/maven/A/1.0/A-1.0.war" ); - files.add( "org/apache/maven/A/1.0/A-1.0.pom" ); - files.add( "org/apache/maven/B/2.0/B-2.0.pom" ); - files.add( "org/apache/maven/B/1.0/B-1.0.pom" ); - files.add( "org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar" ); - files.add( "org/apache/maven/C/1.0/C-1.0.war" ); - files.add( "org/apache/maven/C/1.0/C-1.0.pom" ); - files.add( "org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.pom" ); - files.add( "org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.jar" ); - files.add( "org/apache/maven/update/test-updated/1.0/test-updated-1.0.pom" ); - files.add( "org/apache/maven/update/test-updated/1.0/test-updated-1.0.jar" ); - files.add( "org/apache/maven/discovery/1.0/discovery-1.0.pom" ); - files.add( "org/apache/maven/testing/1.0/testing-1.0-test-sources.jar" ); - files.add( "org/apache/maven/testing/1.0/testing-1.0.jar" ); - files.add( "org/apache/maven/testing/1.0/testing-1.0-sources.jar" ); - files.add( "org/apache/maven/testing/1.0/testing-1.0.zip" ); - files.add( "org/apache/maven/testing/1.0/testing-1.0.tar.gz" ); - files.add( "org/apache/maven/samplejar/2.0/samplejar-2.0.pom" ); - files.add( "org/apache/maven/samplejar/2.0/samplejar-2.0.jar" ); - files.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.pom" ); - files.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.jar" ); - files.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" ); - files.add( "javax/sql/jdbc/2.0/jdbc-2.0.jar" ); - - return files; - } -} diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java deleted file mode 100644 index bc96f03ec..000000000 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.apache.maven.archiva.consumers; - -/* - * 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 org.apache.maven.archiva.common.utils.BaseFile; -import org.apache.maven.archiva.repository.consumer.ConsumerException; -import org.codehaus.plexus.util.StringUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * FileProblemsTracker - * - * @author Joakim Erdfelt - * @version $Id$ - */ -public class FileProblemsTracker -{ - private Map problemMap = new HashMap(); - - public void addProblem( BaseFile file, String message ) - { - String path = file.getRelativePath(); - addProblem( path, message ); - } - - private void addProblem( String path, String message ) - { - path = StringUtils.replace( path, "\\", "/" ); - List problems = getProblems( path ); - problems.add( message ); - problemMap.put( path, problems ); - } - - public void addProblem( ConsumerException e ) - { - if ( e.getFile() != null ) - { - this.addProblem( e.getFile(), e.getMessage() ); - } - else - { - this.addProblem( "|fatal|", e.getMessage() ); - } - } - - public boolean hasProblems( String path ) - { - if ( !problemMap.containsKey( path ) ) - { - // No tracking of path at all. - return false; - } - - List problems = (List) problemMap.get( path ); - if ( problems == null ) - { - // found path, but no list. - return false; - } - - return !problems.isEmpty(); - } - - public Set getPaths() - { - return problemMap.keySet(); - } - - public List getProblems( String path ) - { - List problems = (List) problemMap.get( path ); - if ( problems == null ) - { - problems = new ArrayList(); - } - - return problems; - } - - public int getProblemCount() - { - int count = 0; - for ( Iterator it = problemMap.values().iterator(); it.hasNext(); ) - { - List problems = (List) it.next(); - count += problems.size(); - } - - return count; - } - -} diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java deleted file mode 100644 index a436cdd94..000000000 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java +++ /dev/null @@ -1,221 +0,0 @@ -package org.apache.maven.archiva.consumers; - -/* - * 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 org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.BaseFile; -import org.apache.maven.archiva.repository.ArchivaRepository; -import org.apache.maven.archiva.repository.consumer.ConsumerException; -import org.apache.maven.artifact.Artifact; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -/** - * GenericArtifactConsumerTest - * - * @author Joakim Erdfelt - * @version $Id$ - */ -public class GenericArtifactConsumerTest - extends AbstractGenericConsumerTestCase -{ - private MockArtifactConsumer getMockArtifactConsumer() - throws Exception - { - return (MockArtifactConsumer) consumerFactory.createConsumer( "mock-artifact" ); - } - - public void testScanLegacy() - throws Exception - { - ArchivaRepository repository = getLegacyRepository(); - List consumers = new ArrayList(); - - MockArtifactConsumer mockConsumer = getMockArtifactConsumer(); - mockConsumer.init( repository ); - - consumers.add( mockConsumer ); - - List files = getLegacyLayoutArtifactPaths(); - for ( Iterator it = files.iterator(); it.hasNext(); ) - { - String path = (String) it.next(); - try - { - mockConsumer.processFile( new BaseFile( repository.getRepositoryURL().getPath(), path ) ); - } - catch ( ConsumerException e ) - { - mockConsumer.getProblemsTracker().addProblem( e ); - } - } - - assertNotNull( consumers ); - - FileProblemsTracker tracker = mockConsumer.getProblemsTracker(); - - assertTracker( tracker, 16 ); - - assertHasFailureMessage( "Path does not match a legacy repository path for an artifact", - "invalid/invalid-1.0.jar", tracker ); - assertHasFailureMessage( "Path filename version is empty", "invalid/jars/invalid.jar", tracker ); - assertHasFailureMessage( "Path does not match a legacy repository path for an artifact", - "invalid/jars/1.0/invalid-1.0.jar", tracker ); - - assertEquals( 10, mockConsumer.getArtifactMap().size() ); - } - - public void testScanDefault() - throws Exception - { - ArchivaRepository repository = getDefaultRepository(); - List consumers = new ArrayList(); - - MockArtifactConsumer mockConsumer = getMockArtifactConsumer(); - mockConsumer.init( repository ); - - consumers.add( mockConsumer ); - - List files = getDefaultLayoutArtifactPaths(); - for ( Iterator it = files.iterator(); it.hasNext(); ) - { - String path = (String) it.next(); - try - { - mockConsumer.processFile( new BaseFile( repository.getRepositoryURL().getPath(), path ) ); - } - catch ( ConsumerException e ) - { - mockConsumer.getProblemsTracker().addProblem( e ); - } - } - - // Test gathered information from Mock consumer. - - assertNotNull( consumers ); - - FileProblemsTracker tracker = mockConsumer.getProblemsTracker(); - - assertTracker( tracker, 21 ); - - assertHasFailureMessage( "Failed to create a snapshot artifact: invalid:invalid:jar:1.0:runtime", - "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar", tracker ); - assertHasFailureMessage( "Path is too short to build an artifact from.", "invalid/invalid-1.0.jar", tracker ); - assertHasFailureMessage( "Built artifact version does not match path version", - "invalid/invalid/1.0/invalid-2.0.jar", tracker ); - - assertEquals( 25, mockConsumer.getArtifactMap().size() ); - - // Test for known include artifacts - - Collection artifacts = mockConsumer.getArtifactMap().values(); - assertHasArtifact( "org.apache.maven", "testing", "1.0", "jar", null, artifacts ); - assertHasArtifact( "org.apache.maven", "some-ejb", "1.0", "jar", "client", artifacts ); - assertHasArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources", artifacts ); - assertHasArtifact( "org.apache.maven", "testing", "1.0", "java-source", "test-sources", artifacts ); - assertHasArtifact( "org.apache.maven", "testing", "1.0", "distribution-zip", null, artifacts ); - assertHasArtifact( "org.apache.maven", "testing", "1.0", "distribution-tgz", null, artifacts ); - assertHasArtifact( "javax.sql", "jdbc", "2.0", "jar", null, artifacts ); - assertHasArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", null, artifacts ); - assertHasArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", "javadoc", artifacts ); - - // Test for known excluded files and dirs to validate exclusions. - - Iterator it = mockConsumer.getArtifactMap().values().iterator(); - while ( it.hasNext() ) - { - Artifact a = (Artifact) it.next(); - assertTrue( "Artifact " + a + " should have it's .getFile() set.", a.getFile() != null ); - assertTrue( "Artifact " + a + " should have it's .getRepository() set.", a.getRepository() != null ); - assertTrue( "Artifact " + a + " should have non-null repository url.", a.getRepository().getUrl() != null ); - assertFalse( "Check not CVS", a.getFile().getPath().indexOf( "CVS" ) >= 0 ); - assertFalse( "Check not .svn", a.getFile().getPath().indexOf( ".svn" ) >= 0 ); - } - } - - private void dumpProblems( FileProblemsTracker tracker ) - { - int problemNum = 0; - System.out.println( "-- ProblemTracker dump -------------------------" ); - for ( Iterator itPaths = tracker.getPaths().iterator(); itPaths.hasNext(); ) - { - String path = (String) itPaths.next(); - System.out.println( " [" + problemNum + "]: " + path ); - - int messageNum = 0; - for ( Iterator itProblems = tracker.getProblems( path ).iterator(); itProblems.hasNext(); ) - { - String message = (String) itProblems.next(); - System.out.println( " [" + messageNum + "]: " + message ); - messageNum++; - } - - problemNum++; - } - } - - private void assertTracker( FileProblemsTracker tracker, int expectedProblemCount ) - { - assertNotNull( "ProblemsTracker should not be null.", tracker ); - - int actualProblemCount = tracker.getProblemCount(); - if ( expectedProblemCount != actualProblemCount ) - { - dumpProblems( tracker ); - fail( "Problem count (across all paths) expected:<" + expectedProblemCount + ">, actual:<" - + actualProblemCount + ">" ); - } - } - - private void assertHasFailureMessage( String message, String path, FileProblemsTracker tracker ) - { - if ( !tracker.hasProblems( path ) ) - { - fail( "There are no messages for expected path [" + path + "]" ); - } - - assertTrue( "Unable to find message [" + message + "] in path [" + path + "]", tracker.getProblems( path ) - .contains( message ) ); - } - - private void assertHasArtifact( String groupId, String artifactId, String version, String type, String classifier, - Collection collection ) - { - for ( Iterator it = collection.iterator(); it.hasNext(); ) - { - Artifact artifact = (Artifact) it.next(); - if ( StringUtils.equals( groupId, artifact.getGroupId() ) - && StringUtils.equals( artifactId, artifact.getArtifactId() ) - && StringUtils.equals( version, artifact.getVersion() ) - && StringUtils.equals( type, artifact.getType() ) - && StringUtils.equals( classifier, artifact.getClassifier() ) ) - { - // Found it! - return; - } - } - - fail( "Was unable to find artifact " + groupId + ":" + artifactId + ":" + version + ":" + type + ":" - + classifier ); - } -} diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockArtifactConsumer.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockArtifactConsumer.java deleted file mode 100644 index 66ad9a209..000000000 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockArtifactConsumer.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.apache.maven.archiva.consumers; - -/* - * 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 org.apache.maven.archiva.common.utils.BaseFile; -import org.apache.maven.archiva.common.utils.PathUtil; -import org.apache.maven.archiva.consumers.core.GenericArtifactConsumer; -import org.apache.maven.artifact.Artifact; - -import java.util.HashMap; -import java.util.Map; - -/** - * MockArtifactConsumer - * - * @author Joakim Erdfelt - * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.common.consumers.Consumers" - * role-hint="mock-artifact" - * instantiation-strategy="per-lookup" - */ -public class MockArtifactConsumer - extends GenericArtifactConsumer -{ - private Map artifactMap = new HashMap(); - - private FileProblemsTracker problemsTracker = new FileProblemsTracker(); - - public void processArtifact( Artifact artifact, BaseFile file ) - { - String relpath = PathUtil.getRelative( repository.getRepositoryURL().getPath(), file ); - artifactMap.put( relpath, artifact ); - } - - public void processFileProblem( BaseFile file, String message ) - { - problemsTracker.addProblem( file, message ); - } - - public Map getArtifactMap() - { - return artifactMap; - } - - public String getName() - { - return "Mock Artifact Consumer (Testing Only)"; - } - - public FileProblemsTracker getProblemsTracker() - { - return problemsTracker; - } -} \ No newline at end of file diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockModelConsumer.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockModelConsumer.java deleted file mode 100644 index 98adf8ee9..000000000 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockModelConsumer.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.apache.maven.archiva.consumers; - -/* - * 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 org.apache.maven.archiva.common.utils.BaseFile; -import org.apache.maven.archiva.consumers.core.GenericModelConsumer; -import org.apache.maven.model.Model; - -import java.util.HashMap; -import java.util.Map; - -/** - * MockModelConsumer - * - * @author Joakim Erdfelt - * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.common.consumers.Consumers" - * role-hint="mock-model" - * instantiation-strategy="per-lookup" - */ -public class MockModelConsumer - extends GenericModelConsumer -{ - private Map modelMap = new HashMap(); - - private FileProblemsTracker problemsTracker = new FileProblemsTracker(); - - public void processModel( Model model, BaseFile file ) - { - modelMap.put( file.getRelativePath(), model ); - } - - public void processFileProblem( BaseFile file, String message ) - { - problemsTracker.addProblem( file, message ); - } - - public Map getModelMap() - { - return modelMap; - } - - public String getName() - { - return "Mock Model Consumer (Testing Only)"; - } - - public FileProblemsTracker getProblemsTracker() - { - return problemsTracker; - } - -} \ No newline at end of file diff --git a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockRepositoryMetadataConsumer.java b/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockRepositoryMetadataConsumer.java deleted file mode 100644 index b58dc57a9..000000000 --- a/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockRepositoryMetadataConsumer.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.maven.archiva.consumers; - -/* - * 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 org.apache.maven.archiva.common.utils.BaseFile; -import org.apache.maven.archiva.consumers.core.GenericRepositoryMetadataConsumer; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; - -import java.util.HashMap; -import java.util.Map; - -/** - * MockRepositoryMetadataConsumer - * - * @author Joakim Erdfelt - * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.common.consumers.Consumers" - * role-hint="mock-metadata" - * instantiation-strategy="per-lookup" - */ -public class MockRepositoryMetadataConsumer - extends GenericRepositoryMetadataConsumer -{ - private Map repositoryMetadataMap = new HashMap(); - - private FileProblemsTracker problemsTracker = new FileProblemsTracker(); - - public void processRepositoryMetadata( RepositoryMetadata metadata, BaseFile file ) - { - repositoryMetadataMap.put( file.getRelativePath(), metadata ); - } - - public void processFileProblem( BaseFile file, String message ) - { - problemsTracker.addProblem( file, message ); - } - - public Map getRepositoryMetadataMap() - { - return repositoryMetadataMap; - } - - public String getName() - { - return "Mock RepositoryMetadata Consumer (Testing Only)"; - } - - public FileProblemsTracker getProblemsTracker() - { - return problemsTracker; - } -} \ No newline at end of file diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java index 5dbd6bfe8..34db1d9bb 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java @@ -21,7 +21,6 @@ package org.apache.maven.archiva.database; import org.apache.maven.archiva.model.ArchivaArtifactModel; import org.apache.maven.archiva.model.ArchivaRepositoryModel; -import org.apache.maven.archiva.model.RepositoryContent; import java.util.List; @@ -73,29 +72,13 @@ public interface ArchivaDAO public void deleteRepository( ArchivaRepositoryModel repository ) throws ArchivaDatabaseException; - /* .\ Repository Content \.____________________________________________________________ */ - - public RepositoryContent createRepositoryContent( String groupId, String artifactId, String version, - String repositoryId ); - - public RepositoryContent getRepositoryContent( String groupId, String artifactId, String version, - String repositoryId ) - throws ObjectNotFoundException, ArchivaDatabaseException; - - public List /**/queryRepositoryContents( Constraint constraint ) - throws ObjectNotFoundException, ArchivaDatabaseException; - - public RepositoryContent saveRepositoryContent( RepositoryContent repoContent ) - throws ArchivaDatabaseException; - - public void deleteRepositoryContent( RepositoryContent repoContent ) - throws ArchivaDatabaseException; - /* .\ Archiva Artifact \. _____________________________________________________________ */ - public ArchivaArtifactModel createArtifact( RepositoryContent repoContent, String classifier, String type ); + public ArchivaArtifactModel createArtifact( String groupId, String artifactId, String version, String classifier, + String type ); - public ArchivaArtifactModel getArtifact( RepositoryContent repoContent, String classifier, String type ) + public ArchivaArtifactModel getArtifact( String groupId, String artifactId, String version, String classifier, + String type ) throws ObjectNotFoundException, ArchivaDatabaseException; public List /**/queryArtifacts( Constraint constraint ) diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java index 87565a825..4eb9cd06e 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java @@ -6,8 +6,6 @@ import org.apache.maven.archiva.database.Constraint; import org.apache.maven.archiva.database.ObjectNotFoundException; import org.apache.maven.archiva.model.ArchivaArtifactModel; import org.apache.maven.archiva.model.ArchivaRepositoryModel; -import org.apache.maven.archiva.model.RepositoryContent; -import org.apache.maven.archiva.model.RepositoryContentKey; import org.codehaus.plexus.logging.AbstractLogEnabled; import java.util.List; @@ -78,70 +76,22 @@ public class JdoArchivaDAO jdo.removeObject( repository ); } - /* .\ Repository Content \.____________________________________________________________ */ - - public RepositoryContent createRepositoryContent( String groupId, String artifactId, String version, - String repositoryId ) - { - RepositoryContent repoContent; - - try - { - repoContent = getRepositoryContent( groupId, artifactId, version, repositoryId ); - } - catch ( ArchivaDatabaseException e ) - { - repoContent = new RepositoryContent( repositoryId, groupId, artifactId, version ); - } - - return repoContent; - } - - public RepositoryContent getRepositoryContent( String groupId, String artifactId, String version, - String repositoryId ) - throws ObjectNotFoundException, ArchivaDatabaseException - { - RepositoryContentKey key = new RepositoryContentKey(); - key.groupId = groupId; - key.artifactId = artifactId; - key.version = version; - key.repositoryId = repositoryId; - - return (RepositoryContent) jdo.getObjectById( RepositoryContent.class, key, null ); - } - - public List queryRepositoryContents( Constraint constraint ) - throws ObjectNotFoundException, ArchivaDatabaseException - { - return jdo.getAllObjects( RepositoryContent.class, constraint ); - } - - public RepositoryContent saveRepositoryContent( RepositoryContent repoContent ) - throws ArchivaDatabaseException - { - return (RepositoryContent) jdo.saveObject( repoContent ); - } - - public void deleteRepositoryContent( RepositoryContent repoContent ) - throws ArchivaDatabaseException - { - jdo.removeObject( repoContent ); - } - /* .\ Archiva Artifact \. _____________________________________________________________ */ - public ArchivaArtifactModel createArtifact( RepositoryContent repoContent, String classifier, String type ) + public ArchivaArtifactModel createArtifact( String groupId, String artifactId, String version, String classifier, String type ) { ArchivaArtifactModel artifact; try { - artifact = getArtifact( repoContent, classifier, type ); + artifact = getArtifact( groupId, artifactId, version, classifier, type ); } catch ( ArchivaDatabaseException e ) { artifact = new ArchivaArtifactModel(); - artifact.setContentKey( repoContent ); + artifact.setGroupId( groupId ); + artifact.setArtifactId( artifactId ); + artifact.setVersion( version ); artifact.setClassifier( classifier ); artifact.setType( type ); } @@ -149,7 +99,7 @@ public class JdoArchivaDAO return artifact; } - public ArchivaArtifactModel getArtifact( RepositoryContent repoContent, String classifier, String type ) + public ArchivaArtifactModel getArtifact( String groupId, String artifactId, String version, String classifier, String type ) throws ObjectNotFoundException, ArchivaDatabaseException {