From 626279bf89d2ee993cc9d2a4cc6d7edcfa3122ee Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Fri, 2 Jul 2010 07:18:44 +0000 Subject: [PATCH] [MRM-980] ability to merge repositories submitted by Patti Arachchige Eshan Sudharaka (for GSoC) o added new plugin module for repository merge git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-980@959880 13f79535-47bb-0310-9956-ffa450edef68 --- archiva-modules/plugins/pom.xml | 3 +- .../plugins/stage-repository-merge/.project | 32 + .../plugins/stage-repository-merge/pom.xml | 112 ++ .../merge/repodetails/SourceAritfacts.java | 161 +++ .../merge/repomerge/ArtifactsMerger.java | 407 ++++++ .../repodetails/SourceArtifactsTest.java | 134 ++ .../merge/repomerge/ArtifactsMergerTest.java | 181 +++ .../archiva/archiva/1.2.1/archiva-1.2.1.jar | 0 .../archiva/archiva/1.2.1/archiva-1.2.1.pom | 1199 +++++++++++++++++ .../archiva/archiva/1.2.1/maven-metadata.xml | 10 + .../apache/archiva/archiva/maven-metadata.xml | 14 + 11 files changed, 2252 insertions(+), 1 deletion(-) create mode 100644 archiva-modules/plugins/stage-repository-merge/.project create mode 100644 archiva-modules/plugins/stage-repository-merge/pom.xml create mode 100644 archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repodetails/SourceAritfacts.java create mode 100644 archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMerger.java create mode 100644 archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repodetails/SourceArtifactsTest.java create mode 100644 archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMergerTest.java create mode 100755 archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.jar create mode 100755 archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom create mode 100755 archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/maven-metadata.xml create mode 100755 archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/maven-metadata.xml diff --git a/archiva-modules/plugins/pom.xml b/archiva-modules/plugins/pom.xml index 6f24b170f..60064b8f0 100644 --- a/archiva-modules/plugins/pom.xml +++ b/archiva-modules/plugins/pom.xml @@ -35,6 +35,7 @@ npanday-support maven1-repository + stage-repository-merge generic-metadata-support - \ No newline at end of file + diff --git a/archiva-modules/plugins/stage-repository-merge/.project b/archiva-modules/plugins/stage-repository-merge/.project new file mode 100644 index 000000000..c7409c45d --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/.project @@ -0,0 +1,32 @@ + + + stage-repository-merge + Archiva is an application for managing one or more remote + repositories, including administration, artifact handling, + browsing and searching. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + archiva-checksum + archiva-common + archiva-configuration + archiva-consumer-api + archiva-model + archiva-policies + archiva-repository-layer + archiva-xml-tools + maven2-repository + metadata-model + metadata-repository-api + problem-reports + test-repository + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/archiva-modules/plugins/stage-repository-merge/pom.xml b/archiva-modules/plugins/stage-repository-merge/pom.xml new file mode 100644 index 000000000..4e273bf24 --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + + plugins + org.apache.archiva + 1.4-SNAPSHOT + + org.apache.archiva + stage-repository-merge + stage-repository-merge + http://maven.apache.org + + + junit + junit + 4.5 + test + + + org.codehaus.plexus + plexus-spring + test + + + org.apache.archiva + metadata-repository-api + 1.4-SNAPSHOT + + + org.apache.archiva + archiva-repository-layer + 1.4-SNAPSHOT + + + org.apache.archiva + maven2-repository + 1.4-SNAPSHOT + + + org.apache.archiva + archiva-model + 1.4-SNAPSHOT + + + org.mockito + mockito-all + 1.8.1 + test + + + org.apache.archiva + test-repository + test + + + org.slf4j + slf4j-jdk14 + test + + + + UTF-8 + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + test-repository + generate-test-resources + + unpack-dependencies + + + test-repository + target/test-repository + META-INF/** + + + + + + + + + org.codehaus.plexus + plexus-component-metadata + 1.0-beta-3.0.5 + + + process-classes + + generate-metadata + + + + process-test-classes + + generate-test-metadata + + + + + + + + diff --git a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repodetails/SourceAritfacts.java b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repodetails/SourceAritfacts.java new file mode 100644 index 000000000..513f06091 --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repodetails/SourceAritfacts.java @@ -0,0 +1,161 @@ +package org.apache.archiva.stagerepository.merge.repodetails; + +/* + * 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.archiva.metadata.repository.MetadataResolver; +import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet; +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.archiva.metadata.model.ArtifactMetadata; + +import java.util.List; +import java.util.Collection; +import java.util.ArrayList; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @plexus.component role="org.apache.archiva.stagerepository.merge.repodetails.SourceAritfacts" + */ +public class SourceAritfacts +{ + + /** + * @plexus.requirement + */ + private MetadataResolver metadataResolver; + + private ArrayList rootNameSpacesList; + + private ArrayList gruopIdList; + + private ArrayList artifactsList; + + private ArrayList artifactsVersionsList; + + private List artifactsListWithDetails; + + private String repoId; + + private static final Logger log = LoggerFactory.getLogger( SourceAritfacts.class ); + + public String getRepoId() + { + return repoId; + } + + public void setRepoId( String repoId ) + { + this.repoId = repoId; + } + + // this methos returns a ArtifactMetaData List.(i guess no harm due to hardcoding the Artifact type and version) + public Collection getSourceArtifactsMetaData( ArchivaArtifact artifact ) + { + + return metadataResolver.getArtifacts( artifact.getRepositoryId(), artifact.getGroupId(), + artifact.getArtifactId(), artifact.getVersion() ); + } + + public Collection getSourceArtifactList() + { + artifactsListWithDetails = new ArrayList(); + + process(); + + return artifactsListWithDetails; + } + + public void setMetadataResolver( MetadataResolver metadataResolver ) + { + this.metadataResolver = metadataResolver; + } + + private void process() + { + // this will get the root name spaces eg : org, com + rootNameSpacesList = (ArrayList) metadataResolver.getRootNamespaces( repoId ); + + gruopIdList = new ArrayList(); + + artifactsList = new ArrayList(); + + // following iterates through the root name spaces list and get the gruo id of relavet root name spaces. + for ( String namespace : rootNameSpacesList ) + { + // this will get the gruop id list of relavant name space . eg : org > archiva(gruop id) + gruopIdList = (ArrayList) metadataResolver.getNamespaces( repoId, namespace ); + + // following will iterates through the particular gruop id 's + for ( String gruopId : gruopIdList ) + { + // parse the parameters "repoId" and "namespace + gruop id "to artifacts list. eg : params = ("internal" + // , "org.archiva") + artifactsList = (ArrayList) metadataResolver.getNamespaces( repoId, namespace + "." + gruopId ); + + for ( String artifact : artifactsList ) + { + // iterates through the artifacts and get the available versions of a particular artifact + artifactsVersionsList = + (ArrayList) metadataResolver.getProjectVersions( repoId, namespace + "." + gruopId, + artifact ); + + for ( String version : artifactsVersionsList ) + { + // assign gathered attributes Artifact object and add it in to the list + artifactsListWithDetails.addAll( getArtifactMetadata( repoId, gruopId, artifact, version ) ); + + } + } + } + } + + } + + private Collection getArtifactMetadata( String repoId, String gruopId, String artifactId, + String version ) + { + MavenArtifactFacet facet = null; + + List artifactList = new ArrayList(); + + ArrayList artifactMetaDataList = + (ArrayList) metadataResolver.getArtifacts( repoId, gruopId, artifactId, version ); + + for ( ArtifactMetadata artifactMetadata : artifactMetaDataList ) + { + + facet = (MavenArtifactFacet) artifactMetadata.getFacet( MavenArtifactFacet.FACET_ID ); + + if ( facet != null ) + { + artifactList.add( new ArchivaArtifact( gruopId, artifactId, version, facet.getClassifier(), + facet.getType(), repoId ) ); + + } + else + { + artifactList.add( new ArchivaArtifact( gruopId, artifactId, version, "", "jar", repoId ) ); + } + + } + return artifactList; + } +} diff --git a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMerger.java b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMerger.java new file mode 100644 index 000000000..9e24c8d45 --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMerger.java @@ -0,0 +1,407 @@ +package org.apache.archiva.stagerepository.merge.repomerge; + +/* + * 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.archiva.stagerepository.merge.repodetails.SourceAritfacts; +import org.apache.archiva.metadata.repository.MetadataResolver; +import org.apache.archiva.metadata.model.ArtifactMetadata; +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.repository.ManagedRepositoryContent; +import org.apache.maven.archiva.repository.RepositoryContentFactory; +import org.apache.maven.archiva.repository.RepositoryNotFoundException; +import org.apache.maven.archiva.repository.RepositoryException; +import org.apache.maven.archiva.repository.metadata.MetadataTools; +import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException; +import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader; +import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter; +import org.apache.maven.archiva.common.utils.VersionComparator; +import org.apache.maven.archiva.common.utils.VersionUtil; + +import java.util.*; +import java.io.File; +import java.io.IOException; +import java.io.FileOutputStream; +import java.io.FileInputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * @plexus.component role="org.apache.archiva.stagerepository.merge.repomerge.ArtifactsMerger" + */ +public class ArtifactsMerger +{ + + /** + * @plexus.requirement + */ + private MetadataResolver metadataResolver; + + /** + * @plexus.requirement + */ + private RepositoryContentFactory repositoryFactory; + + /** + * @plexus.requirement role-hint="default" + */ + private ArchivaConfiguration configuration; + + private SourceAritfacts sourceArtifacts; + + private String targetRepo; + + private String sourceRepo; + + private ArrayList sourceArtifactsList; + + private Configuration config; + + private ManagedRepositoryConfiguration targetRepoConfig; + + private ManagedRepositoryConfiguration sourceRepoConfig; + + private ManagedRepositoryContent targetRepository; + + private ManagedRepositoryContent sourceRepository; + + private final static String PATH_SEPERATOR = "/"; + + public void setMetadataResolver( MetadataResolver metadataResolver ) + { + this.metadataResolver = metadataResolver; + } + + public void setSourceArtifacts( SourceAritfacts sourceArtifacts ) + { + this.sourceArtifacts = sourceArtifacts; + setSourceArtifactsList(); + } + + public void setConfiguration( ArchivaConfiguration configuration ) + { + this.configuration = configuration; + } + + public void setRepositoryFactory( RepositoryContentFactory repositoryFactory ) + { + this.repositoryFactory = repositoryFactory; + } + + public ArtifactsMerger( String targetRepo, String sourceRepo ) + { + this.targetRepo = targetRepo; + this.sourceRepo = sourceRepo; + + } + + private void setSourceArtifactsList() + { + sourceArtifacts.setRepoId( sourceRepo ); + sourceArtifactsList = (ArrayList) sourceArtifacts.getSourceArtifactList(); + } + + private boolean isArtifactAvailableIntagerRepo( ArchivaArtifact artifact ) + { + + boolean isAvailable = false; + + Collection list = + metadataResolver.getArtifacts( targetRepo, artifact.getGroupId(), artifact.getArtifactId(), + artifact.getVersion() ); + + if ( list.isEmpty() ) + { + isAvailable = false; + } + else + { + isAvailable = true; + } + return isAvailable; + } + + public void doMerge() + throws Exception + { + try + { + config = configuration.getConfiguration(); + + targetRepoConfig = config.findManagedRepositoryById( targetRepo ); + + targetRepository = repositoryFactory.getManagedRepositoryContent( targetRepo ); + + sourceRepoConfig = config.findManagedRepositoryById( sourceRepo ); + + sourceRepository = repositoryFactory.getManagedRepositoryContent( sourceRepo ); + + // iterates through available arfifacts list + for ( ArchivaArtifact sourceArtifact : sourceArtifactsList ) + { + + if ( isArtifactAvailableIntagerRepo( sourceArtifact ) ) + { + // TODO here we need to implement replacing the exixting one + } + else + { + // when the artifact does not exist in the repo folder structure creation is done + createFolderStructure( sourceArtifact ); + } + } + } + catch ( RepositoryNotFoundException re ) + { + throw re; + } + catch ( RepositoryException rep ) + { + throw rep; + } + } + + private void createFolderStructure( ArchivaArtifact artifact ) + throws IOException, RepositoryMetadataException + { + + Date lastUpdatedTimestamp = Calendar.getInstance().getTime(); + + TimeZone timezone = TimeZone.getTimeZone( "UTC" ); + + DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" ); + + fmt.setTimeZone( timezone ); + + String timestamp = fmt.format( lastUpdatedTimestamp ); + + String targetRepoPath = targetRepoConfig.getLocation(); + + String sourceRepoPath = sourceRepoConfig.getLocation(); + + String artifactPath = sourceRepository.toPath( artifact ); + + File sourceArtifactFile = new File( sourceRepoPath, artifactPath ); + + File targetArtifactFile = new File( targetRepoPath, artifactPath ); + + int lastIndex = artifactPath.lastIndexOf( '/' ); + + // create a file object to the artifact version directory eg + // :/boot/gsoc/apps/apache-archiva-1.4-SNAPSHOT/data/repositories/internal/ant/ant/1.5.1 + File targetFile = new File( targetRepoPath, artifactPath.substring( 0, lastIndex ) ); + + if ( !targetFile.exists() ) + { + // create the folder structure when it does not exist + targetFile.mkdirs(); + } + + // artifact copying + copyFile( sourceArtifactFile, targetArtifactFile ); + // pom file copying + String index = artifactPath.substring( lastIndex + 1 ); + int last = index.lastIndexOf( '.' ); + File sourcePomFile = + new File( sourceRepoPath, artifactPath.substring( 0, lastIndex ) + "/" + + artifactPath.substring( lastIndex + 1 ).substring( 0, last ) + ".pom" ); + File targetPomFile = + new File( targetRepoPath, artifactPath.substring( 0, lastIndex ) + "/" + + artifactPath.substring( lastIndex + 1 ).substring( 0, last ) + ".pom" ); + + if ( !targetPomFile.exists() ) + { + copyFile( sourcePomFile, targetPomFile ); + } + + // explicitly update only if metadata-updater consumer is not enabled! + if ( !config.getRepositoryScanning().getKnownContentConsumers().contains( "metadata-updater" ) ) + { + + // maven version meta data file copying + + File versionMetadataFileInSourceArtifact = + new File( sourceRepoPath, artifactPath.substring( 0, lastIndex ) + "/" + MetadataTools.MAVEN_METADATA ); + + File versionMetadataFileInTargetArtifact = null; + + // check metadata xml is available in source repo. if there is a metadata xml we are going to merge is as + // well + if ( versionMetadataFileInSourceArtifact.exists() ) + { + versionMetadataFileInTargetArtifact = + new File( targetRepoPath, artifactPath.substring( 0, lastIndex ) + "/" + + MetadataTools.MAVEN_METADATA ); + + // check metadata xml is available in target repo. if it is not available copy it from the source + // artifact + if ( !versionMetadataFileInTargetArtifact.exists() ) + { + copyFile( versionMetadataFileInSourceArtifact, versionMetadataFileInTargetArtifact ); + } + else + { + // if version metadata file exists then update it. + updateVersionMetadata( versionMetadataFileInTargetArtifact, artifact, lastUpdatedTimestamp, + timestamp ); + } + } + + // project level maven meta data xml copying + String projectDirectoryInSourceRepo = + new File( versionMetadataFileInSourceArtifact.getParent() ).getParent(); + File projectMetadataFileInSourceArtifact = + new File( projectDirectoryInSourceRepo, MetadataTools.MAVEN_METADATA ); + + // check metadata xml is available in source repo. if there is a metadata xml we are going to merge is as + // well + if ( projectMetadataFileInSourceArtifact.exists() ) + { + + String projectDirectoryInTargetRepo = + new File( versionMetadataFileInTargetArtifact.getParent() ).getParent(); + File projectMetadataFileInTargetArtifact = + new File( projectDirectoryInTargetRepo, MetadataTools.MAVEN_METADATA ); + // check metadata xml is available in target repo.if it is not available copy it from the source + // artifact + if ( !projectMetadataFileInTargetArtifact.exists() ) + { + copyFile( projectMetadataFileInSourceArtifact, projectMetadataFileInTargetArtifact ); + } + else + { + // // if project metadata file exists then update it. + updateProjectMetadata( projectMetadataFileInTargetArtifact, artifact, lastUpdatedTimestamp, + timestamp ); + } + } + } + } + + private void copyFile( File sourceFile, File targetFile ) + throws IOException + { + + FileOutputStream out = new FileOutputStream( targetFile ); + FileInputStream input = new FileInputStream( sourceFile ); + + try + { + int i; + while ( ( i = input.read() ) != -1 ) + { + out.write( i ); + } + out.flush(); + } + finally + { + out.close(); + input.close(); + } + } + + /** + * Update artifact level metadata. + */ + private void updateProjectMetadata( File projectMetaDataFileIntargetRepo, ArchivaArtifact artifact, + Date lastUpdatedTimestamp, String timestamp ) + throws RepositoryMetadataException + { + ArrayList availableVersions = new ArrayList(); + String latestVersion = ""; + + ArchivaRepositoryMetadata projectMetadata = getMetadata( projectMetaDataFileIntargetRepo ); + + if ( projectMetaDataFileIntargetRepo.exists() ) + { + availableVersions = (ArrayList) projectMetadata.getAvailableVersions(); + + Collections.sort( availableVersions, VersionComparator.getInstance() ); + + if ( !availableVersions.contains( artifact.getVersion() ) ) + { + availableVersions.add( artifact.getVersion() ); + } + + latestVersion = availableVersions.get( availableVersions.size() - 1 ); + } + else + { + availableVersions.add( artifact.getVersion() ); + projectMetadata.setGroupId( artifact.getGroupId() ); + projectMetadata.setArtifactId( artifact.getArtifactId() ); + } + + if ( projectMetadata.getGroupId() == null ) + { + projectMetadata.setGroupId( artifact.getGroupId() ); + } + + if ( projectMetadata.getArtifactId() == null ) + { + projectMetadata.setArtifactId( artifact.getArtifactId() ); + } + + projectMetadata.setLatestVersion( latestVersion ); + projectMetadata.setAvailableVersions( availableVersions ); + projectMetadata.setLastUpdated( timestamp ); + projectMetadata.setLastUpdatedTimestamp( lastUpdatedTimestamp ); + + if ( !VersionUtil.isSnapshot( artifact.getVersion() ) ) + { + projectMetadata.setReleasedVersion( latestVersion ); + } + + RepositoryMetadataWriter.write( projectMetadata, projectMetaDataFileIntargetRepo ); + + } + + private void updateVersionMetadata( File versionMetaDataFileInTargetRepo, ArchivaArtifact artifact, + Date lastUpdatedTimestamp, String timestamp ) + throws RepositoryMetadataException + { + ArchivaRepositoryMetadata versionMetadata = getMetadata( versionMetaDataFileInTargetRepo ); + if ( !versionMetaDataFileInTargetRepo.exists() ) + { + versionMetadata.setGroupId( artifact.getGroupId() ); + versionMetadata.setArtifactId( artifact.getArtifactId() ); + versionMetadata.setVersion( artifact.getVersion() ); + } + + // versionMetadata.getSnapshotVersion().setTimestamp(timestamp); + versionMetadata.setLastUpdatedTimestamp( lastUpdatedTimestamp ); + RepositoryMetadataWriter.write( versionMetadata, versionMetaDataFileInTargetRepo ); + } + + private ArchivaRepositoryMetadata getMetadata( File metadataFile ) + throws RepositoryMetadataException + { + ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata(); + if ( metadataFile.exists() ) + { + metadata = RepositoryMetadataReader.read( metadataFile ); + } + return metadata; + } +} diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repodetails/SourceArtifactsTest.java b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repodetails/SourceArtifactsTest.java new file mode 100644 index 000000000..8c045a730 --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repodetails/SourceArtifactsTest.java @@ -0,0 +1,134 @@ +package org.apache.archiva.stagerepository.merge.repodetails; + +/* + * 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.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.junit.Test; + +import org.apache.archiva.metadata.repository.MetadataResolver; +import org.apache.archiva.metadata.model.ArtifactMetadata; + +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.easymock.MockControl; +import org.codehaus.plexus.spring.PlexusInSpringTestCase; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class SourceArtifactsTest + extends PlexusInSpringTestCase +{ + + private Logger log = LoggerFactory.getLogger( SourceArtifactsTest.class ); + + private MockControl metadataResolverControl; + + private MetadataResolver metadataResolver; + + private static final String TEST_REPO_ID = "internal"; + + private SourceAritfacts sourceArtifacts; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + sourceArtifacts = new SourceAritfacts(); + sourceArtifacts.setRepoId( TEST_REPO_ID ); + metadataResolverControl = MockControl.createControl( MetadataResolver.class ); + metadataResolver = (MetadataResolver) metadataResolverControl.getMock(); + sourceArtifacts.setMetadataResolver( metadataResolver ); + } + + @Test + public void testSourceArtifacts() + { + + metadataResolverControl.expectAndReturn( metadataResolver.getRootNamespaces( TEST_REPO_ID ), getRootNameSpace() ); + + metadataResolverControl.expectAndReturn( metadataResolver.getNamespaces( TEST_REPO_ID, "org" ), getNameSpace() ); + + metadataResolverControl.expectAndReturn( metadataResolver.getNamespaces( TEST_REPO_ID, "org" + "." + "apache" ), + getProject() ); + + metadataResolverControl.expectAndReturn( metadataResolver.getProjectVersions( TEST_REPO_ID, "org" + "." + + "apache", "archiva" ), getProjectVersions() ); + + metadataResolverControl.expectAndReturn( metadataResolver.getArtifacts( TEST_REPO_ID, "apache", "archiva", + "1.6" ), getArtiFactMetaData() ); + + metadataResolverControl.expectAndReturn( metadataResolver.getArtifacts( TEST_REPO_ID, "apache", "archiva", + "1.6" ), getArtiFactMetaData() ); + + metadataResolverControl.replay(); + + Collection list = sourceArtifacts.getSourceArtifactList(); + assertEquals( false, list.isEmpty() ); + + ArrayList metadataList = + (ArrayList) sourceArtifacts.getSourceArtifactsMetaData( list.iterator().next() ); + assertEquals( 2, metadataList.size() ); + + metadataResolverControl.verify(); + + } + + private Collection getRootNameSpace() + { + List artifactList = new ArrayList(); + artifactList.add( "org" ); + return artifactList; + } + + private Collection getNameSpace() + { + List namespace = new ArrayList(); + namespace.add( "apache" ); + return namespace; + } + + private Collection getProject() + { + List namespace = new ArrayList(); + namespace.add( "archiva" ); + return namespace; + } + + private Collection getProjectVersions() + { + List versionList = new ArrayList(); + versionList.add( "1.6" ); + return versionList; + } + + private Collection getArtiFactMetaData() + { + List metaDataList = new ArrayList(); + ArtifactMetadata metaDataOne = new ArtifactMetadata(); + ArtifactMetadata metaDataTwo = new ArtifactMetadata(); + metaDataList.add( metaDataOne ); + metaDataList.add( metaDataTwo ); + return metaDataList; + } +} diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMergerTest.java b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMergerTest.java new file mode 100644 index 000000000..4f39b0ea2 --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/repomerge/ArtifactsMergerTest.java @@ -0,0 +1,181 @@ +package org.apache.archiva.stagerepository.merge.repomerge; + +/* + * 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 static org.junit.Assert.assertNotNull; +import org.junit.Before; +import org.junit.Test; +import static org.mockito.Mockito.stub; + +import static org.mockito.Mockito.verify; +import org.mockito.MockitoAnnotations; +import static org.mockito.Mockito.*; +import org.codehaus.plexus.spring.PlexusInSpringTestCase; +import org.apache.maven.archiva.repository.RepositoryContentFactory; +import org.apache.maven.archiva.repository.ManagedRepositoryContent; +import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.archiva.stagerepository.merge.repodetails.SourceAritfacts; +import org.apache.archiva.metadata.model.ArtifactMetadata; +import org.apache.archiva.metadata.repository.MetadataResolver; +//import com.sun.xml.internal.ws.api.wsdl.parser.MetaDataResolver; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.io.File; + +public class ArtifactsMergerTest + extends PlexusInSpringTestCase +{ + + private static final String SOURCE_REPOSITORY_ID = "test-repository"; + + private static final String TARGET_REPOSITORY_ID = "target-repo"; + + // private static final String TARGET_REPOSITORY_ID = "target-repo"; + + private Configuration config; + + @MockitoAnnotations.Mock + private MetadataResolver metadataResolver; + + private RepositoryContentFactory repositoryFactory; + + private ArchivaConfiguration configuration; + + private SourceAritfacts sourceArtifacts; + + private ArtifactsMerger merger; + + @Before + public void setUp() + { + MockitoAnnotations.initMocks( this ); + metadataResolver = mock( MetadataResolver.class ); + repositoryFactory = mock( RepositoryContentFactory.class ); + configuration = mock( ArchivaConfiguration.class ); + sourceArtifacts = mock( SourceAritfacts.class ); + sourceArtifacts.setRepoId( SOURCE_REPOSITORY_ID ); + sourceArtifacts.setMetadataResolver( metadataResolver ); + setRepositoryConfigurations(); + merger = new ArtifactsMerger( TARGET_REPOSITORY_ID, SOURCE_REPOSITORY_ID ); + merger.setConfiguration( configuration ); + merger.setRepositoryFactory( repositoryFactory ); + merger.setMetadataResolver( metadataResolver ); + setSourceArtifacts(); + } + + @Test + public void setSourceArtifacts() + { + when( sourceArtifacts.getSourceArtifactList() ).thenReturn( getArtifacts() ); + merger.setSourceArtifacts( sourceArtifacts ); + verify( sourceArtifacts ).getSourceArtifactList(); + } + + @Test + public void testDomerge() + throws Exception + { + ManagedRepositoryContent sourceRepoContent = new ManagedDefaultRepositoryContent(); + sourceRepoContent.setRepository( config.findManagedRepositoryById( SOURCE_REPOSITORY_ID ) ); + + ManagedRepositoryContent targetRepoContent = new ManagedDefaultRepositoryContent(); + sourceRepoContent.setRepository( config.findManagedRepositoryById( TARGET_REPOSITORY_ID ) ); + + when( configuration.getConfiguration() ).thenReturn( config ); + when( repositoryFactory.getManagedRepositoryContent( SOURCE_REPOSITORY_ID ) ).thenReturn( sourceRepoContent ); + when( repositoryFactory.getManagedRepositoryContent( TARGET_REPOSITORY_ID ) ).thenReturn( targetRepoContent ); + when( sourceArtifacts.getSourceArtifactList() ).thenReturn( getArtifacts() ); + when( metadataResolver.getArtifacts( TARGET_REPOSITORY_ID, "archiva", "archiva", "1.2.1" ) ).thenReturn( getMetaDataList() ); + merger.doMerge(); + + // verify(configuration); + // verify(repositoryFactory); + // verify(repositoryFactory); + // verify(sourceArtifacts); + verify( configuration ).getConfiguration(); + verify( repositoryFactory ).getManagedRepositoryContent( SOURCE_REPOSITORY_ID ); + verify( repositoryFactory ).getManagedRepositoryContent( TARGET_REPOSITORY_ID ); + verify( sourceArtifacts ).getSourceArtifactList(); + verify( metadataResolver ).getArtifacts( TARGET_REPOSITORY_ID, "org.apache.archiva", "archiva", "1.2.1" ); + } + + public Collection getArtifacts() + { + ArchivaArtifact a1 = + new ArchivaArtifact( "org.apache.archiva", "archiva", "1.2.1", "", "jar", SOURCE_REPOSITORY_ID ); + ArchivaArtifact a2 = + new ArchivaArtifact( "org.apache.archiva", "archiva", "1.5", "", "jar", SOURCE_REPOSITORY_ID ); + ArrayList list = new ArrayList(); + list.add( a1 ); + // list.add(a2) ; + return list; + } + + public Collection getMetaDataList() + { + ArtifactMetadata m1 = new ArtifactMetadata(); + m1.setNamespace( "org.apache.archiva" ); + m1.setProject( "archiva" ); + m1.setVersion( "1.2.1" ); + ArrayList list = new ArrayList(); + list.add( m1 ); + return list; + } + + public void setRepositoryConfigurations() + { + File sourceRepoFile = new File( getBasedir(), "src/test/resources/test-repository" ); + File targetRepoFile = new File( getBasedir(), "src/test/resources/target-repo" ); + // sourceRepoFile.mkdirs(); + // targetRepoFile.mkdirs(); + + assertTrue( sourceRepoFile.exists() ); + this.config = new Configuration(); + RepositoryScanningConfiguration repoScanConfig = new RepositoryScanningConfiguration(); + List knownContentConsumers = new ArrayList(); + knownContentConsumers.add( "metadata-updater12" ); + repoScanConfig.setKnownContentConsumers( knownContentConsumers ); + config.setRepositoryScanning( repoScanConfig ); + // config.setManagedRepositories(); + ManagedRepositoryConfiguration sourceRepoConfig = new ManagedRepositoryConfiguration(); + sourceRepoConfig.setId( SOURCE_REPOSITORY_ID ); + sourceRepoConfig.setLayout( "default" ); + sourceRepoConfig.setLocation( sourceRepoFile.getPath() ); + sourceRepoConfig.setName( SOURCE_REPOSITORY_ID ); + sourceRepoConfig.setBlockRedeployments( true ); + + ManagedRepositoryConfiguration targetRepoConfig = new ManagedRepositoryConfiguration(); + targetRepoConfig.setId( TARGET_REPOSITORY_ID ); + targetRepoConfig.setLayout( "default" ); + targetRepoConfig.setLocation( targetRepoFile.getPath() ); + targetRepoConfig.setName( TARGET_REPOSITORY_ID ); + targetRepoConfig.setBlockRedeployments( true ); + + this.config.addManagedRepository( sourceRepoConfig ); + this.config.addManagedRepository( targetRepoConfig ); + } +} diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.jar b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.jar new file mode 100755 index 000000000..e69de29bb diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom new file mode 100755 index 000000000..cccf51781 --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom @@ -0,0 +1,1199 @@ + + + + + + 4.0.0 + + 2.0.6 + + + + org.apache.archiva + archiva-parent + 3 + ../parent/pom.xml + + Archiva + archiva + pom + 1.2.1 + http://archiva.apache.org + + scm:svn:http://svn.apache.org/repos/asf/archiva/tags/archiva-1.2.1 + scm:svn:https://svn.apache.org/repos/asf/archiva/tags/archiva-1.2.1 + http://svn.apache.org/viewvc/archiva/tags/archiva-1.2.1 + + + + + + + org.apache.maven.plugins + maven-remote-resources-plugin + + + + process + + + + org.apache:apache-jar-resource-bundle:1.3 + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0-alpha-4 + + + + enforce + + + + + + org.codehaus.plexus:plexus-container-default + org.codehaus.plexus:plexus-log4j-logging + commons-logging:commons-logging + velocity:velocity-dep + classworlds:classworlds + javax.transaction:jta + javax.sql:jdbc-stdext + ant:ant-optional + xom:xom + org.codehaus.plexus:plexus-xwork-integration + + + + + + + + + org.codehaus.plexus + plexus-component-metadata + 1.0-beta-3.0.5 + + + generate + + generate-metadata + + + + + + + + + org.codehaus.modello + modello-maven-plugin + 1.0 + + true + + + + org.codehaus.modello + modello-plugin-plexus-registry + 1.0-alpha-21 + + + org.codehaus.modello + modello-plugin-jpox + 1.0-alpha-21 + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2-beta-3 + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-remote-resources-plugin + 1.0-beta-2 + + + org.apache.maven.plugins + maven-deploy-plugin + 2.3 + + + org.apache.maven.plugins + maven-gpg-plugin + 1.0-alpha-4 + + + org.apache.maven.plugins + maven-install-plugin + 2.2 + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + org.apache.maven.plugins + maven-release-plugin + 2.0-beta-7 + + https://svn.apache.org/repos/asf/archiva/tags + false + deploy + clean install + -Prelease + + + + org.apache.maven.plugins + maven-resources-plugin + 2.2 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.4.2 + + true + + + + maven-idea-plugin + + 1.5 + + + + + + + archiva-cli + archiva-docs + archiva-jetty + archiva-modules + + + + junit + junit + 3.8.1 + test + + + easymock + easymock + 1.2_Java1.3 + test + + + easymock + easymockclassextension + 1.2 + test + + + + + + httpunit + httpunit + 1.6.2 + test + + + org.apache.jackrabbit + jackrabbit-webdav + 1.5.0 + + + commons-logging + commons-logging + + + + + xerces + xercesImpl + 2.8.1 + + + org.sonatype.nexus + nexus-indexer + 2.0.0 + + + org.codehaus.plexus + plexus-container-default + + + classworlds + classworlds + + + commons-logging + commons-logging + + + velocity + velocity-dep + + + org.apache.maven + maven-plugin-registry + + + org.apache.maven + maven-settings + + + + + javax.activation + activation + 1.1 + + + org.apache.archiva + archiva-applet + 1.2.1 + + + org.apache.archiva + archiva-artifact-converter + 1.2.1 + + + org.apache.archiva + archiva-artifact-reports + 1.2.1 + + + org.apache.archiva + archiva-checksum + 1.2.1 + + + org.apache.archiva + archiva-common + 1.2.1 + + + org.apache.archiva + archiva-configuration + 1.2.1 + + + org.apache.archiva + archiva-consumer-api + 1.2.1 + + + org.apache.archiva + archiva-converter + 1.2.1 + + + org.apache.archiva + archiva-dependency-graph + 1.2.1 + + + org.apache.archiva + archiva-core + 1.2-SNAPSHOT + + + org.apache.archiva + archiva-core-consumers + 1.2.1 + + + org.apache.archiva + archiva-database + 1.2.1 + + + org.apache.archiva + archiva-database-consumers + 1.2.1 + + + org.apache.archiva + archiva-indexer + 1.2.1 + + + org.apache.archiva + archiva-lucene-consumers + 1.2.1 + + + org.apache.archiva + archiva-model + 1.2.1 + + + org.apache.archiva + archiva-policies + 1.2.1 + + + org.apache.archiva + archiva-proxy + 1.2.1 + + + org.apache.archiva + archiva-report-manager + 1.2.1 + + + org.apache.archiva + archiva-repository-layer + 1.2.1 + + + org.apache.archiva + archiva-scheduled + 1.2.1 + + + org.apache.archiva + archiva-security + 1.2.1 + + + org.apache.archiva + archiva-signature-consumers + 1.2.1 + + + org.apache.archiva + archiva-transaction + 1.2.1 + + + org.apache.archiva + archiva-docs + 1.2.1 + zip + docs + + + org.apache.archiva + archiva-webapp + 1.2.1 + war + + + org.apache.archiva + archiva-xml-tools + 1.2.1 + + + org.apache.archiva + archiva-webdav + 1.2.1 + + + org.apache.archiva + archiva-rss + 1.2.1 + + + org.apache.archiva + archiva-xmlrpc-api + 1.2.1 + + + org.apache.archiva + archiva-xmlrpc-services + 1.2.1 + + + org.apache.archiva + archiva-xmlrpc-security + 1.2.1 + + + org.codehaus.plexus + plexus-spring + 1.2 + + + org.codehaus.plexus + plexus-container-default + + + + + stax + stax + 1.2.0 + + + commons-codec + commons-codec + 1.3 + + + commons-collections + commons-collections + 3.2 + + + commons-fileupload + commons-fileupload + 1.2 + + + commons-io + commons-io + 1.4 + + + commons-lang + commons-lang + 2.2 + + + org.apache.derby + derby + 10.1.3.1 + + + org.apache.derby + derbytools + 10.1.3.1 + + + dom4j + dom4j + 1.6.1 + + + hsqldb + hsqldb + 1.8.0.7 + test + + + jaxen + jaxen + 1.1 + + + xom + xom + + + + + javax.jdo + jdo2-api + 2.0 + + + jpox + jpox + 1.1.9 + + + javax.transaction + jta + + + + + javax.servlet + jsp-api + 2.0 + provided + + + javax.servlet + jstl + 1.1.2 + + + log4j + log4j + 1.2.14 + + + org.apache.lucene + lucene-core + 2.4.0 + + + org.apache.lucene + lucene-queries + 2.4.0 + + + javax.mail + mail + 1.4 + + + org.apache.xmlrpc + xmlrpc-server + 3.1 + + + org.apache.maven + maven-artifact-manager + ${maven.version} + + + org.codehaus.plexus + plexus-container-default + + + + + org.apache.maven + maven-model + ${maven.version} + + + org.apache.maven + maven-repository-metadata + ${maven.version} + + + org.codehaus.plexus + plexus-component-api + 1.0-alpha-22 + + + org.codehaus.plexus + plexus-digest + 1.1 + + + org.codehaus.plexus + plexus-expression-evaluator + 1.0-rc1 + + + org.codehaus.plexus + plexus-container-default + + + + + org.codehaus.plexus + plexus-i18n + 1.0-beta-6 + + + org.codehaus.plexus + plexus-container-default + + + + + org.codehaus.plexus + plexus-jdo2 + 1.0-alpha-8 + + + org.codehaus.plexus + plexus-container-default + + + + + org.codehaus.plexus + plexus-quartz + 1.0-alpha-3 + + + commons-logging + commons-logging + + + org.codehaus.plexus + plexus-container-default + + + + + org.codehaus.plexus + plexus-slf4j-logging + 1.1-alpha-1 + + + org.slf4j + slf4j-simple + + + org.codehaus.plexus + plexus-container-default + + + + + org.codehaus.plexus + plexus-taskqueue + 1.0-alpha-8 + + + org.codehaus.plexus + plexus-utils + 1.4.5 + + + org.codehaus.plexus.cache + plexus-cache-api + 1.0-alpha-2 + + + org.codehaus.plexus + plexus-container-default + + + + + org.codehaus.plexus.cache + plexus-cache-ehcache + 1.0-alpha-2 + + + org.codehaus.plexus + plexus-container-default + + + + + + + + org.codehaus.redback + redback-rbac-memory + ${redback.version} + test + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-users-memory + ${redback.version} + test + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-keys-memory + ${redback.version} + test + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-rbac-model + ${redback.version} + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-authorization-rbac + ${redback.version} + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-rbac-role-manager + ${redback.version} + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-system + ${redback.version} + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-common-integrations + ${redback.version} + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-struts2-content + ${redback.version} + war + + + classworlds + classworlds + + + commons-logging + commons-logging + + + + + org.codehaus.redback + redback-struts2-integration + ${redback.version} + + + classworlds + classworlds + + + velocity + velocity-dep + + + commons-logging + commons-logging + + + + + + + + org.codehaus.plexus.registry + plexus-registry-api + 1.0-alpha-2 + + + org.codehaus.plexus + plexus-container-default + + + + + org.codehaus.plexus.registry + plexus-registry-commons + 1.0-alpha-2 + + + ant + ant-optional + + + jdom + jdom + + + commons-logging + commons-logging-api + + + commons-logging + commons-logging + + + + + javax.servlet + servlet-api + 2.4 + + + opensymphony + sitemesh + 2.2.1 + + + org.slf4j + jcl104-over-slf4j + 1.5.0 + runtime + + + org.slf4j + slf4j-api + 1.5.0 + + + org.slf4j + slf4j-simple + 1.5.0 + test + + + org.slf4j + slf4j-log4j12 + 1.5.0 + runtime + + + taglibs + standard + 1.1.2 + + + org.apache.maven.wagon + wagon-file + ${wagon.version} + + + org.apache.maven.wagon + wagon-http-lightweight + ${wagon.version} + + + nekohtml + xercesMinimal + + + + + org.apache.maven.wagon + wagon-provider-api + ${wagon.version} + + + org.apache.struts + struts2-core + 2.0.11.2 + + + commons-logging + commons-logging + + + + + org.apache.struts + struts2-spring-plugin + 2.0.11.2 + + + commons-logging + commons-logging + + + + + xmlunit + xmlunit + 1.0 + + + joda-time + joda-time + 1.5.2 + + + org.mortbay.jetty + jetty + ${jetty.version} + + + + + com.atlassian.xmlrpc + atlassian-xmlrpc-binder-annotations + ${binder.version} + + + com.atlassian.xmlrpc + atlassian-xmlrpc-binder-server-spring + ${binder.version} + + + commons-logging + commons-logging + + + + + com.atlassian.xmlrpc + atlassian-xmlrpc-binder + ${binder.version} + + + com.atlassian.xmlrpc + atlassian-xmlrpc-binder-testing + ${binder.version} + test + + + + + org.springframework + spring-context + ${spring.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-web + ${spring.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-beans + ${spring.version} + + + commons-logging + commons-logging + + + + + + org.apache.maven + maven-artifact + ${maven.version} + + + org.apache.maven + maven-project + ${maven.version} + + + org.codehaus.plexus + plexus-container-default + + + + + jdom + jdom + 1.0 + + + org.apache.maven.shared + maven-model-converter + 2.1 + + + org.codehaus.plexus + plexus-container-default + + + + + net.sf.ehcache + ehcache + 1.3.0 + + + commons-logging + commons-logging + + + + + + + 2.0.8 + 1.0-beta-5 + 1.2.1 + 6.1.6 + 0.9 + 2.5.6 + + + + release + + + + maven-assembly-plugin + false + + + src/main/assembly/src.xml + + gnu + apache-archiva-${project.version}-src + + + + make-assembly + package + + single + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + + ${gpg.passphrase} + + + + + sign + + + + + + + true + org.apache.maven.plugins + maven-deploy-plugin + + ${deploy.altRepository} + true + + + + org.apache.maven.plugins + maven-source-plugin + 2.0.4 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.4 + + + attach-javadocs + + jar + + + + + + + + + + + + true + + + false + + sonatype.public + Sonatype Public Repo + http://repository.sonatype.org/content/repositories/sonatype-apache-releases + + + + false + + + true + + codehaus.org.snapshots + Codehaus Snapshots Repository + http://snapshots.repository.codehaus.org + + + diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/maven-metadata.xml b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/maven-metadata.xml new file mode 100755 index 000000000..574abc2aa --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/maven-metadata.xml @@ -0,0 +1,10 @@ + + + + org.apache.archiva + archiva + 1.2.1 + + 20100702064543 + + diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/maven-metadata.xml b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/maven-metadata.xml new file mode 100755 index 000000000..96384b60c --- /dev/null +++ b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/maven-metadata.xml @@ -0,0 +1,14 @@ + + + + org.apache.archiva + archiva + + 1.2.1 + 1.2.1 + + 1.2.1 + + 20100702064543 + + -- 2.39.5