split the repo admin in two modules : api and default implementation (to be able to more easily change the impl). Use the repo admin api consumers and indexing modules. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170135 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.4-M1
archiva-modules/archiva-web/archiva-webapp-test/cargo-installs/ | archiva-modules/archiva-web/archiva-webapp-test/cargo-installs/ | ||||
*.ipr | *.ipr | ||||
*.iws | *.iws | ||||
.DS_Store |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import java.util.Date; | |||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer; | import org.apache.maven.archiva.consumers.RepositoryContentConsumer; | ||||
import java.util.Date; | |||||
/** | /** | ||||
* AbstractProgressConsumer | * AbstractProgressConsumer | ||||
* | * | ||||
{ | { | ||||
private int count = 0; | private int count = 0; | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
this.count = 0; | this.count = 0; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
import com.sampullara.cli.Args; | import com.sampullara.cli.Args; | ||||
import com.sampullara.cli.Argument; | import com.sampullara.cli.Argument; | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | ||||
import org.apache.archiva.repository.scanner.RepositoryScanStatistics; | import org.apache.archiva.repository.scanner.RepositoryScanStatistics; | ||||
WagonManager wagonManager = plexusSisuBridge.lookup( WagonManager.class ); | WagonManager wagonManager = plexusSisuBridge.lookup( WagonManager.class ); | ||||
wagonManager.addMirror( "internal", "*", new File( path ).toURL().toExternalForm() ); | wagonManager.addMirror( "internal", "*", new File( path ).toURL().toExternalForm() ); | ||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); | |||||
ManagedRepository repo = new ManagedRepository(); | |||||
repo.setId( "cliRepo" ); | repo.setId( "cliRepo" ); | ||||
repo.setName( "Archiva CLI Provided Repo" ); | repo.setName( "Archiva CLI Provided Repo" ); | ||||
repo.setLocation( path ); | repo.setLocation( path ); |
package org.apache.maven.archiva.common; | |||||
/* | |||||
* 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 java.util.Arrays; | |||||
import java.util.List; | |||||
/** | |||||
* @author Olivier Lamy | |||||
* @since 1.4 | |||||
*/ | |||||
public class FileTypeUtils | |||||
{ | |||||
/** | |||||
* Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the | |||||
* case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual | |||||
* artifacts and exclude later during scanning. | |||||
*/ | |||||
public static final List<String> DEFAULT_EXCLUSIONS = | |||||
Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5", | |||||
"**/*.pgp", "**/.index/**", "**/.indexer/**" ); | |||||
} |
import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
import org.apache.commons.collections.Predicate; | import org.apache.commons.collections.Predicate; | ||||
import org.apache.commons.configuration.CombinedConfiguration; | import org.apache.commons.configuration.CombinedConfiguration; | ||||
import org.apache.maven.archiva.common.FileTypeUtils; | |||||
import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate; | import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate; | ||||
import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader; | import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader; | ||||
import org.codehaus.plexus.registry.Registry; | import org.codehaus.plexus.registry.Registry; | ||||
* Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the | * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the | ||||
* case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual | * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual | ||||
* artifacts and exclude later during scanning. | * artifacts and exclude later during scanning. | ||||
* @deprecated | |||||
*/ | */ | ||||
public static final List<String> DEFAULT_EXCLUSIONS = | |||||
Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5", | |||||
"**/*.pgp", "**/.index/**", "**/.indexer/**" ); | |||||
public static final List<String> DEFAULT_EXCLUSIONS = FileTypeUtils.DEFAULT_EXCLUSIONS; | |||||
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration ) | public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration ) | ||||
{ | { |
<dependencies> | <dependencies> | ||||
<dependency> | <dependency> | ||||
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-configuration</artifactId> | |||||
<artifactId>archiva-repository-admin-api</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-common</artifactId> | |||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>commons-collections</groupId> | <groupId>commons-collections</groupId> |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.maven.archiva.common.FileTypeUtils; | |||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Set; | import java.util.Set; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | |||||
/** | /** | ||||
* AbstractMonitoredConsumer | * AbstractMonitoredConsumer | ||||
* | * | ||||
protected List<String> getDefaultArtifactExclusions() | protected List<String> getDefaultArtifactExclusions() | ||||
{ | { | ||||
return FileTypes.DEFAULT_EXCLUSIONS; | |||||
return FileTypeUtils.DEFAULT_EXCLUSIONS; | |||||
} | } | ||||
public interface InvalidRepositoryContentConsumer | public interface InvalidRepositoryContentConsumer | ||||
extends RepositoryContentConsumer | extends RepositoryContentConsumer | ||||
{ | { | ||||
// no op | |||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.List; | import java.util.List; | ||||
* @param whenGathered the start of the repository scan | * @param whenGathered the start of the repository scan | ||||
* @throws ConsumerException if there was a problem with using the provided repository with the consumer. | * @throws ConsumerException if there was a problem with using the provided repository with the consumer. | ||||
*/ | */ | ||||
void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException; | throws ConsumerException; | ||||
/** | /** | ||||
* @param whenGathered the start of the repository scan | * @param whenGathered the start of the repository scan | ||||
* @param executeOnEntireRepo flags whether the consumer will be executed on an entire repository or just on a specific resource | * @param executeOnEntireRepo flags whether the consumer will be executed on an entire repository or just on a specific resource | ||||
* @throws ConsumerException if there was a problem with using the provided repository with the consumer. | * @throws ConsumerException if there was a problem with using the provided repository with the consumer. | ||||
* @see RepositoryContentConsumer#beginScan(org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration, java.util.Date) | |||||
* @see RepositoryContentConsumer#beginScan(ManagedRepository, java.util.Date) | |||||
*/ | */ | ||||
void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException; | throws ConsumerException; | ||||
/** | /** |
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-consumer-api</artifactId> | <artifactId>archiva-consumer-api</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-repository-admin-api</artifactId> | |||||
</dependency> | |||||
<dependency> | <dependency> | ||||
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-repository-layer</artifactId> | <artifactId>archiva-repository-layer</artifactId> | ||||
<artifactId>mockito-all</artifactId> | <artifactId>mockito-all</artifactId> | ||||
<scope>test</scope> | <scope>test</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-repository-admin-default</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-rbac-cached</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.derby</groupId> | |||||
<artifactId>derby</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
<pluginManagement> | <pluginManagement> | ||||
<plugins> | <plugins> | ||||
<plugin> | |||||
<groupId>org.apache.maven.plugins</groupId> | |||||
<artifactId>maven-surefire-plugin</artifactId> | |||||
<configuration> | |||||
<systemPropertyVariables> | |||||
<appserver.base>${basedir}/target/appserver-base</appserver.base> | |||||
<plexus.home>${project.build.outputDirectory}</plexus.home> | |||||
<java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir> | |||||
</systemPropertyVariables> | |||||
</configuration> | |||||
</plugin> | |||||
<plugin> | <plugin> | ||||
<groupId>org.apache.rat</groupId> | <groupId>org.apache.rat</groupId> | ||||
<artifactId>apache-rat-plugin</artifactId> | <artifactId>apache-rat-plugin</artifactId> |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.checksum.ChecksumAlgorithm; | import org.apache.archiva.checksum.ChecksumAlgorithm; | ||||
import org.apache.archiva.checksum.ChecksummedFile; | import org.apache.archiva.checksum.ChecksummedFile; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ConfigurationNames; | import org.apache.maven.archiva.configuration.ConfigurationNames; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | import org.apache.maven.archiva.configuration.FileTypes; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
return false; | return false; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repo, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
this.repositoryDir = new File( repo.getLocation() ); | this.repositoryDir = new File( repo.getLocation() ); | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repo, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repo, whenGathered ); | beginScan( repo, whenGathered ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.commons.collections.CollectionUtils; | |||||
import org.apache.commons.lang.StringUtils; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ConfigurationNames; | import org.apache.maven.archiva.configuration.ConfigurationNames; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | import org.apache.maven.archiva.configuration.FileTypes; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
return false; | return false; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
this.repositoryDir = new File( repository.getLocation() ); | this.repositoryDir = new File( repository.getLocation() ); | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
return false; | return false; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
this.repositoryDir = new File( repository.getLocation() ); | this.repositoryDir = new File( repository.getLocation() ); | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import java.io.File; | |||||
import java.io.IOException; | |||||
import java.util.ArrayList; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ConfigurationNames; | import org.apache.maven.archiva.configuration.ConfigurationNames; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | import org.apache.maven.archiva.configuration.FileTypes; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
import javax.annotation.PostConstruct; | import javax.annotation.PostConstruct; | ||||
import javax.inject.Inject; | import javax.inject.Inject; | ||||
import java.io.File; | |||||
import java.io.IOException; | |||||
import java.util.ArrayList; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
/** | /** | ||||
* MetadataUpdaterConsumer will create and update the metadata present within the repository. | * MetadataUpdaterConsumer will create and update the metadata present within the repository. | ||||
this.includes = includes; | this.includes = includes; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repoConfig, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repoConfig, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
try | try | ||||
} | } | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.common.plexusbridge.DigesterUtils; | import org.apache.archiva.common.plexusbridge.DigesterUtils; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
return false; | return false; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
this.repositoryDir = new File( repository.getLocation() ); | this.repositoryDir = new File( repository.getLocation() ); | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.metadata.repository.MetadataRepository; | import org.apache.archiva.metadata.repository.MetadataRepository; | ||||
import org.apache.archiva.metadata.repository.RepositorySession; | import org.apache.archiva.metadata.repository.RepositorySession; | ||||
import org.apache.archiva.repository.events.RepositoryListener; | import org.apache.archiva.repository.events.RepositoryListener; | ||||
import org.apache.maven.archiva.common.utils.VersionComparator; | import org.apache.maven.archiva.common.utils.VersionComparator; | ||||
import org.apache.maven.archiva.common.utils.VersionUtil; | import org.apache.maven.archiva.common.utils.VersionUtil; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | |||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.model.ArchivaArtifact; | import org.apache.maven.archiva.model.ArchivaArtifact; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
import org.apache.maven.archiva.model.ProjectReference; | import org.apache.maven.archiva.model.ProjectReference; | ||||
* This will look in a single managed repository, and purge any snapshots that are present | * This will look in a single managed repository, and purge any snapshots that are present | ||||
* that have a corresponding released version on the same repository. | * that have a corresponding released version on the same repository. | ||||
* </p> | * </p> | ||||
* | |||||
* <p/> | |||||
* <p> | * <p> | ||||
* So, if you have the following (presented in the m2/default layout form) ... | * So, if you have the following (presented in the m2/default layout form) ... | ||||
* <pre> | * <pre> | ||||
{ | { | ||||
private MetadataTools metadataTools; | private MetadataTools metadataTools; | ||||
private ArchivaConfiguration archivaConfig; | |||||
private ManagedRepositoryAdmin managedRepositoryAdmin; | |||||
private RepositoryContentFactory repoContentFactory; | private RepositoryContentFactory repoContentFactory; | ||||
public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryContent repository, MetadataTools metadataTools, | public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryContent repository, MetadataTools metadataTools, | ||||
ArchivaConfiguration archivaConfig, | |||||
ManagedRepositoryAdmin managedRepositoryAdmin, | |||||
RepositoryContentFactory repoContentFactory, | RepositoryContentFactory repoContentFactory, | ||||
RepositorySession repositorySession, | RepositorySession repositorySession, | ||||
List<RepositoryListener> listeners ) | List<RepositoryListener> listeners ) | ||||
{ | { | ||||
super( repository, repositorySession, listeners ); | super( repository, repositorySession, listeners ); | ||||
this.metadataTools = metadataTools; | this.metadataTools = metadataTools; | ||||
this.archivaConfig = archivaConfig; | |||||
this.managedRepositoryAdmin = managedRepositoryAdmin; | |||||
this.repoContentFactory = repoContentFactory; | this.repoContentFactory = repoContentFactory; | ||||
} | } | ||||
// Gather up all of the versions. | // Gather up all of the versions. | ||||
List<String> allVersions = new ArrayList<String>( repository.getVersions( reference ) ); | List<String> allVersions = new ArrayList<String>( repository.getVersions( reference ) ); | ||||
List<ManagedRepositoryConfiguration> repos = archivaConfig.getConfiguration().getManagedRepositories(); | |||||
for ( ManagedRepositoryConfiguration repo : repos ) | |||||
List<ManagedRepository> repos = managedRepositoryAdmin.getManagedRepositories(); | |||||
for ( ManagedRepository repo : repos ) | |||||
{ | { | ||||
if ( repo.isReleases() && !repo.getId().equals( repository.getId() ) ) | if ( repo.isReleases() && !repo.getId().equals( repository.getId() ) ) | ||||
{ | { | ||||
try | try | ||||
{ | { | ||||
ManagedRepositoryContent repoContent = repoContentFactory.getManagedRepositoryContent( | |||||
repo.getId() ); | |||||
ManagedRepositoryContent repoContent = | |||||
repoContentFactory.getManagedRepositoryContent( repo.getId() ); | |||||
allVersions.addAll( repoContent.getVersions( reference ) ); | allVersions.addAll( repoContent.getVersions( reference ) ); | ||||
} | } | ||||
catch ( RepositoryNotFoundException e ) | catch ( RepositoryNotFoundException e ) | ||||
versionRef.setGroupId( artifactRef.getGroupId() ); | versionRef.setGroupId( artifactRef.getGroupId() ); | ||||
versionRef.setArtifactId( artifactRef.getArtifactId() ); | versionRef.setArtifactId( artifactRef.getArtifactId() ); | ||||
ArchivaArtifact artifact = new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(), | |||||
artifactRef.getVersion(), artifactRef.getClassifier(), | |||||
artifactRef.getType(), repository.getId() ); | |||||
ArchivaArtifact artifact = | |||||
new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(), artifactRef.getVersion(), | |||||
artifactRef.getClassifier(), artifactRef.getType(), repository.getId() ); | |||||
MetadataRepository metadataRepository = repositorySession.getRepository(); | MetadataRepository metadataRepository = repositorySession.getRepository(); | ||||
for ( String version : snapshotVersions ) | for ( String version : snapshotVersions ) | ||||
{ | { | ||||
updateMetadata( artifactRef ); | updateMetadata( artifactRef ); | ||||
} | } | ||||
} catch ( RepositoryAdminException e ) | |||||
{ | |||||
throw new RepositoryPurgeException( e.getMessage(), e ); | |||||
} | } | ||||
catch ( LayoutException e ) | catch ( LayoutException e ) | ||||
{ | { |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.metadata.repository.RepositorySession; | import org.apache.archiva.metadata.repository.RepositorySession; | ||||
import org.apache.archiva.metadata.repository.RepositorySessionFactory; | import org.apache.archiva.metadata.repository.RepositorySessionFactory; | ||||
import org.apache.archiva.repository.events.RepositoryListener; | import org.apache.archiva.repository.events.RepositoryListener; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ConfigurationNames; | import org.apache.maven.archiva.configuration.ConfigurationNames; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | import org.apache.maven.archiva.configuration.FileTypes; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
import org.apache.maven.archiva.repository.metadata.MetadataTools; | import org.apache.maven.archiva.repository.metadata.MetadataTools; | ||||
import org.codehaus.plexus.registry.Registry; | import org.codehaus.plexus.registry.Registry; | ||||
import org.codehaus.plexus.registry.RegistryListener; | import org.codehaus.plexus.registry.RegistryListener; | ||||
import org.springframework.context.ApplicationContext; | |||||
import org.springframework.context.annotation.Scope; | import org.springframework.context.annotation.Scope; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
@Named( value = "archivaConfiguration#default" ) | @Named( value = "archivaConfiguration#default" ) | ||||
private ArchivaConfiguration configuration; | private ArchivaConfiguration configuration; | ||||
@Inject | |||||
private ManagedRepositoryAdmin managedRepositoryAdmin; | |||||
/** | /** | ||||
* | * | ||||
*/ | */ | ||||
@Inject | @Inject | ||||
@Named(value = "repositoryContentFactory#default") | |||||
@Named( value = "repositoryContentFactory#default" ) | |||||
private RepositoryContentFactory repositoryContentFactory; | private RepositoryContentFactory repositoryContentFactory; | ||||
/** | /** | ||||
* | * | ||||
*/ | */ | ||||
@Inject | @Inject | ||||
@Named(value = "fileTypes") | |||||
@Named( value = "fileTypes" ) | |||||
private FileTypes filetypes; | private FileTypes filetypes; | ||||
private List<String> includes = new ArrayList<String>(); | private List<String> includes = new ArrayList<String>(); | ||||
/** | /** | ||||
* TODO: this could be multiple implementations and needs to be configured. | * TODO: this could be multiple implementations and needs to be configured. | ||||
* | |||||
*/ | */ | ||||
@Inject | @Inject | ||||
private RepositorySessionFactory repositorySessionFactory; | private RepositorySessionFactory repositorySessionFactory; | ||||
return this.includes; | return this.includes; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
ManagedRepositoryContent repositoryContent; | ManagedRepositoryContent repositoryContent; | ||||
listeners ); | listeners ); | ||||
} | } | ||||
cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, metadataTools, configuration, | |||||
cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, metadataTools, managedRepositoryAdmin, | |||||
repositoryContentFactory, repositorySession, listeners ); | repositoryContentFactory, repositorySession, listeners ); | ||||
deleteReleasedSnapshots = repository.isDeleteReleasedSnapshots(); | deleteReleasedSnapshots = repository.isDeleteReleasedSnapshots(); | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
package org.apache.archiva.metadata.repository; | |||||
/* | |||||
* 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.model.ArtifactMetadata; | |||||
import org.apache.archiva.metadata.model.MetadataFacet; | |||||
import org.apache.archiva.metadata.model.ProjectMetadata; | |||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata; | |||||
import org.apache.archiva.metadata.model.ProjectVersionReference; | |||||
import java.util.Collection; | |||||
import java.util.Collections; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
public class TestMetadataRepository | |||||
implements MetadataRepository | |||||
{ | |||||
public ProjectMetadata getProject( String repoId, String namespace, String projectId ) | |||||
{ | |||||
return null; | |||||
} | |||||
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, | |||||
String projectVersion ) | |||||
{ | |||||
return null; | |||||
} | |||||
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId, | |||||
String projectVersion ) | |||||
{ | |||||
return null; | |||||
} | |||||
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId, | |||||
String projectVersion ) | |||||
{ | |||||
return null; | |||||
} | |||||
public Collection<String> getRootNamespaces( String repoId ) | |||||
{ | |||||
return null; | |||||
} | |||||
public Collection<String> getNamespaces( String repoId, String namespace ) | |||||
{ | |||||
return null; | |||||
} | |||||
public Collection<String> getProjects( String repoId, String namespace ) | |||||
{ | |||||
return null; | |||||
} | |||||
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId ) | |||||
{ | |||||
return null; | |||||
} | |||||
public void updateProject( String repoId, ProjectMetadata project ) | |||||
{ | |||||
} | |||||
public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion, | |||||
ArtifactMetadata artifactMeta ) | |||||
{ | |||||
} | |||||
public void updateProjectVersion( String repoId, String namespace, String projectId, | |||||
ProjectVersionMetadata versionMetadata ) | |||||
{ | |||||
} | |||||
public void updateNamespace( String repoId, String namespace ) | |||||
{ | |||||
} | |||||
public List<String> getMetadataFacets( String repodId, String facetId ) | |||||
{ | |||||
return Collections.emptyList(); | |||||
} | |||||
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) | |||||
{ | |||||
return null; | |||||
} | |||||
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet ) | |||||
{ | |||||
} | |||||
public void removeMetadataFacets( String repositoryId, String facetId ) | |||||
{ | |||||
} | |||||
public void removeMetadataFacet( String repoId, String facetId, String name ) | |||||
{ | |||||
} | |||||
public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime ) | |||||
{ | |||||
return null; | |||||
} | |||||
public Collection<String> getRepositories() | |||||
{ | |||||
return null; | |||||
} | |||||
public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum ) | |||||
{ | |||||
return null; | |||||
} | |||||
public void removeArtifact( String repositoryId, String namespace, String project, String version, String id ) | |||||
{ | |||||
} | |||||
public void removeRepository( String repoId ) | |||||
{ | |||||
} | |||||
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId, | |||||
String projectVersion ) | |||||
{ | |||||
return null; | |||||
} | |||||
public void save() | |||||
{ | |||||
} | |||||
public void close() | |||||
{ | |||||
} | |||||
public void revert() | |||||
{ | |||||
} | |||||
public boolean canObtainAccess( Class<?> aClass ) | |||||
{ | |||||
return false; | |||||
} | |||||
public Object obtainAccess( Class<?> aClass ) | |||||
{ | |||||
return null; | |||||
} | |||||
public List<ArtifactMetadata> getArtifacts( String repositoryId ) | |||||
{ | |||||
return null; | |||||
} | |||||
} |
* specific language governing permissions and limitations | * specific language governing permissions and limitations | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
@Service("repositorySessionFactory#test") | |||||
@Service( "repositorySessionFactory#test" ) | |||||
public class TestRepositorySessionFactory | public class TestRepositorySessionFactory | ||||
implements RepositorySessionFactory | implements RepositorySessionFactory | ||||
{ | { | ||||
public RepositorySession createSession() | public RepositorySession createSession() | ||||
{ | { | ||||
return new RepositorySession( repository, resolver ); | |||||
return new RepositorySession( new TestMetadataRepository(), resolver ) | |||||
{ | |||||
@Override | |||||
public void close() | |||||
{ | |||||
return; | |||||
} | |||||
}; | |||||
} | } | ||||
public void setRepository( MetadataRepository repository ) | public void setRepository( MetadataRepository repository ) |
package org.apache.maven.archiva.consumers.core; | package org.apache.maven.archiva.consumers.core; | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.checksum.ChecksumAlgorithm; | import org.apache.archiva.checksum.ChecksumAlgorithm; | ||||
import org.apache.archiva.checksum.ChecksummedFile; | import org.apache.archiva.checksum.ChecksummedFile; | ||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
public class ArtifactMissingChecksumsConsumerTest | public class ArtifactMissingChecksumsConsumerTest | ||||
extends AbstractArtifactConsumerTest | extends AbstractArtifactConsumerTest | ||||
{ | { | ||||
private ManagedRepositoryConfiguration repoConfig; | |||||
private ManagedRepository repoConfig; | |||||
@Before | @Before | ||||
public void setUp() | public void setUp() | ||||
{ | { | ||||
super.setUp(); | super.setUp(); | ||||
repoConfig = new ManagedRepositoryConfiguration(); | |||||
repoConfig = new ManagedRepository(); | |||||
repoConfig.setId( "test-repo" ); | repoConfig.setId( "test-repo" ); | ||||
repoConfig.setName( "Test Repository" ); | repoConfig.setName( "Test Repository" ); | ||||
repoConfig.setLayout( "default" ); | repoConfig.setLayout( "default" ); |
*/ | */ | ||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.metadata.repository.MetadataRepository; | import org.apache.archiva.metadata.repository.MetadataRepository; | ||||
import org.apache.archiva.metadata.repository.RepositorySession; | import org.apache.archiva.metadata.repository.RepositorySession; | ||||
import org.apache.archiva.repository.events.RepositoryListener; | import org.apache.archiva.repository.events.RepositoryListener; | ||||
protected static final String RELEASES_TEST_REPO_NAME = "Releases Test Repo One"; | protected static final String RELEASES_TEST_REPO_NAME = "Releases Test Repo One"; | ||||
private ManagedRepositoryConfiguration config; | |||||
private ManagedRepository config; | |||||
private ManagedRepositoryContent repo; | private ManagedRepositoryContent repo; | ||||
repo = null; | repo = null; | ||||
} | } | ||||
public ManagedRepositoryConfiguration getRepoConfiguration( String repoId, String repoName ) | |||||
public ManagedRepository getRepoConfiguration( String repoId, String repoName ) | |||||
{ | { | ||||
config = new ManagedRepositoryConfiguration(); | |||||
config = new ManagedRepository(); | |||||
config.setId( repoId ); | config.setId( repoId ); | ||||
config.setName( repoName ); | config.setName( repoName ); | ||||
config.setDaysOlder( TEST_DAYS_OLDER ); | config.setDaysOlder( TEST_DAYS_OLDER ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; | |||||
import org.apache.archiva.repository.events.RepositoryListener; | import org.apache.archiva.repository.events.RepositoryListener; | ||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.Configuration; | |||||
import org.apache.maven.archiva.repository.RepositoryContentFactory; | import org.apache.maven.archiva.repository.RepositoryContentFactory; | ||||
import org.apache.maven.archiva.repository.metadata.MetadataTools; | import org.apache.maven.archiva.repository.metadata.MetadataTools; | ||||
import org.custommonkey.xmlunit.XMLAssert; | import org.custommonkey.xmlunit.XMLAssert; | ||||
super.setUp(); | super.setUp(); | ||||
RepositoryContentFactory factory = | RepositoryContentFactory factory = | ||||
applicationContext.getBean( "repositoryContentFactory#cleanup-released-snapshots", RepositoryContentFactory.class ); | |||||
applicationContext.getBean( "repositoryContentFactory#cleanup-released-snapshots", | |||||
RepositoryContentFactory.class ); | |||||
archivaConfiguration = | archivaConfiguration = | ||||
applicationContext.getBean( "archivaConfiguration#cleanup-released-snapshots", ArchivaConfiguration.class ); | applicationContext.getBean( "archivaConfiguration#cleanup-released-snapshots", ArchivaConfiguration.class ); | ||||
listener = (RepositoryListener) listenerControl.getMock(); | listener = (RepositoryListener) listenerControl.getMock(); | ||||
List<RepositoryListener> listeners = Collections.singletonList( listener ); | List<RepositoryListener> listeners = Collections.singletonList( listener ); | ||||
repoPurge = | |||||
new CleanupReleasedSnapshotsRepositoryPurge( getRepository(), metadataTools, archivaConfiguration, factory, | |||||
repositorySession, listeners ); | |||||
repoPurge = new CleanupReleasedSnapshotsRepositoryPurge( getRepository(), metadataTools, | |||||
applicationContext.getBean( | |||||
ManagedRepositoryAdmin.class ), factory, | |||||
repositorySession, listeners ); | |||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean( | |||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration ); | |||||
} | } | ||||
@Test | @Test | ||||
public void testReleasedSnapshotsExistsInSameRepo() | public void testReleasedSnapshotsExistsInSameRepo() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
Configuration config = archivaConfiguration.getConfiguration(); | |||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | |||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); | |||||
/** | |||||
Configuration config = archivaConfiguration.getConfiguration(); | |||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | |||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); | |||||
**/ | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false ); | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( | |||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null ); | |||||
String repoRoot = prepareTestRepos(); | String repoRoot = prepareTestRepos(); | ||||
public void testNonArtifactFile() | public void testNonArtifactFile() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
Configuration config = archivaConfiguration.getConfiguration(); | |||||
/*Configuration config = archivaConfiguration.getConfiguration(); | |||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | ||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); | |||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) );*/ | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false ); | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( | |||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null ); | |||||
String repoRoot = prepareTestRepos(); | String repoRoot = prepareTestRepos(); | ||||
listenerControl.replay(); | listenerControl.replay(); | ||||
File file = new File( repoRoot, INDEX_PATH ); | File file = new File( repoRoot, INDEX_PATH ); | ||||
if (!file.exists()) | |||||
if ( !file.exists() ) | |||||
{ | { | ||||
// help windauze to create directory with . | // help windauze to create directory with . | ||||
file.getParentFile().mkdirs(); | file.getParentFile().mkdirs(); | ||||
public void testReleasedSnapshotsExistsInDifferentRepo() | public void testReleasedSnapshotsExistsInDifferentRepo() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
/* | |||||
Configuration config = archivaConfiguration.getConfiguration(); | Configuration config = archivaConfiguration.getConfiguration(); | ||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | ||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); | config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); | ||||
config.addManagedRepository( getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ) ); | config.addManagedRepository( getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ) ); | ||||
*/ | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false ); | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( | |||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null ); | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( | |||||
getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ), false, null ); | |||||
String repoRoot = prepareTestRepos(); | String repoRoot = prepareTestRepos(); | ||||
public void testHigherSnapshotExistsInSameRepo() | public void testHigherSnapshotExistsInSameRepo() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
/* | |||||
Configuration config = archivaConfiguration.getConfiguration(); | Configuration config = archivaConfiguration.getConfiguration(); | ||||
config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); | ||||
config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); | config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); | ||||
*/ | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false ); | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( | |||||
getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null ); | |||||
String repoRoot = prepareTestRepos(); | String repoRoot = prepareTestRepos(); | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.repository.events.RepositoryListener; | import org.apache.archiva.repository.events.RepositoryListener; | ||||
import org.apache.commons.lang.time.DateUtils; | import org.apache.commons.lang.time.DateUtils; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | ||||
public void testByLastModified() | public void testByLastModified() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(), | repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(), | ||||
repoConfiguration.getRetentionCount(), repositorySession, | repoConfiguration.getRetentionCount(), repositorySession, | ||||
Collections.singletonList( listener ) ); | Collections.singletonList( listener ) ); | ||||
public void testOrderOfDeletion() | public void testOrderOfDeletion() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
List<RepositoryListener> listeners = Collections.singletonList( listener ); | List<RepositoryListener> listeners = Collections.singletonList( listener ); | ||||
repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(), | repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(), | ||||
repoConfiguration.getRetentionCount(), repositorySession, listeners ); | repoConfiguration.getRetentionCount(), repositorySession, listeners ); | ||||
public void testMetadataDrivenSnapshots() | public void testMetadataDrivenSnapshots() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
List<RepositoryListener> listeners = Collections.singletonList( listener ); | List<RepositoryListener> listeners = Collections.singletonList( listener ); | ||||
repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(), | repoPurge = new DaysOldRepositoryPurge( getRepository(), repoConfiguration.getDaysOlder(), | ||||
repoConfiguration.getRetentionCount(), repositorySession, listeners ); | repoConfiguration.getRetentionCount(), repositorySession, listeners ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; | |||||
import org.apache.archiva.metadata.repository.TestRepositorySessionFactory; | import org.apache.archiva.metadata.repository.TestRepositorySessionFactory; | ||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.maven.archiva.common.utils.BaseFile; | import org.apache.maven.archiva.common.utils.BaseFile; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.Configuration; | |||||
import org.apache.maven.archiva.configuration.FileType; | import org.apache.maven.archiva.configuration.FileType; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | import org.apache.maven.archiva.configuration.FileTypes; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate; | import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate; | ||||
import org.custommonkey.xmlunit.XMLAssert; | import org.custommonkey.xmlunit.XMLAssert; | ||||
public class RepositoryPurgeConsumerTest | public class RepositoryPurgeConsumerTest | ||||
extends AbstractRepositoryPurgeTest | extends AbstractRepositoryPurgeTest | ||||
{ | { | ||||
@Before | |||||
public void setUp() | |||||
throws Exception | |||||
{ | |||||
super.setUp(); | |||||
TestRepositorySessionFactory factory = applicationContext.getBean( TestRepositorySessionFactory.class ); | |||||
factory.setRepository( metadataRepository ); | |||||
} | |||||
@Test | @Test | ||||
public void testConsumption() | public void testConsumption() | ||||
throws Exception | throws Exception | ||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count", | applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count", | ||||
KnownRepositoryContentConsumer.class ); | KnownRepositoryContentConsumer.class ); | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
repoConfiguration.setDaysOlder( 0 ); // force days older off to allow retention count purge to execute. | repoConfiguration.setDaysOlder( 0 ); // force days older off to allow retention count purge to execute. | ||||
repoConfiguration.setRetentionCount( TEST_RETENTION_COUNT ); | repoConfiguration.setRetentionCount( TEST_RETENTION_COUNT ); | ||||
addRepoToConfiguration( "retention-count", repoConfiguration ); | addRepoToConfiguration( "retention-count", repoConfiguration ); | ||||
removeRepoFromConfiguration( "retention-count", repoConfiguration ); | removeRepoFromConfiguration( "retention-count", repoConfiguration ); | ||||
} | } | ||||
private void addRepoToConfiguration( String configHint, ManagedRepositoryConfiguration repoConfiguration ) | |||||
private void addRepoToConfiguration( String configHint, ManagedRepository repoConfiguration ) | |||||
throws Exception | throws Exception | ||||
{ | { | ||||
ArchivaConfiguration archivaConfiguration = | ArchivaConfiguration archivaConfiguration = | ||||
applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class ); | applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class ); | ||||
Configuration configuration = archivaConfiguration.getConfiguration(); | |||||
ManagedRepositoryConfiguration managedRepositoryConfiguration = | |||||
configuration.findManagedRepositoryById( repoConfiguration.getId() ); | |||||
if ( managedRepositoryConfiguration != null ) | |||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean( | |||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration ); | |||||
/** | |||||
Configuration configuration = archivaConfiguration.getConfiguration(); | |||||
ManagedRepositoryConfiguration managedRepositoryConfiguration = | |||||
configuration.findManagedRepositoryById( repoConfiguration.getId() ); | |||||
if ( managedRepositoryConfiguration != null ) | |||||
{ | |||||
configuration.removeManagedRepository( managedRepositoryConfiguration ); | |||||
} | |||||
configuration.addManagedRepository( repoConfiguration ); | |||||
**/ | |||||
ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class ); | |||||
if ( managedRepositoryAdmin.getManagedRepository( repoConfiguration.getId() ) != null ) | |||||
{ | { | ||||
configuration.removeManagedRepository( managedRepositoryConfiguration ); | |||||
managedRepositoryAdmin.deleteManagedRepository( repoConfiguration.getId(), null, false ); | |||||
} | } | ||||
configuration.addManagedRepository( repoConfiguration ); | |||||
managedRepositoryAdmin.addManagedRepository( repoConfiguration, false, null ); | |||||
} | } | ||||
private void removeRepoFromConfiguration( String configHint, ManagedRepositoryConfiguration repoConfiguration ) | |||||
private void removeRepoFromConfiguration( String configHint, ManagedRepository repoConfiguration ) | |||||
throws Exception | throws Exception | ||||
{ | { | ||||
ArchivaConfiguration archivaConfiguration = | ArchivaConfiguration archivaConfiguration = | ||||
applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class ); | applicationContext.getBean( "archivaConfiguration#" + configHint, ArchivaConfiguration.class ); | ||||
Configuration configuration = archivaConfiguration.getConfiguration(); | |||||
ManagedRepositoryConfiguration managedRepositoryConfiguration = | |||||
configuration.findManagedRepositoryById( repoConfiguration.getId() ); | |||||
if ( managedRepositoryConfiguration != null ) | |||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean( | |||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( archivaConfiguration ); | |||||
/** | |||||
Configuration configuration = archivaConfiguration.getConfiguration(); | |||||
ManagedRepositoryConfiguration managedRepositoryConfiguration = | |||||
configuration.findManagedRepositoryById( repoConfiguration.getId() ); | |||||
if ( managedRepositoryConfiguration != null ) | |||||
{ | |||||
configuration.removeManagedRepository( managedRepositoryConfiguration ); | |||||
}*/ | |||||
ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class ); | |||||
if ( managedRepositoryAdmin.getManagedRepository( repoConfiguration.getId() ) != null ) | |||||
{ | { | ||||
configuration.removeManagedRepository( managedRepositoryConfiguration ); | |||||
managedRepositoryAdmin.deleteManagedRepository( repoConfiguration.getId(), null, true ); | |||||
} | } | ||||
} | } | ||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old", | applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old", | ||||
KnownRepositoryContentConsumer.class ); | KnownRepositoryContentConsumer.class ); | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
repoConfiguration.setDaysOlder( TEST_DAYS_OLDER ); | repoConfiguration.setDaysOlder( TEST_DAYS_OLDER ); | ||||
addRepoToConfiguration( "days-old", repoConfiguration ); | addRepoToConfiguration( "days-old", repoConfiguration ); | ||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count", | applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-retention-count", | ||||
KnownRepositoryContentConsumer.class ); | KnownRepositoryContentConsumer.class ); | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
repoConfiguration.setDeleteReleasedSnapshots( false ); // Set to NOT delete released snapshots. | repoConfiguration.setDeleteReleasedSnapshots( false ); // Set to NOT delete released snapshots. | ||||
addRepoToConfiguration( "retention-count", repoConfiguration ); | addRepoToConfiguration( "retention-count", repoConfiguration ); | ||||
applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old", | applicationContext.getBean( "knownRepositoryContentConsumer#repo-purge-consumer-by-days-old", | ||||
KnownRepositoryContentConsumer.class ); | KnownRepositoryContentConsumer.class ); | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
repoConfiguration.setDeleteReleasedSnapshots( true ); | repoConfiguration.setDeleteReleasedSnapshots( true ); | ||||
addRepoToConfiguration( "days-old", repoConfiguration ); | addRepoToConfiguration( "days-old", repoConfiguration ); | ||||
removeRepoFromConfiguration( "days-old", repoConfiguration ); | removeRepoFromConfiguration( "days-old", repoConfiguration ); | ||||
} | } | ||||
@Before | |||||
public void setUp() | |||||
throws Exception | |||||
{ | |||||
super.setUp(); | |||||
TestRepositorySessionFactory factory = applicationContext.getBean( TestRepositorySessionFactory.class ); | |||||
factory.setRepository( metadataRepository ); | |||||
} | |||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.repository.events.RepositoryListener; | import org.apache.archiva.repository.events.RepositoryListener; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
{ | { | ||||
super.setUp(); | super.setUp(); | ||||
ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
ManagedRepository repoConfiguration = getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ); | |||||
List<RepositoryListener> listeners = Collections.singletonList( listener ); | List<RepositoryListener> listeners = Collections.singletonList( listener ); | ||||
repoPurge = new RetentionCountRepositoryPurge( getRepository(), repoConfiguration.getRetentionCount(), | repoPurge = new RetentionCountRepositoryPurge( getRepository(), repoConfiguration.getRetentionCount(), | ||||
repositorySession, listeners ); | repositorySession, listeners ); |
<?xml version="1.0"?> | |||||
<!-- | |||||
~ 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. | |||||
--> | |||||
<beans xmlns="http://www.springframework.org/schema/beans" | |||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xmlns:context="http://www.springframework.org/schema/context" | |||||
xsi:schemaLocation="http://www.springframework.org/schema/beans | |||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | |||||
http://www.springframework.org/schema/context | |||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true"> | |||||
<bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler"> | |||||
<property name="properties"> | |||||
<props> | |||||
<prop key="org.quartz.scheduler.instanceName">scheduler1</prop> | |||||
<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop> | |||||
<prop key="org.quartz.threadPool.threadCount">2</prop> | |||||
<prop key="org.quartz.threadPool.threadPriority">4</prop> | |||||
<prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop> | |||||
</props> | |||||
</property> | |||||
</bean> | |||||
</beans> |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; | import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ConfigurationNames; | import org.apache.maven.archiva.configuration.ConfigurationNames; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | import org.apache.maven.archiva.configuration.FileTypes; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
import org.apache.maven.index.context.IndexCreator; | import org.apache.maven.index.context.IndexCreator; | ||||
import org.apache.maven.index.context.IndexingContext; | import org.apache.maven.index.context.IndexingContext; | ||||
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; | import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; | ||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; | |||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; | |||||
import org.codehaus.plexus.registry.Registry; | import org.codehaus.plexus.registry.Registry; | ||||
import org.codehaus.plexus.registry.RegistryListener; | import org.codehaus.plexus.registry.RegistryListener; | ||||
import org.codehaus.plexus.taskqueue.TaskQueueException; | import org.codehaus.plexus.taskqueue.TaskQueueException; | ||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import javax.annotation.PostConstruct; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
*/ | */ | ||||
public class NexusIndexerConsumer | public class NexusIndexerConsumer | ||||
extends AbstractMonitoredConsumer | extends AbstractMonitoredConsumer | ||||
implements KnownRepositoryContentConsumer, RegistryListener, Initializable | |||||
implements KnownRepositoryContentConsumer, RegistryListener | |||||
{ | { | ||||
private Logger log = LoggerFactory.getLogger( NexusIndexerConsumer.class ); | private Logger log = LoggerFactory.getLogger( NexusIndexerConsumer.class ); | ||||
private List<String> includes = new ArrayList<String>(); | private List<String> includes = new ArrayList<String>(); | ||||
private ManagedRepositoryConfiguration repository; | |||||
private ManagedRepository repository; | |||||
private List<? extends IndexCreator> allIndexCreators; | private List<? extends IndexCreator> allIndexCreators; | ||||
return false; | return false; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
this.repository = repository; | this.repository = repository; | ||||
} | } | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
if ( executeOnEntireRepo ) | if ( executeOnEntireRepo ) | ||||
includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) ); | includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) ); | ||||
} | } | ||||
@PostConstruct | |||||
public void initialize() | public void initialize() | ||||
throws InitializationException | |||||
{ | { | ||||
configuration.addChangeListener( this ); | configuration.addChangeListener( this ); | ||||
*/ | */ | ||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; | import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | ||||
import org.apache.archiva.scheduler.ArchivaTaskScheduler; | import org.apache.archiva.scheduler.ArchivaTaskScheduler; | ||||
private KnownRepositoryContentConsumer nexusIndexerConsumer; | private KnownRepositoryContentConsumer nexusIndexerConsumer; | ||||
private ManagedRepositoryConfiguration repositoryConfig; | |||||
private ManagedRepository repositoryConfig; | |||||
private ArchivaTaskSchedulerStub scheduler; | private ArchivaTaskSchedulerStub scheduler; | ||||
new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge, mavenIndexerUtils ); | new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge, mavenIndexerUtils ); | ||||
// initialize to set the file types to be processed | // initialize to set the file types to be processed | ||||
( (Initializable) nexusIndexerConsumer ).initialize(); | |||||
( (NexusIndexerConsumer) nexusIndexerConsumer ).initialize(); | |||||
repositoryConfig = new ManagedRepositoryConfiguration(); | |||||
repositoryConfig = new ManagedRepository(); | |||||
repositoryConfig.setId( "test-repo" ); | repositoryConfig.setId( "test-repo" ); | ||||
repositoryConfig.setLocation( "target/test-classes/test-repo" ); | repositoryConfig.setLocation( "target/test-classes/test-repo" ); | ||||
repositoryConfig.setLayout( "default" ); | repositoryConfig.setLayout( "default" ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.metadata.model.ArtifactMetadata; | import org.apache.archiva.metadata.model.ArtifactMetadata; | ||||
import org.apache.archiva.metadata.model.ProjectMetadata; | import org.apache.archiva.metadata.model.ProjectMetadata; | ||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata; | import org.apache.archiva.metadata.model.ProjectVersionMetadata; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ConfigurationNames; | import org.apache.maven.archiva.configuration.ConfigurationNames; | ||||
import org.apache.maven.archiva.configuration.FileTypes; | import org.apache.maven.archiva.configuration.FileTypes; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
return this.includes; | return this.includes; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repo, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
repoId = repo.getId(); | repoId = repo.getId(); | ||||
this.whenGathered = whenGathered; | this.whenGathered = whenGathered; | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | ||||
import org.apache.archiva.repository.scanner.RepositoryScanner; | import org.apache.archiva.repository.scanner.RepositoryScanner; | ||||
{ | { | ||||
String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory ); | String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory ); | ||||
ManagedRepositoryConfiguration legacyRepository = new ManagedRepositoryConfiguration(); | |||||
ManagedRepository legacyRepository = new ManagedRepository(); | |||||
legacyRepository.setId( "legacy" ); | legacyRepository.setId( "legacy" ); | ||||
legacyRepository.setName( "Legacy Repository" ); | legacyRepository.setName( "Legacy Repository" ); | ||||
legacyRepository.setLocation( legacyRepositoryDirectory.getAbsolutePath() ); | legacyRepository.setLocation( legacyRepositoryDirectory.getAbsolutePath() ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; | ||||
import org.apache.maven.archiva.consumers.ConsumerException; | import org.apache.maven.archiva.consumers.ConsumerException; | ||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | ||||
artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class ); | artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class ); | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
this.managedRepository = new ManagedDefaultRepositoryContent(); | this.managedRepository = new ManagedDefaultRepositoryContent(); | ||||
this.managedRepository.setRepository( repository ); | this.managedRepository.setRepository( repository ); | ||||
} | } | ||||
public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo ) | |||||
throws ConsumerException | throws ConsumerException | ||||
{ | { | ||||
beginScan( repository, whenGathered ); | beginScan( repository, whenGathered ); |
package org.apache.maven.archiva.converter.mock; | |||||
/* | |||||
* 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.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.admin.ArchivaAdministration; | |||||
import org.apache.archiva.admin.model.admin.FileType; | |||||
import org.apache.archiva.admin.model.admin.LegacyArtifactPath; | |||||
import org.apache.archiva.admin.model.admin.OrganisationInformation; | |||||
import java.util.List; | |||||
/** | |||||
* @author Olivier Lamy | |||||
*/ | |||||
public class MockArchivaAdministration implements ArchivaAdministration | |||||
{ | |||||
public List<LegacyArtifactPath> getLegacyArtifactPaths() | |||||
throws RepositoryAdminException | |||||
{ | |||||
return null; | |||||
} | |||||
public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void deleteLegacyArtifactPath( String path, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void addFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void removeFileTypePattern( String fileTypeId, String pattern, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public List<FileType> getFileTypes() | |||||
throws RepositoryAdminException | |||||
{ | |||||
return null; | |||||
} | |||||
public FileType getFileType( String fileTypeId ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
return null; | |||||
} | |||||
public void addFileType( FileType fileType, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void removeFileType( String fileTypeId, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void addKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void setKnownContentConsumers( List<String> knownContentConsumers, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public List<String> getKnownContentConsumers() | |||||
throws RepositoryAdminException | |||||
{ | |||||
return null; | |||||
} | |||||
public void removeKnownContentConsumer( String knownContentConsumer, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void addInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public void setInvalidContentConsumers( List<String> invalidContentConsumers, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public List<String> getInvalidContentConsumers() | |||||
throws RepositoryAdminException | |||||
{ | |||||
return null; | |||||
} | |||||
public void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
public OrganisationInformation getOrganisationInformation() | |||||
throws RepositoryAdminException | |||||
{ | |||||
return null; | |||||
} | |||||
public void setOrganisationInformation( OrganisationInformation organisationInformation ) | |||||
throws RepositoryAdminException | |||||
{ | |||||
} | |||||
} |
http://www.springframework.org/schema/context/spring-context-3.0.xsd" | http://www.springframework.org/schema/context/spring-context-3.0.xsd" | ||||
default-lazy-init="true"> | default-lazy-init="true"> | ||||
<bean name="mockArchivaAdministration" class="org.apache.maven.archiva.converter.mock.MockArchivaAdministration"/> | |||||
</beans> | </beans> |
hit = new SearchResultHit(); | hit = new SearchResultHit(); | ||||
hit.setArtifactId( artifactInfo.artifactId ); | hit.setArtifactId( artifactInfo.artifactId ); | ||||
hit.setGroupId( artifactInfo.groupId ); | hit.setGroupId( artifactInfo.groupId ); | ||||
// do we still need to set the repository id even though we're merging everything? | |||||
//hit.setRepositoryId( artifactInfo.repository ); | |||||
hit.setRepositoryId( artifactInfo.repository ); | |||||
// FIXME archiva url ?? | |||||
hit.setUrl( artifactInfo.repository + "/" + artifactInfo.fname ); | hit.setUrl( artifactInfo.repository + "/" + artifactInfo.fname ); | ||||
hit.addVersion( artifactInfo.version ); | hit.addVersion( artifactInfo.version ); | ||||
hit.setBundleExportPackage( artifactInfo.bundleExportPackage ); | hit.setBundleExportPackage( artifactInfo.bundleExportPackage ); |
@Override | @Override | ||||
public String toString() | public String toString() | ||||
{ | { | ||||
return "SearchResultHit{" + "context='" + context + '\'' + ", url='" + url + '\'' + ", groupId='" + groupId | |||||
+ '\'' + ", artifactId='" + artifactId + '\'' + ", version='" + version + '\'' + ", repositoryId='" | |||||
+ repositoryId + '\'' + ", versions=" + versions + ", bundleVersion='" + bundleVersion + '\'' | |||||
+ ", bundleSymbolicName='" + bundleSymbolicName + '\'' + ", bundleExportPackage='" + bundleExportPackage | |||||
+ '\'' + ", bundleExportService='" + bundleExportService + '\'' + '}'; | |||||
final StringBuilder sb = new StringBuilder(); | |||||
sb.append( "SearchResultHit" ); | |||||
sb.append( "{context='" ).append( context ).append( '\'' ); | |||||
sb.append( ", url='" ).append( url ).append( '\'' ); | |||||
sb.append( ", groupId='" ).append( groupId ).append( '\'' ); | |||||
sb.append( ", artifactId='" ).append( artifactId ).append( '\'' ); | |||||
sb.append( ", version='" ).append( version ).append( '\'' ); | |||||
sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' ); | |||||
sb.append( ", versions=" ).append( versions ); | |||||
sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' ); | |||||
sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' ); | |||||
sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' ); | |||||
sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' ); | |||||
sb.append( '}' ); | |||||
return sb.toString(); | |||||
} | } | ||||
} | } |
<artifactId>slf4j-simple</artifactId> | <artifactId>slf4j-simple</artifactId> | ||||
<scope>test</scope> | <scope>test</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-repository-admin-default</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-rbac-cached</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.derby</groupId> | |||||
<artifactId>derby</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-security-common</artifactId> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
<plugins> | <plugins> | ||||
<artifactId>maven-surefire-plugin</artifactId> | <artifactId>maven-surefire-plugin</artifactId> | ||||
<configuration> | <configuration> | ||||
<systemPropertyVariables> | <systemPropertyVariables> | ||||
<appserver.base>${basedir}/target/appserver-base</appserver.base> | |||||
<plexus.home>${project.build.outputDirectory}</plexus.home> | |||||
<java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir> | <java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir> | ||||
</systemPropertyVariables> | </systemPropertyVariables> | ||||
</configuration> | </configuration> |
} | } | ||||
AuthenticationInfo authInfo = null; | AuthenticationInfo authInfo = null; | ||||
String username = remoteRepository.getRepository().getUsername(); | |||||
String username = remoteRepository.getRepository().getUserName(); | |||||
String password = remoteRepository.getRepository().getPassword(); | String password = remoteRepository.getRepository().getPassword(); | ||||
if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) ) | if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) ) |
*/ | */ | ||||
import net.sf.ehcache.CacheManager; | import net.sf.ehcache.CacheManager; | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; | |||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | ||||
import org.apache.commons.lang.ArrayUtils; | import org.apache.commons.lang.ArrayUtils; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.springframework.test.context.ContextConfiguration; | import org.springframework.test.context.ContextConfiguration; | ||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
import javax.inject.Inject; | |||||
import java.io.BufferedReader; | import java.io.BufferedReader; | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileReader; | import java.io.FileReader; | ||||
import java.util.Collection; | import java.util.Collection; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Locale; | import java.util.Locale; | ||||
import javax.inject.Inject; | |||||
import static org.junit.Assert.*; | import static org.junit.Assert.*; | ||||
* @version $Id$ | * @version $Id$ | ||||
*/ | */ | ||||
@RunWith( SpringJUnit4ClassRunner.class ) | @RunWith( SpringJUnit4ClassRunner.class ) | ||||
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml"} ) | |||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) | |||||
public abstract class AbstractProxyTestCase | public abstract class AbstractProxyTestCase | ||||
{ | { | ||||
@Inject | @Inject | ||||
WagonDelegate delegate; | WagonDelegate delegate; | ||||
@Inject | |||||
protected ManagedRepositoryAdmin managedRepositoryAdmin; | |||||
@Inject | @Inject | ||||
PlexusSisuBridge plexusSisuBridge; | PlexusSisuBridge plexusSisuBridge; | ||||
public void setUp() | public void setUp() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
config = (MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", | |||||
ArchivaConfiguration.class ); | |||||
config = | |||||
(MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class ); | |||||
config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() ); | config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() ); | ||||
config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() ); | config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() ); | ||||
String repoPath = "target/test-repository/managed/" + name; | String repoPath = "target/test-repository/managed/" + name; | ||||
File repoLocation = new File( repoPath ); | File repoLocation = new File( repoPath ); | ||||
managedDefaultRepository = createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, | |||||
"default" ); | |||||
managedDefaultRepository = | |||||
createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" ); | |||||
managedDefaultDir = new File( managedDefaultRepository.getRepoRoot() ); | managedDefaultDir = new File( managedDefaultRepository.getRepoRoot() ); | ||||
ManagedRepositoryConfiguration repoConfig = managedDefaultRepository.getRepository(); | |||||
ManagedRepository repoConfig = managedDefaultRepository.getRepository(); | |||||
config.getConfiguration().addManagedRepository( repoConfig ); | |||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean( | |||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config ); | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null ); | |||||
//config.getConfiguration().addManagedRepository( repoConfig ); | |||||
// Setup source repository (using legacy layout) | // Setup source repository (using legacy layout) | ||||
repoLocation = new File( REPOPATH_LEGACY_MANAGED_TARGET ); | repoLocation = new File( REPOPATH_LEGACY_MANAGED_TARGET ); | ||||
} | } | ||||
copyDirectoryStructure( new File( REPOPATH_LEGACY_MANAGED ), repoLocation ); | copyDirectoryStructure( new File( REPOPATH_LEGACY_MANAGED ), repoLocation ); | ||||
managedLegacyRepository = createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", | |||||
REPOPATH_LEGACY_MANAGED_TARGET, "legacy" ); | |||||
managedLegacyRepository = | |||||
createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET, | |||||
"legacy" ); | |||||
managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() ); | managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() ); | ||||
repoConfig = managedLegacyRepository.getRepository(); | repoConfig = managedLegacyRepository.getRepository(); | ||||
config.getConfiguration().addManagedRepository( repoConfig ); | |||||
//config.getConfiguration().addManagedRepository( repoConfig ); | |||||
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null ); | |||||
// Setup target (proxied to) repository. | // Setup target (proxied to) repository. | ||||
saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1", new File( | |||||
REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" ); | |||||
saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1", | |||||
new File( REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" ); | |||||
// Setup target (proxied to) repository. | // Setup target (proxied to) repository. | ||||
saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2", new File( | |||||
REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" ); | |||||
saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2", | |||||
new File( REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" ); | |||||
// Setup target (proxied to) repository using legacy layout. | // Setup target (proxied to) repository using legacy layout. | ||||
saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository", new File( | |||||
REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" ); | |||||
saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository", | |||||
new File( REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" ); | |||||
// Setup the proxy handler. | // Setup the proxy handler. | ||||
//proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() ); | //proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() ); | ||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ), ArrayUtils.remove( actual, | |||||
1 ) ); | |||||
return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ), | |||||
ArrayUtils.remove( actual, 1 ) ); | |||||
} | } | ||||
public String toString( Object[] arguments ) | public String toString( Object[] arguments ) | ||||
return; | return; | ||||
} | } | ||||
Collection<File> tmpFiles = org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{"tmp"}, false ); | |||||
Collection<File> tmpFiles = | |||||
org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{ "tmp" }, false ); | |||||
if ( !tmpFiles.isEmpty() ) | if ( !tmpFiles.isEmpty() ) | ||||
{ | { | ||||
StringBuffer emsg = new StringBuffer(); | StringBuffer emsg = new StringBuffer(); | ||||
protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout ) | protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout ) | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); | |||||
ManagedRepository repo = new ManagedRepository(); | |||||
repo.setId( id ); | repo.setId( id ); | ||||
repo.setName( name ); | repo.setName( name ); | ||||
repo.setLocation( path ); | repo.setLocation( path ); | ||||
repo.setLayout( layout ); | repo.setLayout( layout ); | ||||
ManagedRepositoryContent repoContent = applicationContext.getBean( "managedRepositoryContent#" + layout, | |||||
ManagedRepositoryContent.class ); | |||||
ManagedRepositoryContent repoContent = | |||||
applicationContext.getBean( "managedRepositoryContent#" + layout, ManagedRepositoryContent.class ); | |||||
repoContent.setRepository( repo ); | repoContent.setRepository( repo ); | ||||
return repoContent; | return repoContent; | ||||
} | } | ||||
config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) ); | config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) ); | ||||
config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) ); | config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) ); | ||||
config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) ); | config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) ); | ||||
config.triggerChange( prefix + ".policies.propagate-errors", connectorConfig.getPolicy( "propagate-errors", | |||||
"" ) ); | |||||
config.triggerChange( prefix + ".policies.propagate-errors-on-update", connectorConfig.getPolicy( | |||||
"propagate-errors-on-update", "" ) ); | |||||
config.triggerChange( prefix + ".policies.propagate-errors", | |||||
connectorConfig.getPolicy( "propagate-errors", "" ) ); | |||||
config.triggerChange( prefix + ".policies.propagate-errors-on-update", | |||||
connectorConfig.getPolicy( "propagate-errors-on-update", "" ) ); | |||||
} | } | ||||
protected void saveManagedRepositoryConfig( String id, String name, String path, String layout ) | protected void saveManagedRepositoryConfig( String id, String name, String path, String layout ) | ||||
String managedLegacyPath = managedLegacyDir.getCanonicalPath(); | String managedLegacyPath = managedLegacyDir.getCanonicalPath(); | ||||
String testFile = file.getCanonicalPath(); | String testFile = file.getCanonicalPath(); | ||||
assertTrue( "Unit Test Failure: File <" + testFile + | |||||
"> should be have been defined within the legacy managed path of <" + managedLegacyPath + ">", | |||||
testFile.startsWith( managedLegacyPath ) ); | |||||
assertTrue( | |||||
"Unit Test Failure: File <" + testFile + "> should be have been defined within the legacy managed path of <" | |||||
+ managedLegacyPath + ">", testFile.startsWith( managedLegacyPath ) ); | |||||
assertFalse( "File < " + testFile + "> should not exist in managed legacy repository.", file.exists() ); | assertFalse( "File < " + testFile + "> should not exist in managed legacy repository.", file.exists() ); | ||||
} | } | ||||
String managedDefaultPath = managedDefaultDir.getCanonicalPath(); | String managedDefaultPath = managedDefaultDir.getCanonicalPath(); | ||||
String testFile = file.getCanonicalPath(); | String testFile = file.getCanonicalPath(); | ||||
assertTrue( "Unit Test Failure: File <" + testFile + | |||||
"> should be have been defined within the managed default path of <" + managedDefaultPath + ">", | |||||
testFile.startsWith( managedDefaultPath ) ); | |||||
assertTrue( "Unit Test Failure: File <" + testFile | |||||
+ "> should be have been defined within the managed default path of <" + managedDefaultPath | |||||
+ ">", testFile.startsWith( managedDefaultPath ) ); | |||||
assertFalse( "File < " + testFile + "> should not exist in managed default repository.", file.exists() ); | assertFalse( "File < " + testFile + "> should not exist in managed default repository.", file.exists() ); | ||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; | |||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; | import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; | ||||
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; | import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; | ||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | ||||
import org.springframework.test.context.ContextConfiguration; | import org.springframework.test.context.ContextConfiguration; | ||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
import java.io.File; | |||||
import java.io.IOException; | |||||
import javax.inject.Inject; | import javax.inject.Inject; | ||||
import javax.servlet.ServletException; | import javax.servlet.ServletException; | ||||
import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
import java.io.File; | |||||
import java.io.IOException; | |||||
import static org.junit.Assert.*; | import static org.junit.Assert.*; | ||||
* @version $Id: ManagedDefaultTransferTest.java 677852 2008-07-18 08:16:24Z brett $ | * @version $Id: ManagedDefaultTransferTest.java 677852 2008-07-18 08:16:24Z brett $ | ||||
*/ | */ | ||||
@RunWith( SpringJUnit4ClassRunner.class ) | @RunWith( SpringJUnit4ClassRunner.class ) | ||||
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml"} ) | |||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) | |||||
public class HttpProxyTransferTest | public class HttpProxyTransferTest | ||||
{ | { | ||||
private static final String PROXY_ID = "proxy"; | private static final String PROXY_ID = "proxy"; | ||||
// Make the destination dir. | // Make the destination dir. | ||||
destRepoDir.mkdirs(); | destRepoDir.mkdirs(); | ||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); | |||||
ManagedRepository repo = new ManagedRepository(); | |||||
repo.setId( MANAGED_ID ); | repo.setId( MANAGED_ID ); | ||||
repo.setName( "Default Managed Repository" ); | repo.setName( "Default Managed Repository" ); | ||||
repo.setLocation( repoPath ); | repo.setLocation( repoPath ); | ||||
repo.setLayout( "default" ); | repo.setLayout( "default" ); | ||||
ManagedRepositoryContent repoContent = applicationContext.getBean( "managedRepositoryContent#default", | |||||
ManagedRepositoryContent.class ); | |||||
ManagedRepositoryContent repoContent = | |||||
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class ); | |||||
repoContent.setRepository( repo ); | repoContent.setRepository( repo ); | ||||
managedDefaultRepository = repoContent; | managedDefaultRepository = repoContent; | ||||
config.getConfiguration().addManagedRepository( repo ); | |||||
( (DefaultManagedRepositoryAdmin) applicationContext.getBean( | |||||
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config ); | |||||
ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class ); | |||||
if ( managedRepositoryAdmin.getManagedRepository( repo.getId() ) == null ) | |||||
{ | |||||
managedRepositoryAdmin.addManagedRepository( repo, false, null ); | |||||
} | |||||
//config.getConfiguration().addManagedRepository( repo ); | |||||
Handler handler = new AbstractHandler() | Handler handler = new AbstractHandler() | ||||
{ | { |
<redback-role-model> | |||||
<modelVersion>1.0.0</modelVersion> | |||||
<applications> | |||||
<application> | |||||
<id>System</id> | |||||
<description>Roles that apply system-wide, across all of the applications</description> | |||||
<version>1.0.0</version> | |||||
<resources> | |||||
<resource> | |||||
<id>global</id> | |||||
<name>*</name> | |||||
<permanent>true</permanent> | |||||
<description>global resource implies full access for authorization</description> | |||||
</resource> | |||||
<resource> | |||||
<id>username</id> | |||||
<name>${username}</name> | |||||
<permanent>true</permanent> | |||||
<description>replaced with the username of the principal at authorization check time</description> | |||||
</resource> | |||||
</resources> | |||||
<operations> | |||||
<operation> | |||||
<id>configuration-edit</id> | |||||
<name>configuration-edit</name> | |||||
<description>edit configuration</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-create</id> | |||||
<name>user-management-user-create</name> | |||||
<description>create user</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-edit</id> | |||||
<name>user-management-user-edit</name> | |||||
<description>edit user</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-role</id> | |||||
<name>user-management-user-role</name> | |||||
<description>user roles</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-delete</id> | |||||
<name>user-management-user-delete</name> | |||||
<description>delete user</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-list</id> | |||||
<name>user-management-user-list</name> | |||||
<description>list users</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-role-grant</id> | |||||
<name>user-management-role-grant</name> | |||||
<description>grant role</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-role-drop</id> | |||||
<name>user-management-role-drop</name> | |||||
<description>drop role</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-rbac-admin</id> | |||||
<name>user-management-rbac-admin</name> | |||||
<description>administer rbac</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>guest-access</id> | |||||
<name>guest-access</name> | |||||
<description>access guest</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-manage-data</id> | |||||
<name>user-management-manage-data</name> | |||||
<description>manage data</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
</operations> | |||||
<roles> | |||||
<role> | |||||
<id>system-administrator</id> | |||||
<name>System Administrator</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>edit-redback-configuration</id> | |||||
<name>Edit Redback Configuration</name> | |||||
<operation>configuration-edit</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>manage-rbac-setup</id> | |||||
<name>User RBAC Management</name> | |||||
<operation>user-management-rbac-admin</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>manage-rbac-data</id> | |||||
<name>RBAC Manage Data</name> | |||||
<operation>user-management-manage-data</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
<childRoles> | |||||
<childRole>user-administrator</childRole> | |||||
</childRoles> | |||||
</role> | |||||
<role> | |||||
<id>user-administrator</id> | |||||
<name>User Administrator</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>drop-roles-for-anyone</id> | |||||
<name>Drop Roles for Anyone</name> | |||||
<operation>user-management-role-drop</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>grant-roles-for-anyone</id> | |||||
<name>Grant Roles for Anyone</name> | |||||
<operation>user-management-role-grant</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>user-create</id> | |||||
<name>Create Users</name> | |||||
<operation>user-management-user-create</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>user-delete</id> | |||||
<name>Delete Users</name> | |||||
<operation>user-management-user-delete</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>user-edit</id> | |||||
<name>Edit Users</name> | |||||
<operation>user-management-user-edit</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>access-users-roles</id> | |||||
<name>Access Users Roles</name> | |||||
<operation>user-management-user-role</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>access-user-list</id> | |||||
<name>Access User List</name> | |||||
<operation>user-management-user-list</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
</role> | |||||
<role> | |||||
<id>registered-user</id> | |||||
<name>Registered User</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>edit-user-by-username</id> | |||||
<name>Edit User Data by Username</name> | |||||
<operation>user-management-user-edit</operation> | |||||
<resource>username</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
</role> | |||||
<role> | |||||
<id>guest</id> | |||||
<name>Guest</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>guest-permission</id> | |||||
<name>Guest Permission</name> | |||||
<operation>guest-access</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
</role> | |||||
</roles> | |||||
</application> | |||||
</applications> | |||||
</redback-role-model> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!-- | |||||
~ 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. | |||||
--> | |||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<parent> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-repository-admin</artifactId> | |||||
<version>1.4-SNAPSHOT</version> | |||||
</parent> | |||||
<artifactId>archiva-repository-admin-api</artifactId> | |||||
<name>Archiva Base :: Repository Admin Api</name> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>commons-collections</groupId> | |||||
<artifactId>commons-collections</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>commons-lang</groupId> | |||||
<artifactId>commons-lang</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-users-api</artifactId> | |||||
</dependency> | |||||
</dependencies> | |||||
</project> |
package org.apache.archiva.admin.repository; | |||||
package org.apache.archiva.admin.model; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository; | |||||
package org.apache.archiva.admin.model; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin; | |||||
package org.apache.archiva.admin.model; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository; | |||||
package org.apache.archiva.admin.model; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.admin; | |||||
package org.apache.archiva.admin.model.admin; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import java.util.List; | import java.util.List; | ||||
package org.apache.archiva.admin.repository.admin; | |||||
package org.apache.archiva.admin.model.admin; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.admin; | |||||
package org.apache.archiva.admin.model.admin; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.admin; | |||||
package org.apache.archiva.admin.model.admin; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.group; | |||||
package org.apache.archiva.admin.model.group; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.group; | |||||
package org.apache.archiva.admin.model.group; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; |
package org.apache.archiva.admin.repository.managed; | |||||
package org.apache.archiva.admin.model.managed; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.repository.AbstractRepository; | |||||
import org.apache.archiva.admin.model.AbstractRepository; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
*/ | */ | ||||
private ManagedRepository stagingRepository; | private ManagedRepository stagingRepository; | ||||
private boolean scanned = true; | |||||
private boolean scanned = false; | |||||
private String indexDirectory; | private String indexDirectory; | ||||
package org.apache.archiva.admin.repository.managed; | |||||
package org.apache.archiva.admin.model.managed; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; |
package org.apache.archiva.admin.repository.networkproxy; | |||||
package org.apache.archiva.admin.model.networkproxy; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.networkproxy; | |||||
package org.apache.archiva.admin.model.networkproxy; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import java.util.List; | import java.util.List; | ||||
package org.apache.archiva.admin.repository.proxyconnector; | |||||
package org.apache.archiva.admin.model.proxyconnector; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.repository.AbstractRepositoryConnector; | |||||
import org.apache.archiva.admin.model.AbstractRepositoryConnector; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
package org.apache.archiva.admin.repository.proxyconnector; | |||||
package org.apache.archiva.admin.model.proxyconnector; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; |
package org.apache.archiva.admin.repository.proxyconnector; | |||||
package org.apache.archiva.admin.model.proxyconnector; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.proxyconnector; | |||||
package org.apache.archiva.admin.model.proxyconnector; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file |
package org.apache.archiva.admin.repository.remote; | |||||
package org.apache.archiva.admin.model.remote; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.repository.AbstractRepository; | |||||
import org.apache.archiva.admin.model.AbstractRepository; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
package org.apache.archiva.admin.repository.remote; | |||||
package org.apache.archiva.admin.model.remote; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
* or more contributor license agreements. See the NOTICE file | * or more contributor license agreements. See the NOTICE file | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!-- | |||||
~ 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. | |||||
--> | |||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<parent> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-repository-admin</artifactId> | |||||
<version>1.4-SNAPSHOT</version> | |||||
</parent> | |||||
<artifactId>archiva-repository-admin-default</artifactId> | |||||
<name>Archiva Base :: Repository Admin Default</name> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-configuration</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-security-common</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-scheduler-repository</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-repository-admin-api</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>audit</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>javax.inject</groupId> | |||||
<artifactId>javax.inject</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>net.sf.beanlib</groupId> | |||||
<artifactId>beanlib</artifactId> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>cglib</groupId> | |||||
<artifactId>cglib</artifactId> | |||||
</exclusion> | |||||
<exclusion> | |||||
<groupId>aopalliance</groupId> | |||||
<artifactId>aopalliance</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.springframework</groupId> | |||||
<artifactId>spring-context-support</artifactId> | |||||
<version>${spring.version}</version> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.springframework</groupId> | |||||
<artifactId>spring-context</artifactId> | |||||
<version>${spring.version}</version> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.slf4j</groupId> | |||||
<artifactId>slf4j-api</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>commons-validator</groupId> | |||||
<artifactId>commons-validator</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>oro</groupId> | |||||
<artifactId>oro</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback.components</groupId> | |||||
<artifactId>spring-quartz</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-rbac-role-manager</artifactId> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-authentication-api</artifactId> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>junit</groupId> | |||||
<artifactId>junit</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.slf4j</groupId> | |||||
<artifactId>slf4j-log4j12</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-users-memory</artifactId> | |||||
<scope>test</scope> | |||||
<version>${redback.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-keys-memory</artifactId> | |||||
<scope>test</scope> | |||||
<version>${redback.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-rbac-cached</artifactId> | |||||
<version>${redback.version}</version> | |||||
<scope>test</scope> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.derby</groupId> | |||||
<artifactId>derby</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.slf4j</groupId> | |||||
<artifactId>jcl-over-slf4j</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>metadata-store-file</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | |||||
<build> | |||||
<plugins> | |||||
<plugin> | |||||
<groupId>org.apache.maven.plugins</groupId> | |||||
<artifactId>maven-surefire-plugin</artifactId> | |||||
<configuration> | |||||
<systemPropertyVariables> | |||||
<appserver.base>${project.build.outputDirectory}</appserver.base> | |||||
<plexus.home>${project.build.outputDirectory}</plexus.home> | |||||
</systemPropertyVariables> | |||||
</configuration> | |||||
</plugin> | |||||
</plugins> | |||||
</build> | |||||
</project> |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.archiva.audit.AuditListener; | import org.apache.archiva.audit.AuditListener; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.AbstractRepository; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.commons.validator.GenericValidator; | import org.apache.commons.validator.GenericValidator; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; |
*/ | */ | ||||
import net.sf.beanlib.provider.replicator.BeanReplicator; | import net.sf.beanlib.provider.replicator.BeanReplicator; | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.admin.ArchivaAdministration; | |||||
import org.apache.archiva.admin.model.admin.FileType; | |||||
import org.apache.archiva.admin.model.admin.LegacyArtifactPath; | |||||
import org.apache.archiva.admin.model.admin.OrganisationInformation; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | ||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.maven.archiva.configuration.Configuration; | import org.apache.maven.archiva.configuration.Configuration; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.admin.FileType; | |||||
import org.apache.commons.collections.Closure; | import org.apache.commons.collections.Closure; | ||||
import java.util.HashMap; | import java.util.HashMap; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.group.RepositoryGroup; | |||||
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | ||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.repository.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.maven.archiva.configuration.Configuration; | import org.apache.maven.archiva.configuration.Configuration; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | ||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.archiva.metadata.repository.MetadataRepository; | import org.apache.archiva.metadata.repository.MetadataRepository; | ||||
import org.apache.archiva.metadata.repository.MetadataRepositoryException; | import org.apache.archiva.metadata.repository.MetadataRepositoryException; | ||||
repository.setDaysOlder( daysOlder ); | repository.setDaysOlder( daysOlder ); | ||||
repository.setRetentionCount( retentionCount ); | repository.setRetentionCount( retentionCount ); | ||||
repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots ); | repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots ); | ||||
try | try | ||||
{ | { | ||||
addRepository( repository, config ); | addRepository( repository, config ); |
*/ | */ | ||||
import net.sf.beanlib.provider.replicator.BeanReplicator; | import net.sf.beanlib.provider.replicator.BeanReplicator; | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxy; | |||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | ||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.maven.archiva.configuration.Configuration; | import org.apache.maven.archiva.configuration.Configuration; |
*/ | */ | ||||
import net.sf.beanlib.provider.replicator.BeanReplicator; | import net.sf.beanlib.provider.replicator.BeanReplicator; | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnector; | |||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin; | |||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorOrderComparator; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | ||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; | ||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.maven.archiva.configuration.Configuration; | import org.apache.maven.archiva.configuration.Configuration; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.repository.AbstractRepository; | |||||
import org.apache.archiva.admin.model.AbstractRepository; | |||||
import java.util.Comparator; | import java.util.Comparator; | ||||
*/ | */ | ||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
import org.apache.archiva.admin.AuditInformation; | |||||
import org.apache.archiva.admin.mock.MockAuditListener; | import org.apache.archiva.admin.mock.MockAuditListener; | ||||
import org.apache.archiva.admin.repository.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.repository.proxyconnector.ProxyConnectorAdmin; | |||||
import org.apache.archiva.admin.repository.remote.RemoteRepository; | |||||
import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin; | |||||
import org.apache.archiva.admin.model.AuditInformation; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; | |||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.codehaus.plexus.redback.role.RoleManager; | import org.codehaus.plexus.redback.role.RoleManager; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.admin.ArchivaAdministration; | |||||
import org.apache.archiva.admin.model.admin.FileType; | |||||
import org.apache.archiva.admin.model.admin.LegacyArtifactPath; | |||||
import org.apache.archiva.admin.model.admin.OrganisationInformation; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | ||||
import org.apache.archiva.admin.repository.RepositoryAdminException; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.group.RepositoryGroup; | |||||
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | ||||
import org.apache.archiva.admin.repository.managed.ManagedRepository; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | ||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.apache.archiva.security.common.ArchivaRoleConstants; | import org.apache.archiva.security.common.ArchivaRoleConstants; | ||||
import org.apache.commons.io.FileUtils; | |||||
import org.apache.commons.lang.StringUtils; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import java.io.File; | import java.io.File; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxy; | |||||
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | ||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.junit.Test; | import org.junit.Test; |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnector; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | ||||
import org.apache.archiva.admin.repository.remote.RemoteRepository; | |||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; | ||||
import org.apache.archiva.audit.AuditEvent; | import org.apache.archiva.audit.AuditEvent; | ||||
import org.junit.Test; | import org.junit.Test; |
<redback-role-model> | |||||
<modelVersion>1.0.0</modelVersion> | |||||
<applications> | |||||
<application> | |||||
<id>System</id> | |||||
<description>Roles that apply system-wide, across all of the applications</description> | |||||
<version>1.0.0</version> | |||||
<resources> | |||||
<resource> | |||||
<id>global</id> | |||||
<name>*</name> | |||||
<permanent>true</permanent> | |||||
<description>global resource implies full access for authorization</description> | |||||
</resource> | |||||
<resource> | |||||
<id>username</id> | |||||
<name>${username}</name> | |||||
<permanent>true</permanent> | |||||
<description>replaced with the username of the principal at authorization check time</description> | |||||
</resource> | |||||
</resources> | |||||
<operations> | |||||
<operation> | |||||
<id>configuration-edit</id> | |||||
<name>configuration-edit</name> | |||||
<description>edit configuration</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-create</id> | |||||
<name>user-management-user-create</name> | |||||
<description>create user</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-edit</id> | |||||
<name>user-management-user-edit</name> | |||||
<description>edit user</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-role</id> | |||||
<name>user-management-user-role</name> | |||||
<description>user roles</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-delete</id> | |||||
<name>user-management-user-delete</name> | |||||
<description>delete user</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-user-list</id> | |||||
<name>user-management-user-list</name> | |||||
<description>list users</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-role-grant</id> | |||||
<name>user-management-role-grant</name> | |||||
<description>grant role</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-role-drop</id> | |||||
<name>user-management-role-drop</name> | |||||
<description>drop role</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-rbac-admin</id> | |||||
<name>user-management-rbac-admin</name> | |||||
<description>administer rbac</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>guest-access</id> | |||||
<name>guest-access</name> | |||||
<description>access guest</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
<operation> | |||||
<id>user-management-manage-data</id> | |||||
<name>user-management-manage-data</name> | |||||
<description>manage data</description> | |||||
<permanent>true</permanent> | |||||
</operation> | |||||
</operations> | |||||
<roles> | |||||
<role> | |||||
<id>system-administrator</id> | |||||
<name>System Administrator</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>edit-redback-configuration</id> | |||||
<name>Edit Redback Configuration</name> | |||||
<operation>configuration-edit</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>manage-rbac-setup</id> | |||||
<name>User RBAC Management</name> | |||||
<operation>user-management-rbac-admin</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>manage-rbac-data</id> | |||||
<name>RBAC Manage Data</name> | |||||
<operation>user-management-manage-data</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
<childRoles> | |||||
<childRole>user-administrator</childRole> | |||||
</childRoles> | |||||
</role> | |||||
<role> | |||||
<id>user-administrator</id> | |||||
<name>User Administrator</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>drop-roles-for-anyone</id> | |||||
<name>Drop Roles for Anyone</name> | |||||
<operation>user-management-role-drop</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>grant-roles-for-anyone</id> | |||||
<name>Grant Roles for Anyone</name> | |||||
<operation>user-management-role-grant</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>user-create</id> | |||||
<name>Create Users</name> | |||||
<operation>user-management-user-create</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>user-delete</id> | |||||
<name>Delete Users</name> | |||||
<operation>user-management-user-delete</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>user-edit</id> | |||||
<name>Edit Users</name> | |||||
<operation>user-management-user-edit</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>access-users-roles</id> | |||||
<name>Access Users Roles</name> | |||||
<operation>user-management-user-role</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
<permission> | |||||
<id>access-user-list</id> | |||||
<name>Access User List</name> | |||||
<operation>user-management-user-list</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
</role> | |||||
<role> | |||||
<id>registered-user</id> | |||||
<name>Registered User</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>edit-user-by-username</id> | |||||
<name>Edit User Data by Username</name> | |||||
<operation>user-management-user-edit</operation> | |||||
<resource>username</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
</role> | |||||
<role> | |||||
<id>guest</id> | |||||
<name>Guest</name> | |||||
<permanent>true</permanent> | |||||
<assignable>true</assignable> | |||||
<permissions> | |||||
<permission> | |||||
<id>guest-permission</id> | |||||
<name>Guest Permission</name> | |||||
<operation>guest-access</operation> | |||||
<resource>global</resource> | |||||
<permanent>true</permanent> | |||||
</permission> | |||||
</permissions> | |||||
</role> | |||||
</roles> | |||||
</application> | |||||
</applications> | |||||
</redback-role-model> |
</parent> | </parent> | ||||
<artifactId>archiva-repository-admin</artifactId> | <artifactId>archiva-repository-admin</artifactId> | ||||
<name>Archiva Base :: Repository Admin</name> | <name>Archiva Base :: Repository Admin</name> | ||||
<dependencies> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-configuration</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-security-common</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-scheduler-repository</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>audit</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>javax.inject</groupId> | |||||
<artifactId>javax.inject</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>net.sf.beanlib</groupId> | |||||
<artifactId>beanlib</artifactId> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>cglib</groupId> | |||||
<artifactId>cglib</artifactId> | |||||
</exclusion> | |||||
<exclusion> | |||||
<groupId>aopalliance</groupId> | |||||
<artifactId>aopalliance</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.springframework</groupId> | |||||
<artifactId>spring-context-support</artifactId> | |||||
<version>${spring.version}</version> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.springframework</groupId> | |||||
<artifactId>spring-context</artifactId> | |||||
<version>${spring.version}</version> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.slf4j</groupId> | |||||
<artifactId>slf4j-api</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>commons-validator</groupId> | |||||
<artifactId>commons-validator</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>oro</groupId> | |||||
<artifactId>oro</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback.components</groupId> | |||||
<artifactId>spring-quartz</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-rbac-role-manager</artifactId> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-authentication-api</artifactId> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>junit</groupId> | |||||
<artifactId>junit</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.slf4j</groupId> | |||||
<artifactId>slf4j-log4j12</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-users-memory</artifactId> | |||||
<scope>test</scope> | |||||
<version>${redback.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-keys-memory</artifactId> | |||||
<scope>test</scope> | |||||
<version>${redback.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.codehaus.redback</groupId> | |||||
<artifactId>redback-rbac-cached</artifactId> | |||||
<version>${redback.version}</version> | |||||
<scope>test</scope> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.derby</groupId> | |||||
<artifactId>derby</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.slf4j</groupId> | |||||
<artifactId>jcl-over-slf4j</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>metadata-store-file</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | |||||
<build> | |||||
<plugins> | |||||
<plugin> | |||||
<groupId>org.apache.maven.plugins</groupId> | |||||
<artifactId>maven-surefire-plugin</artifactId> | |||||
<configuration> | |||||
<systemPropertyVariables> | |||||
<appserver.base>${project.build.outputDirectory}</appserver.base> | |||||
<plexus.home>${project.build.outputDirectory}</plexus.home> | |||||
</systemPropertyVariables> | |||||
</configuration> | |||||
</plugin> | |||||
</plugins> | |||||
</build> | |||||
<packaging>pom</packaging> | |||||
<modules> | |||||
<module>archiva-repository-admin-api</module> | |||||
<module>archiva-repository-admin-default</module> | |||||
</modules> | |||||
</project> | </project> |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.maven.archiva.model.ArchivaArtifact; | import org.apache.maven.archiva.model.ArchivaArtifact; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
import org.apache.maven.archiva.model.ProjectReference; | import org.apache.maven.archiva.model.ProjectReference; | ||||
import java.util.Set; | import java.util.Set; | ||||
/** | /** | ||||
* ManagedRepositoryContent interface for interacting with a managed repository in an abstract way, | |||||
* ManagedRepositoryContent interface for interacting with a managed repository in an abstract way, | |||||
* without the need for processing based on filesystem paths, or working with the database. | * without the need for processing based on filesystem paths, or working with the database. | ||||
* | * | ||||
* @version $Id$ | * @version $Id$ | ||||
/** | /** | ||||
* Delete from the managed repository all files / directories associated with the | * Delete from the managed repository all files / directories associated with the | ||||
* provided version reference. | * provided version reference. | ||||
* | |||||
* | |||||
* @param reference the version reference to delete. | * @param reference the version reference to delete. | ||||
* @throws ContentNotFoundException | |||||
* @throws ContentNotFoundException | |||||
*/ | */ | ||||
void deleteVersion( VersionedReference reference ) | void deleteVersion( VersionedReference reference ) | ||||
throws ContentNotFoundException; | throws ContentNotFoundException; | ||||
* <p> | * <p> | ||||
* Convenience method to get the repository id. | * Convenience method to get the repository id. | ||||
* </p> | * </p> | ||||
* | |||||
* <p/> | |||||
* <p> | * <p> | ||||
* Equivalent to calling <code>.getRepository().getId()</code> | * Equivalent to calling <code>.getRepository().getId()</code> | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @return the repository id. | * @return the repository id. | ||||
*/ | */ | ||||
String getId(); | String getId(); | ||||
/** | /** | ||||
* <p> | * <p> | ||||
* Gather up the list of related artifacts to the ArtifactReference provided. | * Gather up the list of related artifacts to the ArtifactReference provided. | ||||
* This typically inclues the pom files, and those things with | |||||
* This typically inclues the pom files, and those things with | |||||
* classifiers (such as doc, source code, test libs, etc...) | * classifiers (such as doc, source code, test libs, etc...) | ||||
* </p> | * </p> | ||||
* | |||||
* <p/> | |||||
* <p> | * <p> | ||||
* <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query. | * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query. | ||||
* </p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @param reference the reference to work off of. | * @param reference the reference to work off of. | ||||
* @return the set of ArtifactReferences for related artifacts. | * @return the set of ArtifactReferences for related artifacts. | ||||
* @throws ContentNotFoundException if the initial artifact reference does not exist within the repository. | * @throws ContentNotFoundException if the initial artifact reference does not exist within the repository. | ||||
* @throws LayoutException | |||||
* @throws LayoutException | |||||
*/ | */ | ||||
Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) | Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) | ||||
throws ContentNotFoundException; | throws ContentNotFoundException; | ||||
* <p> | * <p> | ||||
* Convenience method to get the repository (on disk) root directory. | * Convenience method to get the repository (on disk) root directory. | ||||
* </p> | * </p> | ||||
* | |||||
* <p/> | |||||
* <p> | * <p> | ||||
* Equivalent to calling <code>.getRepository().getLocation()</code> | * Equivalent to calling <code>.getRepository().getLocation()</code> | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @return the repository (on disk) root directory. | * @return the repository (on disk) root directory. | ||||
*/ | */ | ||||
String getRepoRoot(); | String getRepoRoot(); | ||||
/** | /** | ||||
* Get the repository configuration associated with this | * Get the repository configuration associated with this | ||||
* repository content. | * repository content. | ||||
* | |||||
* | |||||
* @return the repository that is associated with this repository content. | * @return the repository that is associated with this repository content. | ||||
*/ | */ | ||||
ManagedRepositoryConfiguration getRepository(); | |||||
ManagedRepository getRepository(); | |||||
/** | /** | ||||
* Given a specific {@link ProjectReference}, return the list of available versions for | * Given a specific {@link ProjectReference}, return the list of available versions for | ||||
* that project reference. | * that project reference. | ||||
* | |||||
* | |||||
* @param reference the project reference to work off of. | * @param reference the project reference to work off of. | ||||
* @return the list of versions found for that project reference. | * @return the list of versions found for that project reference. | ||||
* @throws ContentNotFoundException if the project reference does nto exist within the repository. | * @throws ContentNotFoundException if the project reference does nto exist within the repository. | ||||
* @throws LayoutException | |||||
* @throws LayoutException | |||||
*/ | */ | ||||
Set<String> getVersions( ProjectReference reference ) | Set<String> getVersions( ProjectReference reference ) | ||||
throws ContentNotFoundException, LayoutException; | throws ContentNotFoundException, LayoutException; | ||||
* Given a specific {@link VersionedReference}, return the list of available versions for that | * Given a specific {@link VersionedReference}, return the list of available versions for that | ||||
* versioned reference. | * versioned reference. | ||||
* </p> | * </p> | ||||
* | |||||
* <p/> | |||||
* <p> | * <p> | ||||
* <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs. | * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param reference the versioned reference to work off of. | * @param reference the versioned reference to work off of. | ||||
* @return the set of versions found. | * @return the set of versions found. | ||||
* @throws ContentNotFoundException if the versioned reference does not exist within the repository. | * @throws ContentNotFoundException if the versioned reference does not exist within the repository. | ||||
* @throws LayoutException | |||||
* @throws LayoutException | |||||
*/ | */ | ||||
public Set<String> getVersions( VersionedReference reference ) | |||||
Set<String> getVersions( VersionedReference reference ) | |||||
throws ContentNotFoundException; | throws ContentNotFoundException; | ||||
/** | /** | ||||
* Determines if the artifact referenced exists in the repository. | * Determines if the artifact referenced exists in the repository. | ||||
* | |||||
* | |||||
* @param reference the artifact reference to check for. | * @param reference the artifact reference to check for. | ||||
* @return true if the artifact referenced exists. | * @return true if the artifact referenced exists. | ||||
*/ | */ | ||||
public boolean hasContent( ArtifactReference reference ); | |||||
boolean hasContent( ArtifactReference reference ); | |||||
/** | /** | ||||
* Determines if the project referenced exists in the repository. | * Determines if the project referenced exists in the repository. | ||||
* | |||||
* | |||||
* @param reference the project reference to check for. | * @param reference the project reference to check for. | ||||
* @return true it the project referenced exists. | * @return true it the project referenced exists. | ||||
*/ | */ | ||||
public boolean hasContent( ProjectReference reference ); | |||||
boolean hasContent( ProjectReference reference ); | |||||
/** | /** | ||||
* Determines if the version reference exists in the repository. | * Determines if the version reference exists in the repository. | ||||
* | |||||
* | |||||
* @param reference the version reference to check for. | * @param reference the version reference to check for. | ||||
* @return true if the version referenced exists. | * @return true if the version referenced exists. | ||||
*/ | */ | ||||
public boolean hasContent( VersionedReference reference ); | |||||
boolean hasContent( VersionedReference reference ); | |||||
/** | /** | ||||
* Set the repository configuration to associate with this | * Set the repository configuration to associate with this | ||||
* repository content. | * repository content. | ||||
* | |||||
* | |||||
* @param repo the repository to associate with this repository content. | * @param repo the repository to associate with this repository content. | ||||
*/ | */ | ||||
public void setRepository( ManagedRepositoryConfiguration repo ); | |||||
void setRepository( ManagedRepository repo ); | |||||
/** | /** | ||||
* Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path. | * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path. | ||||
* a {@link ArtifactReference}) | * a {@link ArtifactReference}) | ||||
* @throws LayoutException if there was a problem converting the path to an artifact. | * @throws LayoutException if there was a problem converting the path to an artifact. | ||||
*/ | */ | ||||
public ArtifactReference toArtifactReference( String path ) | |||||
ArtifactReference toArtifactReference( String path ) | |||||
throws LayoutException; | throws LayoutException; | ||||
/** | /** | ||||
* @param reference the artifact reference to use. | * @param reference the artifact reference to use. | ||||
* @return the relative path to the artifact. | * @return the relative path to the artifact. | ||||
*/ | */ | ||||
public File toFile( ArtifactReference reference ); | |||||
File toFile( ArtifactReference reference ); | |||||
/** | /** | ||||
* Given an {@link ArchivaArtifact}, return the file reference to the artifact. | * Given an {@link ArchivaArtifact}, return the file reference to the artifact. | ||||
* | * | ||||
* @param reference the archiva artifact to use. | * @param reference the archiva artifact to use. | ||||
* @return the relative path to the artifact. | * @return the relative path to the artifact. | ||||
*/ | */ | ||||
public File toFile( ArchivaArtifact reference ); | |||||
File toFile( ArchivaArtifact reference ); | |||||
/** | /** | ||||
* Given a {@link ProjectReference}, return the path to the metadata for | * Given a {@link ProjectReference}, return the path to the metadata for | ||||
* the project. | |||||
* | |||||
* the project. | |||||
* | |||||
* @param reference the reference to use. | * @param reference the reference to use. | ||||
* @return the path to the metadata file, or null if no metadata is appropriate. | * @return the path to the metadata file, or null if no metadata is appropriate. | ||||
*/ | */ | ||||
public String toMetadataPath( ProjectReference reference ); | |||||
String toMetadataPath( ProjectReference reference ); | |||||
/** | /** | ||||
* Given a {@link VersionedReference}, return the path to the metadata for | * Given a {@link VersionedReference}, return the path to the metadata for | ||||
* the specific version of the project. | |||||
* | |||||
* the specific version of the project. | |||||
* | |||||
* @param reference the reference to use. | * @param reference the reference to use. | ||||
* @return the path to the metadata file, or null if no metadata is appropriate. | * @return the path to the metadata file, or null if no metadata is appropriate. | ||||
*/ | */ | ||||
public String toMetadataPath( VersionedReference reference ); | |||||
String toMetadataPath( VersionedReference reference ); | |||||
/** | /** | ||||
* Given an {@link ArtifactReference}, return the relative path to the artifact. | * Given an {@link ArtifactReference}, return the relative path to the artifact. | ||||
* @param reference the artifact reference to use. | * @param reference the artifact reference to use. | ||||
* @return the relative path to the artifact. | * @return the relative path to the artifact. | ||||
*/ | */ | ||||
public String toPath( ArtifactReference reference ); | |||||
String toPath( ArtifactReference reference ); | |||||
/** | /** | ||||
* Given an {@link ArchivaArtifact}, return the relative path to the artifact. | * Given an {@link ArchivaArtifact}, return the relative path to the artifact. | ||||
* | * | ||||
* @param reference the archiva artifact to use. | * @param reference the archiva artifact to use. | ||||
* @return the relative path to the artifact. | * @return the relative path to the artifact. | ||||
*/ | */ | ||||
public String toPath( ArchivaArtifact reference ); | |||||
String toPath( ArchivaArtifact reference ); | |||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
import org.apache.maven.archiva.model.RepositoryURL; | import org.apache.maven.archiva.model.RepositoryURL; | ||||
* | * | ||||
* @return the repository that is associated with this repository content. | * @return the repository that is associated with this repository content. | ||||
*/ | */ | ||||
RemoteRepositoryConfiguration getRepository(); | |||||
RemoteRepository getRepository(); | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* | * | ||||
* @param repo the repository to associate with this repository content. | * @param repo the repository to associate with this repository content. | ||||
*/ | */ | ||||
void setRepository( RemoteRepositoryConfiguration repo ); | |||||
void setRepository( RemoteRepository repo ); | |||||
/** | /** | ||||
* Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path. | * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path. |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.RepositoryAdminException; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; | |||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ConfigurationNames; | import org.apache.maven.archiva.configuration.ConfigurationNames; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | |||||
import org.codehaus.plexus.registry.Registry; | import org.codehaus.plexus.registry.Registry; | ||||
import org.codehaus.plexus.registry.RegistryListener; | import org.codehaus.plexus.registry.RegistryListener; | ||||
import org.springframework.context.ApplicationContext; | import org.springframework.context.ApplicationContext; | ||||
@Inject | @Inject | ||||
private ArchivaConfiguration archivaConfiguration; | private ArchivaConfiguration archivaConfiguration; | ||||
@Inject | |||||
private ManagedRepositoryAdmin managedRepositoryAdmin; | |||||
@Inject | |||||
private RemoteRepositoryAdmin remoteRepositoryAdmin; | |||||
@Inject | @Inject | ||||
private ApplicationContext applicationContext; | private ApplicationContext applicationContext; | ||||
public ManagedRepositoryContent getManagedRepositoryContent( String repoId ) | public ManagedRepositoryContent getManagedRepositoryContent( String repoId ) | ||||
throws RepositoryNotFoundException, RepositoryException | throws RepositoryNotFoundException, RepositoryException | ||||
{ | { | ||||
ManagedRepositoryContent repo = managedContentMap.get( repoId ); | |||||
if ( repo != null ) | |||||
try | |||||
{ | { | ||||
ManagedRepositoryContent repo = managedContentMap.get( repoId ); | |||||
if ( repo != null ) | |||||
{ | |||||
return repo; | |||||
} | |||||
ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repoId ); | |||||
if ( repoConfig == null ) | |||||
{ | |||||
throw new RepositoryNotFoundException( | |||||
"Unable to find managed repository configuration for id:" + repoId ); | |||||
} | |||||
repo = applicationContext.getBean( "managedRepositoryContent#" + repoConfig.getLayout(), | |||||
ManagedRepositoryContent.class ); | |||||
repo.setRepository( repoConfig ); | |||||
managedContentMap.put( repoId, repo ); | |||||
return repo; | return repo; | ||||
} | } | ||||
ManagedRepositoryConfiguration repoConfig = | |||||
archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId ); | |||||
if ( repoConfig == null ) | |||||
catch ( RepositoryAdminException e ) | |||||
{ | { | ||||
throw new RepositoryNotFoundException( "Unable to find managed repository configuration for id:" + repoId ); | |||||
throw new RepositoryException( e.getMessage(), e ); | |||||
} | } | ||||
repo = applicationContext.getBean( "managedRepositoryContent#" + repoConfig.getLayout(), | |||||
ManagedRepositoryContent.class ); | |||||
repo.setRepository( repoConfig ); | |||||
managedContentMap.put( repoId, repo ); | |||||
return repo; | |||||
} | } | ||||
public RemoteRepositoryContent getRemoteRepositoryContent( String repoId ) | public RemoteRepositoryContent getRemoteRepositoryContent( String repoId ) | ||||
throws RepositoryNotFoundException, RepositoryException | throws RepositoryNotFoundException, RepositoryException | ||||
{ | { | ||||
RemoteRepositoryContent repo = remoteContentMap.get( repoId ); | |||||
if ( repo != null ) | |||||
try | |||||
{ | { | ||||
RemoteRepositoryContent repo = remoteContentMap.get( repoId ); | |||||
if ( repo != null ) | |||||
{ | |||||
return repo; | |||||
} | |||||
RemoteRepository repoConfig = remoteRepositoryAdmin.getRemoteRepository( repoId ); | |||||
if ( repoConfig == null ) | |||||
{ | |||||
throw new RepositoryNotFoundException( | |||||
"Unable to find remote repository configuration for id:" + repoId ); | |||||
} | |||||
repo = applicationContext.getBean( "remoteRepositoryContent#" + repoConfig.getLayout(), | |||||
RemoteRepositoryContent.class ); | |||||
repo.setRepository( repoConfig ); | |||||
remoteContentMap.put( repoId, repo ); | |||||
return repo; | return repo; | ||||
} | } | ||||
RemoteRepositoryConfiguration repoConfig = | |||||
archivaConfiguration.getConfiguration().findRemoteRepositoryById( repoId ); | |||||
if ( repoConfig == null ) | |||||
catch ( RepositoryAdminException e ) | |||||
{ | { | ||||
throw new RepositoryNotFoundException( "Unable to find remote repository configuration for id:" + repoId ); | |||||
throw new RepositoryException( e.getMessage(), e ); | |||||
} | } | ||||
repo = applicationContext.getBean( "remoteRepositoryContent#" + repoConfig.getLayout(), | |||||
RemoteRepositoryContent.class ); | |||||
repo.setRepository( repoConfig ); | |||||
remoteContentMap.put( repoId, repo ); | |||||
return repo; | |||||
} | } | ||||
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider; | import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider; | ||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.maven.archiva.common.utils.PathUtil; | import org.apache.maven.archiva.common.utils.PathUtil; | ||||
@Named(value = "fileTypes" ) | @Named(value = "fileTypes" ) | ||||
private FileTypes filetypes; | private FileTypes filetypes; | ||||
private ManagedRepositoryConfiguration repository; | |||||
private ManagedRepository repository; | |||||
public ManagedDefaultRepositoryContent() | public ManagedDefaultRepositoryContent() | ||||
{ | { | ||||
return repository.getLocation(); | return repository.getLocation(); | ||||
} | } | ||||
public ManagedRepositoryConfiguration getRepository() | |||||
public ManagedRepository getRepository() | |||||
{ | { | ||||
return repository; | return repository; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public void setRepository( ManagedRepositoryConfiguration repository ) | |||||
public void setRepository( ManagedRepository repository ) | |||||
{ | { | ||||
this.repository = repository; | this.repository = repository; | ||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.maven.archiva.common.utils.PathUtil; | import org.apache.maven.archiva.common.utils.PathUtil; | ||||
@Inject | @Inject | ||||
private FileTypes filetypes; | private FileTypes filetypes; | ||||
private ManagedRepositoryConfiguration repository; | |||||
private ManagedRepository repository; | |||||
public void deleteVersion( VersionedReference reference ) | public void deleteVersion( VersionedReference reference ) | ||||
throws ContentNotFoundException | throws ContentNotFoundException | ||||
return repository.getLocation(); | return repository.getLocation(); | ||||
} | } | ||||
public ManagedRepositoryConfiguration getRepository() | |||||
public ManagedRepository getRepository() | |||||
{ | { | ||||
return repository; | return repository; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public void setRepository( ManagedRepositoryConfiguration repository ) | |||||
public void setRepository( ManagedRepository repository ) | |||||
{ | { | ||||
this.repository = repository; | this.repository = repository; | ||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
import org.apache.maven.archiva.model.RepositoryURL; | import org.apache.maven.archiva.model.RepositoryURL; | ||||
extends AbstractDefaultRepositoryContent | extends AbstractDefaultRepositoryContent | ||||
implements RemoteRepositoryContent | implements RemoteRepositoryContent | ||||
{ | { | ||||
private RemoteRepositoryConfiguration repository; | |||||
private RemoteRepository repository; | |||||
public String getId() | public String getId() | ||||
{ | { | ||||
return repository.getId(); | return repository.getId(); | ||||
} | } | ||||
public RemoteRepositoryConfiguration getRepository() | |||||
public RemoteRepository getRepository() | |||||
{ | { | ||||
return repository; | return repository; | ||||
} | } | ||||
return new RepositoryURL( repository.getUrl() ); | return new RepositoryURL( repository.getUrl() ); | ||||
} | } | ||||
public void setRepository( RemoteRepositoryConfiguration repository ) | |||||
public void setRepository( RemoteRepository repository ) | |||||
{ | { | ||||
this.repository = repository; | this.repository = repository; | ||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
import org.apache.maven.archiva.model.RepositoryURL; | import org.apache.maven.archiva.model.RepositoryURL; | ||||
extends AbstractLegacyRepositoryContent | extends AbstractLegacyRepositoryContent | ||||
implements RemoteRepositoryContent | implements RemoteRepositoryContent | ||||
{ | { | ||||
private RemoteRepositoryConfiguration repository; | |||||
private RemoteRepository repository; | |||||
public String getId() | public String getId() | ||||
{ | { | ||||
return repository.getId(); | return repository.getId(); | ||||
} | } | ||||
public RemoteRepositoryConfiguration getRepository() | |||||
public RemoteRepository getRepository() | |||||
{ | { | ||||
return repository; | return repository; | ||||
} | } | ||||
return new RepositoryURL( repository.getUrl() ); | return new RepositoryURL( repository.getUrl() ); | ||||
} | } | ||||
public void setRepository( RemoteRepositoryConfiguration repository ) | |||||
public void setRepository( RemoteRepository repository ) | |||||
{ | { | ||||
this.repository = repository; | this.repository = repository; | ||||
} | } |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | ||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | ||||
import org.junit.Rule; | import org.junit.Rule; | ||||
@Inject | @Inject | ||||
protected ApplicationContext applicationContext; | protected ApplicationContext applicationContext; | ||||
protected ManagedRepositoryConfiguration createRepository( String id, String name, File location ) | |||||
protected ManagedRepository createRepository( String id, String name, File location ) | |||||
{ | { | ||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); | |||||
ManagedRepository repo = new ManagedRepository(); | |||||
repo.setId( id ); | repo.setId( id ); | ||||
repo.setName( name ); | repo.setName( name ); | ||||
repo.setLocation( location.getAbsolutePath() ); | repo.setLocation( location.getAbsolutePath() ); | ||||
return repo; | return repo; | ||||
} | } | ||||
protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url ) | |||||
protected RemoteRepository createRemoteRepository( String id, String name, String url ) | |||||
{ | { | ||||
RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration(); | |||||
RemoteRepository repo = new RemoteRepository(); | |||||
repo.setId( id ); | repo.setId( id ); | ||||
repo.setName( name ); | repo.setName( name ); | ||||
repo.setUrl( url ); | repo.setUrl( url ); | ||||
String layout ) | String layout ) | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); | |||||
ManagedRepository repo = new ManagedRepository(); | |||||
repo.setId( id ); | repo.setId( id ); | ||||
repo.setName( name ); | repo.setName( name ); | ||||
repo.setLocation( location.getAbsolutePath() ); | repo.setLocation( location.getAbsolutePath() ); | ||||
protected RemoteRepositoryContent createRemoteRepositoryContent( String id, String name, String url, String layout ) | protected RemoteRepositoryContent createRemoteRepositoryContent( String id, String name, String url, String layout ) | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration(); | |||||
RemoteRepository repo = new RemoteRepository(); | |||||
repo.setId( id ); | repo.setId( id ); | ||||
repo.setName( name ); | repo.setName( name ); | ||||
repo.setUrl( url ); | repo.setUrl( url ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.maven.archiva.common.utils.VersionComparator; | import org.apache.maven.archiva.common.utils.VersionComparator; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.FileType; | import org.apache.maven.archiva.configuration.FileType; | ||||
{ | { | ||||
File repoDir = new File( "src/test/repositories/default-repository" ); | File repoDir = new File( "src/test/repositories/default-repository" ); | ||||
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir ); | |||||
ManagedRepository repository = createRepository( "testRepo", "Unit Test Repo", repoDir ); | |||||
FileType fileType = | FileType fileType = |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.maven.archiva.common.utils.VersionComparator; | import org.apache.maven.archiva.common.utils.VersionComparator; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
{ | { | ||||
File repoDir = new File( "src/test/repositories/legacy-repository" ); | File repoDir = new File( "src/test/repositories/legacy-repository" ); | ||||
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir ); | |||||
ManagedRepository repository = createRepository( "testRepo", "Unit Test Repo", repoDir ); | |||||
repository.setLayout( "legacy" ); | repository.setLayout( "legacy" ); | ||||
//repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "legacy" ); | //repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "legacy" ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
import org.apache.maven.archiva.repository.RemoteRepositoryContent; | import org.apache.maven.archiva.repository.RemoteRepositoryContent; | ||||
public void setUp() | public void setUp() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo", | |||||
RemoteRepository repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo", | |||||
"http://repo1.maven.org/maven2/" ); | "http://repo1.maven.org/maven2/" ); | ||||
//repoContent = (RemoteRepositoryContent) lookup( RemoteRepositoryContent.class, "default" ); | //repoContent = (RemoteRepositoryContent) lookup( RemoteRepositoryContent.class, "default" ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.remote.RemoteRepository; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | ||||
import org.apache.maven.archiva.model.ArtifactReference; | import org.apache.maven.archiva.model.ArtifactReference; | ||||
import org.apache.maven.archiva.repository.RemoteRepositoryContent; | import org.apache.maven.archiva.repository.RemoteRepositoryContent; | ||||
public void setUp() | public void setUp() | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
RemoteRepositoryConfiguration repository = | |||||
RemoteRepository repository = | |||||
createRemoteRepository( "testRemoteLegacyRepo", "Unit Test Remote Legacy Repo", | createRemoteRepository( "testRemoteLegacyRepo", "Unit Test Remote Legacy Repo", | ||||
"http://repo1.maven.org/maven/" ); | "http://repo1.maven.org/maven/" ); | ||||
repository.setLayout( "legacy" ); | repository.setLayout( "legacy" ); |
* under the License. | * under the License. | ||||
*/ | */ | ||||
import org.apache.archiva.admin.model.managed.ManagedRepository; | |||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.maven.archiva.common.utils.VersionComparator; | import org.apache.maven.archiva.common.utils.VersionComparator; | ||||
reference.setArtifactId( artifactId ); | reference.setArtifactId( artifactId ); | ||||
reference.setVersion( version ); | reference.setVersion( version ); | ||||
ManagedRepositoryConfiguration repo = | |||||
ManagedRepository repo = | |||||
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRootDir ); | createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRootDir ); | ||||
ManagedRepositoryContent repoContent = | ManagedRepositoryContent repoContent = | ||||
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class ); | applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class ); | ||||
repoRoot.mkdirs(); | repoRoot.mkdirs(); | ||||
ManagedRepositoryConfiguration repoConfig = | |||||
ManagedRepository repoConfig = | |||||
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRoot ); | createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRoot ); | ||||
ManagedRepositoryContent repoContent = | ManagedRepositoryContent repoContent = |