diff options
author | Brett Porter <brett@apache.org> | 2008-03-29 03:09:22 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2008-03-29 03:09:22 +0000 |
commit | a05f42cc0ec53b094ddd64661579374792a55231 (patch) | |
tree | 32274f5d8286676016f357caf10dce8be975f28e /archiva-base/archiva-configuration | |
parent | ed0fa81292f6aaca377638a3fbf5b80cef029452 (diff) | |
download | archiva-a05f42cc0ec53b094ddd64661579374792a55231.tar.gz archiva-a05f42cc0ec53b094ddd64661579374792a55231.zip |
restructure according to discussion on the dev list
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@642497 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-configuration')
40 files changed, 0 insertions, 5967 deletions
diff --git a/archiva-base/archiva-configuration/pom.xml b/archiva-base/archiva-configuration/pom.xml deleted file mode 100644 index f42b65fdc..000000000 --- a/archiva-base/archiva-configuration/pom.xml +++ /dev/null @@ -1,118 +0,0 @@ -<?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"> - <parent> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-base</artifactId> - <version>1.1-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>archiva-configuration</artifactId> - <name>Archiva Base :: Configuration</name> - <dependencies> - <dependency> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-common</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva</groupId> - <artifactId>archiva-policies</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-api</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus.registry</groupId> - <artifactId>plexus-registry-api</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus.registry</groupId> - <artifactId>plexus-registry-commons</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-expression-evaluator</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </dependency> - <dependency> - <groupId>xmlunit</groupId> - <artifactId>xmlunit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.modello</groupId> - <artifactId>modello-maven-plugin</artifactId> - <version>1.0-alpha-15</version> - <executions> - <execution> - <goals> - <goal>java</goal> - <goal>registry-reader</goal> - <goal>registry-writer</goal> - </goals> - </execution> - </executions> - <configuration> - <version>1.1.0</version> - <model>src/main/mdo/configuration.mdo</model> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>cobertura-maven-plugin</artifactId> - <configuration> - <instrumentation> - <!-- exclude generated --> - <excludes> - <exclude>org/apache/maven/archiva/configuration/io/**</exclude> - <exclude>org/apache/maven/archiva/configuration/*RepositoryConfiguration.*</exclude> - <exclude>org/apache/maven/archiva/configuration/Configuration.*</exclude> - <exclude>org/apache/maven/archiva/configuration/Proxy.*</exclude> - </excludes> - </instrumentation> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ArchivaConfiguration.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ArchivaConfiguration.java deleted file mode 100644 index 0705fd654..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ArchivaConfiguration.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.codehaus.plexus.registry.RegistryException; -import org.codehaus.plexus.registry.RegistryListener; - -/** - * Configuration holder for the model read from the registry. - */ -public interface ArchivaConfiguration -{ - String ROLE = ArchivaConfiguration.class.getName(); - - /** - * Get the configuration. - * - * @return the configuration - */ - Configuration getConfiguration(); - - /** - * Save any updated configuration. - * - * @param configuration the configuration to save - * @throws org.codehaus.plexus.registry.RegistryException - * if there is a problem saving the registry data - * @throws IndeterminateConfigurationException - * if the configuration cannot be saved because it was read from two sources - */ - void save( Configuration configuration ) - throws RegistryException, IndeterminateConfigurationException; - - /** - * Determines if the configuration in use was as a result of a defaulted configuration. - * - * @return true if the configuration was created from the default-archiva.xml as opposed - * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or - * ${appserver.base}/conf/archiva.xml - */ - boolean isDefaulted(); - - /** - * Add a configuration listener to notify of changes to the configuration. - * - * @param listener the listener - */ - void addListener( ConfigurationListener listener ); - - /** - * Remove a configuration listener to stop notifications of changes to the configuration. - * - * @param listener the listener - */ - void removeListener( ConfigurationListener listener ); - - /** - * Add a registry listener to notify of events in plexus-registry. - * - * @param listener the listener - * TODO: Remove in future. - */ - void addChangeListener( RegistryListener listener ); -} - diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java deleted file mode 100644 index 3105ee96e..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * ConfigurationEvent - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class ConfigurationEvent -{ - public static final int SAVED = 1; - - public static final int CHANGED = 2; - - private int type; - - public ConfigurationEvent( int type ) - { - this.type = type; - } - - public int getType() - { - return type; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + type; - return result; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - { - return true; - } - if ( obj == null ) - { - return false; - } - if ( getClass() != obj.getClass() ) - { - return false; - } - final ConfigurationEvent other = (ConfigurationEvent) obj; - if ( type != other.type ) - { - return false; - } - return true; - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java deleted file mode 100644 index f02637c83..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * ConfigurationListener - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public interface ConfigurationListener -{ - /** - * Generic event point to notify components that something has happend in the configuration. - */ - public void configurationEvent(ConfigurationEvent event); -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java deleted file mode 100644 index e1daac902..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Utility methods for testing the configuration property name. - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class ConfigurationNames -{ - public static boolean isNetworkProxy( String propertyName ) - { - return startsWith( "networkProxies.", propertyName ); - } - - public static boolean isRepositoryScanning( String propertyName ) - { - return startsWith( "repositoryScanning.", propertyName ); - } - - public static boolean isManagedRepositories( String propertyName ) - { - return startsWith( "managedRepositories.", propertyName ); - } - - public static boolean isRemoteRepositories( String propertyName ) - { - return startsWith( "remoteRepositories.", propertyName ); - } - - public static boolean isProxyConnector( String propertyName ) - { - return startsWith( "proxyConnectors.", propertyName ); - } - - private static boolean startsWith( String prefix, String name ) - { - if ( name == null ) - { - return false; - } - - if ( name.length() <= 0 ) - { - return false; - } - - return name.startsWith( prefix ); - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationRuntimeException.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationRuntimeException.java deleted file mode 100644 index 5fc44f80d..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationRuntimeException.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Unrecoverable exception in the configuration mechanism that is the result of a programming error. - */ -public class ConfigurationRuntimeException - extends RuntimeException -{ - public ConfigurationRuntimeException( String msg, Throwable cause ) - { - super( msg, cause ); - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java deleted file mode 100644 index 28ceeaa7b..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java +++ /dev/null @@ -1,715 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator; -import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader; -import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryWriter; -import org.apache.maven.archiva.policies.AbstractUpdatePolicy; -import org.apache.maven.archiva.policies.CachedFailuresPolicy; -import org.apache.maven.archiva.policies.ChecksumPolicy; -import org.apache.maven.archiva.policies.DownloadPolicy; -import org.apache.maven.archiva.policies.PostDownloadPolicy; -import org.apache.maven.archiva.policies.PreDownloadPolicy; -import org.codehaus.plexus.evaluator.DefaultExpressionEvaluator; -import org.codehaus.plexus.evaluator.EvaluatorException; -import org.codehaus.plexus.evaluator.ExpressionEvaluator; -import org.codehaus.plexus.evaluator.sources.SystemPropertyExpressionSource; -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.RegistryException; -import org.codehaus.plexus.registry.RegistryListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -/** - * <p> - * Implementation of configuration holder that retrieves it from the registry. - * </p> - * <p> - * The registry layers and merges the 2 configuration files: user, and application server. - * </p> - * <p> - * Instead of relying on the model defaults, if the registry is empty a default configuration file is loaded and - * applied from a resource. The defaults are not loaded into the registry as the lists (eg repositories) could no longer - * be removed if that was the case. - * </p> - * <p> - * When saving the configuration, it is saved to the location it was read from. If it was read from the defaults, it - * will be saved to the user location. - * However, if the configuration contains information from both sources, an exception is raised as this is currently - * unsupported. The reason for this is that it is not possible to identify where to re-save elements, and can result - * in list configurations (eg repositories) becoming inconsistent. - * </p> - * <p> - * If the configuration is outdated, it will be upgraded when it is loaded. This is done by checking the version flag - * before reading it from the registry. - * </p> - * - * @plexus.component role="org.apache.maven.archiva.configuration.ArchivaConfiguration" - */ -public class DefaultArchivaConfiguration - implements ArchivaConfiguration, RegistryListener, Initializable -{ - private Logger log = LoggerFactory.getLogger( DefaultArchivaConfiguration.class ); - - /** - * Plexus registry to read the configuration from. - * - * @plexus.requirement role-hint="commons-configuration" - */ - private Registry registry; - - /** - * The configuration that has been converted. - */ - private Configuration configuration; - - /** - * @plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy" - * @todo these don't strictly belong in here - */ - private Map<String, PreDownloadPolicy> prePolicies; - - /** - * @plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy" - * @todo these don't strictly belong in here - */ - private Map<String, PostDownloadPolicy> postPolicies; - - /** - * @plexus.configuration default-value="${user.home}/.m2/archiva.xml" - */ - private String userConfigFilename; - - /** - * @plexus.configuration default-value="${appserver.base}/conf/archiva.xml" - */ - private String altConfigFilename; - - /** - * Configuration Listeners we've registered. - */ - private Set<ConfigurationListener> listeners = new HashSet<ConfigurationListener>(); - - /** - * Registry Listeners we've registered. - */ - private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>(); - - /** - * Boolean to help determine if the configuration exists as a result of pulling in - * the default-archiva.xml - */ - private boolean isConfigurationDefaulted = false; - - private static final String KEY = "org.apache.maven.archiva"; - - public synchronized Configuration getConfiguration() - { - if ( configuration == null ) - { - configuration = load(); - configuration = processExpressions( configuration ); - } - - return configuration; - } - - private Configuration load() - { - // TODO: should this be the same as section? make sure unnamed sections still work (eg, sys properties) - Registry subset = registry.getSubset( KEY ); - if ( subset.getString( "version" ) == null ) - { - // a little autodetection of v1, even if version is omitted (this was previously allowed) - if ( subset.getSubset( "repositoryScanning" ).isEmpty() ) - { - // only for empty, or v < 1 - subset = readDefaultConfiguration(); - } - } - - Configuration config = new ConfigurationRegistryReader().read( subset ); - - if ( !config.getRepositories().isEmpty() ) - { - for ( Iterator<V1RepositoryConfiguration> i = config.getRepositories().iterator(); i.hasNext(); ) - { - V1RepositoryConfiguration r = i.next(); - r.setScanned( r.isIndexed() ); - - if ( r.getUrl().startsWith( "file://" ) ) - { - r.setLocation( r.getUrl().substring( 7 ) ); - config.addManagedRepository( r ); - } - else if ( r.getUrl().startsWith( "file:" ) ) - { - r.setLocation( r.getUrl().substring( 5 ) ); - config.addManagedRepository( r ); - } - else - { - RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration(); - repo.setId( r.getId() ); - repo.setLayout( r.getLayout() ); - repo.setName( r.getName() ); - repo.setUrl( r.getUrl() ); - config.addRemoteRepository( repo ); - } - } - - // Prevent duplicate repositories from showing up. - config.getRepositories().clear(); - - registry.removeSubset( KEY + ".repositories" ); - } - - if ( !CollectionUtils.isEmpty( config.getRemoteRepositories() ) ) - { - List<RemoteRepositoryConfiguration> remoteRepos = config.getRemoteRepositories(); - for ( RemoteRepositoryConfiguration repo : remoteRepos ) - { - // [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration. - if ( StringUtils.isBlank( repo.getUsername() ) ) - { - repo.setUsername( null ); - } - - if ( StringUtils.isBlank( repo.getPassword() ) ) - { - repo.setPassword( null ); - } - } - } - - if ( !config.getProxyConnectors().isEmpty() ) - { - // Fix Proxy Connector Settings. - - List<ProxyConnectorConfiguration> proxyConnectorList = new ArrayList<ProxyConnectorConfiguration>(); - // Create a copy of the list to read from (to prevent concurrent modification exceptions) - proxyConnectorList.addAll( config.getProxyConnectors() ); - // Remove the old connector list. - config.getProxyConnectors().clear(); - - for ( ProxyConnectorConfiguration connector : proxyConnectorList ) - { - // Fix policies - boolean connectorValid = true; - - Map<String, String> policies = new HashMap<String, String>(); - // Make copy of policies - policies.putAll( connector.getPolicies() ); - // Clear out policies - connector.getPolicies().clear(); - - // Work thru policies. cleaning them up. - for ( Entry<String, String> entry : policies.entrySet() ) - { - String policyId = entry.getKey(); - String setting = entry.getValue(); - - // Upgrade old policy settings. - if ( "releases".equals( policyId ) || "snapshots".equals( policyId ) ) - { - if ( "ignored".equals( setting ) ) - { - setting = AbstractUpdatePolicy.ALWAYS; - } - else if ( "disabled".equals( setting ) ) - { - setting = AbstractUpdatePolicy.NEVER; - } - } - else if ( "cache-failures".equals( policyId ) ) - { - if ( "ignored".equals( setting ) ) - { - setting = CachedFailuresPolicy.NO; - } - else if ( "cached".equals( setting ) ) - { - setting = CachedFailuresPolicy.YES; - } - } - else if ( "checksum".equals( policyId ) ) - { - if ( "ignored".equals( setting ) ) - { - setting = ChecksumPolicy.IGNORE; - } - } - - // Validate existance of policy key. - if ( policyExists( policyId ) ) - { - DownloadPolicy policy = findPolicy( policyId ); - // Does option exist? - if ( !policy.getOptions().contains( setting ) ) - { - setting = policy.getDefaultOption(); - } - connector.addPolicy( policyId, setting ); - } - else - { - // Policy key doesn't exist. Don't add it to golden version. - log.warn( "Policy [" + policyId + "] does not exist." ); - } - } - - if ( connectorValid ) - { - config.addProxyConnector( connector ); - } - } - - // Normalize the order fields in the proxy connectors. - Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = config - .getProxyConnectorAsMap(); - - for ( String key : proxyConnectorMap.keySet() ) - { - List<ProxyConnectorConfiguration> connectors = proxyConnectorMap.get( key ); - // Sort connectors by order field. - Collections.sort( connectors, ProxyConnectorConfigurationOrderComparator.getInstance() ); - - // Normalize the order field values. - int order = 1; - for ( ProxyConnectorConfiguration connector : connectors ) - { - connector.setOrder( order++ ); - } - } - } - - return config; - } - - private DownloadPolicy findPolicy( String policyId ) - { - if ( MapUtils.isEmpty( prePolicies ) ) - { - log.error( "No PreDownloadPolicies found!" ); - return null; - } - - if ( MapUtils.isEmpty( postPolicies ) ) - { - log.error( "No PostDownloadPolicies found!" ); - return null; - } - - DownloadPolicy policy; - - policy = prePolicies.get( policyId ); - if ( policy != null ) - { - return policy; - } - - policy = postPolicies.get( policyId ); - if ( policy != null ) - { - return policy; - } - - return null; - } - - private boolean policyExists( String policyId ) - { - if ( MapUtils.isEmpty( prePolicies ) ) - { - log.error( "No PreDownloadPolicies found!" ); - return false; - } - - if ( MapUtils.isEmpty( postPolicies ) ) - { - log.error( "No PostDownloadPolicies found!" ); - return false; - } - - return ( prePolicies.containsKey( policyId ) || postPolicies.containsKey( policyId ) ); - } - - private Registry readDefaultConfiguration() - { - // if it contains some old configuration, remove it (Archiva 0.9) - registry.removeSubset( KEY ); - - try - { - registry.addConfigurationFromResource( "org/apache/maven/archiva/configuration/default-archiva.xml", KEY ); - this.isConfigurationDefaulted = true; - } - catch ( RegistryException e ) - { - throw new ConfigurationRuntimeException( - "Fatal error: Unable to find the built-in default configuration and load it into the registry", - e ); - } - return registry.getSubset( KEY ); - } - - public synchronized void save( Configuration configuration ) - throws RegistryException, IndeterminateConfigurationException - { - Registry section = registry.getSection( KEY + ".user" ); - Registry baseSection = registry.getSection( KEY + ".base" ); - if ( section == null ) - { - section = baseSection; - if ( section == null ) - { - section = createDefaultConfigurationFile(); - } - } - else if ( baseSection != null ) - { - Collection<String> keys = baseSection.getKeys(); - boolean foundList = false; - for ( Iterator<String> i = keys.iterator(); i.hasNext() && !foundList; ) - { - String key = i.next(); - - // a little aggressive with the repositoryScanning and databaseScanning - should be no need to split - // that configuration - if ( key.startsWith( "repositories" ) || key.startsWith( "proxyConnectors" ) - || key.startsWith( "networkProxies" ) || key.startsWith( "repositoryScanning" ) - || key.startsWith( "databaseScanning" ) || key.startsWith( "remoteRepositories" ) - || key.startsWith( "managedRepositories" ) ) - { - foundList = true; - } - } - - if ( foundList ) - { - this.configuration = null; - - throw new IndeterminateConfigurationException( - "Configuration can not be saved when it is loaded from two sources" ); - } - } - - // escape all cron expressions to handle ',' - for ( Iterator<ManagedRepositoryConfiguration> i = configuration.getManagedRepositories().iterator(); i - .hasNext(); ) - { - ManagedRepositoryConfiguration c = i.next(); - c.setRefreshCronExpression( escapeCronExpression( c.getRefreshCronExpression() ) ); - } - - if ( configuration.getDatabaseScanning() != null ) - { - configuration.getDatabaseScanning().setCronExpression( - escapeCronExpression( configuration - .getDatabaseScanning().getCronExpression() ) ); - } - - // [MRM-661] Due to a bug in the modello registry writer, we need to take these out by hand. They'll be put back by the writer. - if ( configuration.getManagedRepositories().isEmpty() ) - { - section.removeSubset( "managedRepositories" ); - } - if ( configuration.getRemoteRepositories().isEmpty() ) - { - section.removeSubset( "remoteRepositories" ); - } - if ( configuration.getProxyConnectors().isEmpty() ) - { - section.removeSubset( "proxyConnectors" ); - } - if ( configuration.getNetworkProxies().isEmpty() ) - { - section.removeSubset( "networkProxies" ); - } - if ( configuration.getLegacyArtifactPaths().isEmpty() ) - { - section.removeSubset( "legacyArtifactPaths" ); - } - if ( configuration.getRepositoryScanning() != null ) - { - if ( configuration.getRepositoryScanning().getKnownContentConsumers().isEmpty() ) - { - section.removeSubset( "repositoryScanning.knownContentConsumers" ); - } - if ( configuration.getRepositoryScanning().getInvalidContentConsumers().isEmpty() ) - { - section.removeSubset( "repositoryScanning.invalidContentConsumers" ); - } - } - if ( configuration.getDatabaseScanning() != null ) - { - if ( configuration.getDatabaseScanning().getCleanupConsumers().isEmpty() ) - { - section.removeSubset( "databaseScanning.cleanupConsumers" ); - } - if ( configuration.getDatabaseScanning().getUnprocessedConsumers().isEmpty() ) - { - section.removeSubset( "databaseScanning.unprocessedConsumers" ); - } - } - - new ConfigurationRegistryWriter().write( configuration, section ); - section.save(); - - triggerEvent( ConfigurationEvent.SAVED ); - - this.configuration = processExpressions( configuration ); - } - - private Registry createDefaultConfigurationFile() - throws RegistryException - { - // TODO: may not be needed under commons-configuration 1.4 - check - // UPDATE: Upgrading to commons-configuration 1.4 breaks half the unit tests. 2007-10-11 (joakime) - - String contents = "<configuration />"; - if ( !writeFile( "user configuration", userConfigFilename, contents ) ) - { - if ( !writeFile( "alternative configuration", altConfigFilename, contents ) ) - { - throw new RegistryException( "Unable to create configuration file in either user [" - + userConfigFilename + "] or alternative [" + altConfigFilename - + "] locations on disk, usually happens when not allowed to write to those locations." ); - } - } - - try - { - ( (Initializable) registry ).initialize(); - - for ( RegistryListener regListener : registryListeners ) - { - addRegistryChangeListener( regListener ); - } - } - catch ( InitializationException e ) - { - throw new RegistryException( "Unable to reinitialize configuration: " + e.getMessage(), e ); - } - - triggerEvent( ConfigurationEvent.SAVED ); - - return registry.getSection( KEY + ".user" ); - } - - /** - * Attempts to write the contents to a file, if an IOException occurs, return false. - * - * The file will be created if the directory to the file exists, otherwise this will return false. - * - * @param filetype the filetype (freeform text) to use in logging messages when failure to write. - * @param path the path to write to. - * @param contents the contents to write. - * @return true if write successful. - */ - private boolean writeFile( String filetype, String path, String contents ) - { - File file = new File( path ); - - try - { - // Check parent directory (if it is declared) - if ( file.getParentFile() != null ) - { - // Check that directory exists - if ( ( file.getParentFile().exists() == false ) || ( file.getParentFile().isDirectory() == false ) ) - { - // Directory to file must exist for file to be created - return false; - } - } - - FileUtils.writeStringToFile( file, contents, "UTF-8" ); - return true; - } - catch ( IOException e ) - { - log.error( "Unable to create " + filetype + " file: " + e.getMessage(), e ); - return false; - } - } - - private void triggerEvent( int type ) - { - ConfigurationEvent evt = new ConfigurationEvent( type ); - for ( ConfigurationListener listener : listeners ) - { - try - { - listener.configurationEvent( evt ); - } - catch ( Throwable t ) - { - log.warn( "Unable to notify of saved configuration event.", t ); - } - } - } - - public void addListener( ConfigurationListener listener ) - { - if ( listener == null ) - { - return; - } - - listeners.add( listener ); - } - - public void removeListener( ConfigurationListener listener ) - { - if ( listener == null ) - { - return; - } - - listeners.remove( listener ); - } - - public void addChangeListener( RegistryListener listener ) - { - addRegistryChangeListener( listener ); - - // keep track for later - registryListeners.add( listener ); - } - - private void addRegistryChangeListener( RegistryListener listener ) - { - Registry section = registry.getSection( KEY + ".user" ); - if ( section != null ) - { - section.addChangeListener( listener ); - } - section = registry.getSection( KEY + ".base" ); - if ( section != null ) - { - section.addChangeListener( listener ); - } - } - - public void initialize() - throws InitializationException - { - // Resolve expressions in the userConfigFilename and altConfigFilename - try - { - ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator(); - expressionEvaluator.addExpressionSource( new SystemPropertyExpressionSource() ); - userConfigFilename = expressionEvaluator.expand( userConfigFilename ); - altConfigFilename = expressionEvaluator.expand( altConfigFilename ); - } - catch ( EvaluatorException e ) - { - throw new InitializationException( "Unable to evaluate expressions found in " - + "userConfigFilename or altConfigFilename." ); - } - - registry.addChangeListener( this ); - } - - public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue ) - { - // nothing to do here - } - - public synchronized void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue ) - { - configuration = null; - } - - private String removeExpressions( String directory ) - { - String value = StringUtils.replace( directory, "${appserver.base}", registry.getString( "appserver.base", - "${appserver.base}" ) ); - value = StringUtils.replace( value, "${appserver.home}", registry.getString( "appserver.home", - "${appserver.home}" ) ); - return value; - } - - private String unescapeCronExpression( String cronExpression ) - { - return StringUtils.replace( cronExpression, "\\,", "," ); - } - - private String escapeCronExpression( String cronExpression ) - { - return StringUtils.replace( cronExpression, ",", "\\," ); - } - - private Configuration processExpressions( Configuration config ) - { - // TODO: for commons-configuration 1.3 only - for ( Iterator<ManagedRepositoryConfiguration> i = config.getManagedRepositories().iterator(); i.hasNext(); ) - { - ManagedRepositoryConfiguration c = i.next(); - c.setLocation( removeExpressions( c.getLocation() ) ); - c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) ); - } - - DatabaseScanningConfiguration databaseScanning = config.getDatabaseScanning(); - if ( databaseScanning != null ) - { - String cron = databaseScanning.getCronExpression(); - databaseScanning.setCronExpression( unescapeCronExpression( cron ) ); - } - - return config; - } - - public String getUserConfigFilename() - { - return userConfigFilename; - } - - public String getAltConfigFilename() - { - return altConfigFilename; - } - - public boolean isDefaulted() - { - return this.isConfigurationDefaulted; - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java deleted file mode 100644 index 2f97b1db1..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java +++ /dev/null @@ -1,226 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.Predicate; -import org.apache.commons.configuration.CombinedConfiguration; -import org.apache.maven.archiva.common.utils.Slf4JPlexusLogger; -import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate; -import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader; -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.RegistryException; -import org.codehaus.plexus.registry.RegistryListener; -import org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry; -import org.codehaus.plexus.util.SelectorUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * FileTypes - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.configuration.FileTypes" - */ -public class FileTypes - implements Initializable, RegistryListener -{ - private Logger log = LoggerFactory.getLogger(FileTypes.class); - - public static final String ARTIFACTS = "artifacts"; - - public static final String AUTO_REMOVE = "auto-remove"; - - public static final String INDEXABLE_CONTENT = "indexable-content"; - - public static final String IGNORED = "ignored"; - - /** - * @plexus.requirement - */ - private ArchivaConfiguration archivaConfiguration; - - /** - * Map of default values for the file types. - */ - private Map<String, List<String>> defaultTypeMap = new HashMap<String, List<String>>(); - - private List<String> artifactPatterns; - - public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration ) - { - this.archivaConfiguration = archivaConfiguration; - } - - /** - * <p> - * Get the list of patterns for a specified filetype. - * </p> - * - * <p> - * You will always get a list. In this order. - * <ul> - * <li>The Configured List</li> - * <li>The Default List</li> - * <li>A single item list of <code>"**<span>/</span>*"</code></li> - * </ul> - * </p> - * - * @param id the id to lookup. - * @return the list of patterns. - */ - public List<String> getFileTypePatterns( String id ) - { - Configuration config = archivaConfiguration.getConfiguration(); - Predicate selectedFiletype = new FiletypeSelectionPredicate( id ); - FileType filetype = (FileType) CollectionUtils.find( config.getRepositoryScanning().getFileTypes(), - selectedFiletype ); - - if ( ( filetype != null ) && CollectionUtils.isNotEmpty( filetype.getPatterns() ) ) - { - return filetype.getPatterns(); - } - - List<String> defaultPatterns = defaultTypeMap.get( id ); - - if ( CollectionUtils.isEmpty( defaultPatterns ) ) - { - return Collections.singletonList( "**/*" ); - } - - return defaultPatterns; - } - - public synchronized boolean matchesArtifactPattern( String relativePath ) - { - // Correct the slash pattern. - relativePath = relativePath.replace( '\\', '/' ); - - if ( artifactPatterns == null ) - { - artifactPatterns = getFileTypePatterns( ARTIFACTS ); - } - - for ( String pattern : artifactPatterns ) - { - if ( SelectorUtils.matchPath( pattern, relativePath, false ) ) - { - // Found match - return true; - } - } - - // No match. - return false; - } - - public void initialize() - throws InitializationException - { - // TODO: why is this done by hand? - - String errMsg = "Unable to load default archiva configuration for FileTypes: "; - - try - { - CommonsConfigurationRegistry commonsRegistry = new CommonsConfigurationRegistry(); - - // Configure commonsRegistry - Field fld = commonsRegistry.getClass().getDeclaredField( "configuration" ); - fld.setAccessible( true ); - fld.set( commonsRegistry, new CombinedConfiguration() ); - commonsRegistry.enableLogging( new Slf4JPlexusLogger( FileTypes.class ) ); - commonsRegistry.addConfigurationFromResource( "org/apache/maven/archiva/configuration/default-archiva.xml" ); - - // Read configuration as it was intended. - ConfigurationRegistryReader configReader = new ConfigurationRegistryReader(); - Configuration defaultConfig = configReader.read( commonsRegistry ); - - initialiseTypeMap( defaultConfig ); - } - catch ( RegistryException e ) - { - throw new InitializationException( errMsg + e.getMessage(), e ); - } - catch ( SecurityException e ) - { - throw new InitializationException( errMsg + e.getMessage(), e ); - } - catch ( NoSuchFieldException e ) - { - throw new InitializationException( errMsg + e.getMessage(), e ); - } - catch ( IllegalArgumentException e ) - { - throw new InitializationException( errMsg + e.getMessage(), e ); - } - catch ( IllegalAccessException e ) - { - throw new InitializationException( errMsg + e.getMessage(), e ); - } - - this.archivaConfiguration.addChangeListener( this ); - } - - private void initialiseTypeMap( Configuration configuration ) - { - defaultTypeMap.clear(); - - // Store the default file type declaration. - List<FileType> filetypes = configuration.getRepositoryScanning().getFileTypes(); - for ( FileType filetype : filetypes ) - { - List<String> patterns = defaultTypeMap.get( filetype.getId() ); - if ( patterns == null ) - { - patterns = new ArrayList<String>(); - } - patterns.addAll( filetype.getPatterns() ); - - defaultTypeMap.put( filetype.getId(), patterns ); - } - } - - public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue ) - { - if ( propertyName.contains( "fileType" ) ) - { - artifactPatterns = null; - - initialiseTypeMap( archivaConfiguration.getConfiguration() ); - } - } - - public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue ) - { - /* nothing to do */ - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/IndeterminateConfigurationException.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/IndeterminateConfigurationException.java deleted file mode 100644 index 97d5fbdf2..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/IndeterminateConfigurationException.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Occurs when the configuration is stored in two locations and the save location can not be determined. - */ -public class IndeterminateConfigurationException - extends Exception -{ - public IndeterminateConfigurationException( String message ) - { - super( message ); - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/InvalidConfigurationException.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/InvalidConfigurationException.java deleted file mode 100644 index 0efcde250..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/InvalidConfigurationException.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * An error in the configuration. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class InvalidConfigurationException - extends Exception -{ - private final String name; - - public InvalidConfigurationException( String name, String message ) - { - super( message ); - this.name = name; - } - - public InvalidConfigurationException( String name, String message, Throwable cause ) - { - super( message, cause ); - - this.name = name; - } - - public String getName() - { - return name; - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java deleted file mode 100644 index e48b2d39a..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.policies.ReleasesPolicy; -import org.apache.maven.archiva.policies.SnapshotsPolicy; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Enumeration; -import java.util.Properties; -import java.util.StringTokenizer; - -/** - * @author Ben Walding - * @author Brett Porter - */ -public class MavenProxyPropertyLoader -{ - private static final String REPO_LOCAL_STORE = "repo.local.store"; - - private static final String PROXY_LIST = "proxy.list"; - - private static final String REPO_LIST = "repo.list"; - - public void load( Properties props, Configuration configuration ) - throws InvalidConfigurationException - { - // set up the managed repository - String localCachePath = getMandatoryProperty( props, REPO_LOCAL_STORE ); - - ManagedRepositoryConfiguration config = new ManagedRepositoryConfiguration(); - config.setLocation( localCachePath ); - config.setName( "Imported Maven-Proxy Cache" ); - config.setId( "maven-proxy" ); - config.setScanned( false ); - config.setReleases( true ); - config.setSnapshots( false ); - configuration.addManagedRepository( config ); - - // Add the network proxies. - String propertyList = props.getProperty( PROXY_LIST ); - if ( propertyList != null ) - { - StringTokenizer tok = new StringTokenizer( propertyList, "," ); - while ( tok.hasMoreTokens() ) - { - String key = tok.nextToken(); - if ( StringUtils.isNotEmpty( key ) ) - { - NetworkProxyConfiguration proxy = new NetworkProxyConfiguration(); - proxy.setHost( getMandatoryProperty( props, "proxy." + key + ".host" ) ); - proxy.setPort( Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) ) ); - - // the username and password isn't required - proxy.setUsername( props.getProperty( "proxy." + key + ".username" ) ); - proxy.setPassword( props.getProperty( "proxy." + key + ".password" ) ); - - configuration.addNetworkProxy( proxy ); - } - } - } - - // Add the remote repository list - String repoList = getMandatoryProperty( props, REPO_LIST ); - - StringTokenizer tok = new StringTokenizer( repoList, "," ); - while ( tok.hasMoreTokens() ) - { - String key = tok.nextToken(); - - Properties repoProps = getSubset( props, "repo." + key + "." ); - String url = getMandatoryProperty( props, "repo." + key + ".url" ); - String proxyKey = repoProps.getProperty( "proxy" ); - - int cachePeriod = Integer.parseInt( repoProps.getProperty( "cache.period", "60" ) ); - - RemoteRepositoryConfiguration repository = new RemoteRepositoryConfiguration(); - repository.setId( key ); - repository.setName( "Imported Maven-Proxy Remote Proxy" ); - repository.setUrl( url ); - repository.setLayout( "legacy" ); - - configuration.addRemoteRepository( repository ); - - ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration(); - proxyConnector.setSourceRepoId( "maven-proxy" ); - proxyConnector.setTargetRepoId( key ); - proxyConnector.setProxyId( proxyKey ); - // TODO: convert cachePeriod to closest "daily" or "hourly" - proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, SnapshotsPolicy.DAILY ); - proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, ReleasesPolicy.ALWAYS ); - - configuration.addProxyConnector( proxyConnector ); - } - } - - @SuppressWarnings("unchecked") - private Properties getSubset( Properties props, String prefix ) - { - Enumeration keys = props.keys(); - Properties result = new Properties(); - while ( keys.hasMoreElements() ) - { - String key = (String) keys.nextElement(); - String value = props.getProperty( key ); - if ( key.startsWith( prefix ) ) - { - String newKey = key.substring( prefix.length() ); - result.setProperty( newKey, value ); - } - } - return result; - } - - public void load( InputStream is, Configuration configuration ) - throws IOException, InvalidConfigurationException - { - Properties props = new Properties(); - props.load( is ); - load( props, configuration ); - } - - private String getMandatoryProperty( Properties props, String key ) - throws InvalidConfigurationException - { - String value = props.getProperty( key ); - - if ( value == null ) - { - throw new InvalidConfigurationException( key, "Missing required field: " + key ); - } - - return value; - } -}
\ No newline at end of file diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeSelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeSelectionPredicate.java deleted file mode 100644 index cfbe58fbe..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeSelectionPredicate.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.collections.Predicate; -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.FileType; - -/** - * FiletypeSelectionPredicate - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class FiletypeSelectionPredicate - implements Predicate -{ - private String filetypeId; - - public FiletypeSelectionPredicate( String id ) - { - this.filetypeId = id; - } - - public boolean evaluate( Object object ) - { - boolean satisfies = false; - - if ( object instanceof FileType ) - { - FileType filetype = (FileType) object; - return ( StringUtils.equals( filetypeId, filetype.getId() ) ); - } - - return satisfies; - } - -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java deleted file mode 100644 index 96f15ab2a..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.collections.Closure; -import org.apache.maven.archiva.configuration.FileType; - -import java.util.HashMap; -import java.util.Map; - -/** - * FiletypeToMapClosure - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class FiletypeToMapClosure - implements Closure -{ - private Map<String, FileType> map = new HashMap<String, FileType>(); - - public void execute( Object input ) - { - if ( input instanceof FileType ) - { - FileType filetype = (FileType) input; - map.put( filetype.getId(), filetype ); - } - } - - public Map<String, FileType> getMap() - { - return map; - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java deleted file mode 100644 index aebc924ba..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; - -import java.util.Comparator; - -/** - * NetworkProxyComparator - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class NetworkProxyComparator - implements Comparator<NetworkProxyConfiguration> -{ - public int compare( NetworkProxyConfiguration o1, NetworkProxyConfiguration o2 ) - { - if ( o1 == null && o2 == null ) - { - return 0; - } - - if ( o1 == null && o2 != null ) - { - return 1; - } - - if ( o1 != null && o2 == null ) - { - return -1; - } - - String id1 = o1.getId(); - String id2 = o2.getId(); - return id1.compareToIgnoreCase( id2 ); - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxySelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxySelectionPredicate.java deleted file mode 100644 index b89828307..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxySelectionPredicate.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.collections.Predicate; -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; - -/** - * NetworkProxySelectionPredicate - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class NetworkProxySelectionPredicate - implements Predicate -{ - private String proxyId; - - public NetworkProxySelectionPredicate( String id ) - { - this.proxyId = id; - } - - public boolean evaluate( Object object ) - { - boolean satisfies = false; - - if ( object instanceof NetworkProxyConfiguration ) - { - NetworkProxyConfiguration proxy = (NetworkProxyConfiguration) object; - return ( StringUtils.equals( proxyId, proxy.getId() ) ); - } - - return satisfies; - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java deleted file mode 100644 index 6c6cffe6f..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; - -import java.util.Comparator; - -/** - * ProxyConnectorConfigurationOrderComparator - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class ProxyConnectorConfigurationOrderComparator - implements Comparator<ProxyConnectorConfiguration> -{ - private static ProxyConnectorConfigurationOrderComparator INSTANCE = new ProxyConnectorConfigurationOrderComparator(); - - public int compare( ProxyConnectorConfiguration o1, ProxyConnectorConfiguration o2 ) - { - if ( o1 == null && o2 == null ) - { - return 0; - } - - // Ensure null goes to end of list. - if ( o1 == null && o2 != null ) - { - return 1; - } - - if ( o1 != null && o2 == null ) - { - return -1; - } - - // Ensure 0 (unordered) goes to end of list. - if ( o1.getOrder() == 0 && o2.getOrder() != 0 ) - { - return 1; - } - - if ( o1.getOrder() != 0 && o2.getOrder() == 0 ) - { - return -1; - } - - return o1.getOrder() - o2.getOrder(); - } - - public static ProxyConnectorConfigurationOrderComparator getInstance() - { - return INSTANCE; - } -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java deleted file mode 100644 index af18c6c5f..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.collections.Predicate; -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; - -/** - * ProxyConnectorPredicate - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class ProxyConnectorSelectionPredicate - implements Predicate -{ - private String sourceId; - - private String targetId; - - public ProxyConnectorSelectionPredicate( String sourceId, String targetId ) - { - this.sourceId = sourceId; - this.targetId = targetId; - } - - public boolean evaluate( Object object ) - { - boolean satisfies = false; - - if ( object instanceof ProxyConnectorConfiguration ) - { - ProxyConnectorConfiguration connector = (ProxyConnectorConfiguration) object; - return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils - .equals( targetId, connector.getTargetRepoId() ) ); - } - - return satisfies; - } - -} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparator.java deleted file mode 100644 index caf99d343..000000000 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration; - -import java.util.Comparator; - -/** - * RepositoryConfigurationComparator - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class RepositoryConfigurationComparator - implements Comparator<AbstractRepositoryConfiguration> -{ - public int compare( AbstractRepositoryConfiguration o1, AbstractRepositoryConfiguration o2 ) - { - if ( o1 == null && o2 == null ) - { - return 0; - } - - if ( o1 == null ) - { - return -1; - } - - if ( o2 == null ) - { - return 1; - } - - return o1.getId().compareToIgnoreCase( o2.getId() ); - } -} diff --git a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo deleted file mode 100644 index babc602a3..000000000 --- a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ /dev/null @@ -1,948 +0,0 @@ -<?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. - --> - -<model> - <id>configuration</id> - <name>Configuration</name> - <description> - Configuration for the Maven Repository Manager. - </description> - <defaults> - <default> - <key>package</key> - <value>org.apache.maven.archiva.configuration</value> - </default> - </defaults> - <classes> - <class rootElement="true" xml.tagName="configuration"> - <name>Configuration</name> - <version>1.0.0+</version> - <fields> - <field> - <name>version</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description>This is the version of the configuration format.</description> - </field> - <field java.adder="false"> - <description> - @deprecated use managedRepositories or remoteRepositories instead. - </description> - <name>repositories</name> - <version>1.0.0+</version> - <association java.generate-add="false" - java.generate-remove="false" - java.generate-break="false" - java.generate-create="false"> - <type>V1RepositoryConfiguration</type> - <multiplicity>*</multiplicity> - </association> - </field> - <field> - <name>managedRepositories</name> - <version>1.0.0+</version> - <association> - <type>ManagedRepositoryConfiguration</type> - <multiplicity>*</multiplicity> - </association> - <description>The list of repositories that this archiva instance uses.</description> - </field> - <field> - <name>remoteRepositories</name> - <version>1.0.0+</version> - <association> - <type>RemoteRepositoryConfiguration</type> - <multiplicity>*</multiplicity> - </association> - <description>The list of repositories that this archiva can retrieve from or publish to.</description> - </field> - <field> - <name>proxyConnectors</name> - <version>1.0.0+</version> - <association> - <type>ProxyConnectorConfiguration</type> - <multiplicity>*</multiplicity> - </association> - <description>The list of proxy connectors for this archiva instance.</description> - </field> - <!-- To be introduced later. - <field> - <name>syncConnectors</name> - <version>1.0.0+</version> - <association> - <type>SyncConnectorConfiguration</type> - <multiplicity>*</multiplicity> - </association> - <description>The list of sync connectors for this archiva instance.</description> - </field> - --> - <field> - <name>networkProxies</name> - <version>1.0.0+</version> - <association> - <type>NetworkProxyConfiguration</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of network proxies to use for outgoing requests. - </description> - </field> - <field> - <name>legacyArtifactPaths</name> - <version>1.1.0+</version> - <association> - <type>LegacyArtifactPath</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of custom legacy path to artifact. - </description> - </field> - <field> - <name>repositoryScanning</name> - <version>1.0.0+</version> - <association> - <type>RepositoryScanningConfiguration</type> - <multiplicity>1</multiplicity> - </association> - <description> - The repository scanning configuration. - </description> - </field> - <field> - <name>databaseScanning</name> - <version>1.0.0+</version> - <association> - <type>DatabaseScanningConfiguration</type> - <multiplicity>1</multiplicity> - </association> - <description> - The database scanning configuration. - </description> - </field> - <field> - <name>webapp</name> - <version>1.0.0+</version> - <association> - <type>WebappConfiguration</type> - <multiplicity>1</multiplicity> - </association> - <description> - The webapp configuration. - </description> - </field> - </fields> - <codeSegments> - <codeSegment> - <version>1.0.0+</version> - <code><![CDATA[ - public java.util.Map<String, NetworkProxyConfiguration> getNetworkProxiesAsMap() - { - java.util.Map<String, NetworkProxyConfiguration> map = new java.util.HashMap<String, NetworkProxyConfiguration>(); - if ( networkProxies != null ) - { - for ( java.util.Iterator<NetworkProxyConfiguration> i = networkProxies.iterator(); i.hasNext(); ) - { - NetworkProxyConfiguration proxy = i.next(); - map.put( proxy.getId(), proxy ); - } - } - return map; - } - - public java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> getProxyConnectorAsMap() - { - java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = - new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>(); - - java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator(); - while ( it.hasNext() ) - { - ProxyConnectorConfiguration proxyConfig = it.next(); - String key = proxyConfig.getSourceRepoId(); - - java.util.List<ProxyConnectorConfiguration> connectors = proxyConnectorMap.get( key ); - if ( connectors == null ) - { - connectors = new java.util.ArrayList<ProxyConnectorConfiguration>(); - proxyConnectorMap.put( key, connectors ); - } - - connectors.add( proxyConfig ); - java.util.Collections.sort( connectors, - org.apache.maven.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator.getInstance() ); - } - - return proxyConnectorMap; - } - - public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap() - { - java.util.Map<String, RemoteRepositoryConfiguration> map = new java.util.HashMap<String, RemoteRepositoryConfiguration>(); - if ( remoteRepositories != null ) - { - for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); ) - { - RemoteRepositoryConfiguration repo = i.next(); - map.put( repo.getId(), repo ); - } - } - return map; - } - - public RemoteRepositoryConfiguration findRemoteRepositoryById( String id ) - { - if ( remoteRepositories != null ) - { - for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); ) - { - RemoteRepositoryConfiguration repo = i.next(); - if ( repo.getId().equals( id ) ) - { - return repo; - } - } - } - return null; - } - - public java.util.Map<String, ManagedRepositoryConfiguration> getManagedRepositoriesAsMap() - { - java.util.Map<String, ManagedRepositoryConfiguration> map = new java.util.HashMap<String, ManagedRepositoryConfiguration>(); - if ( managedRepositories != null ) - { - for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); ) - { - ManagedRepositoryConfiguration repo = i.next(); - map.put( repo.getId(), repo ); - } - } - return map; - } - - public ManagedRepositoryConfiguration findManagedRepositoryById( String id ) - { - if ( managedRepositories != null ) - { - for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); ) - { - ManagedRepositoryConfiguration repo = i.next(); - if ( repo.getId().equals( id ) ) - { - return repo; - } - } - } - return null; - } - ]]></code> - </codeSegment> - </codeSegments> - </class> - - <!-- - ____ _ _ - | _ \ ___ _ __ ___ ___(_) |_ ___ _ __ _ _ - | |_) / _ \ '_ \ / _ \/ __| | __/ _ \| '__| | | | - | _ < __/ |_) | (_) \__ \ | || (_) | | | |_| | - |_| \_\___| .__/ \___/|___/_|\__\___/|_| \__, | - |_| |___/ - - --> - - <class> - <name>AbstractRepositoryConfiguration</name> - <version>1.0.0+</version> - <abstract>true</abstract> - <fields> - <field> - <name>id</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The repository identifier. - </description> - </field> - <field> - <name>name</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The descriptive name of the repository. - </description> - </field> - <field> - <name>layout</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The layout of the repository. Valid values are "default" and "legacy". - </description> - <!-- TODO: should be able to detect this from the repository (perhaps by metadata at the root) --> - <defaultValue>default</defaultValue> - </field> - </fields> - </class> - <class> - <name>RemoteRepositoryConfiguration</name> - <version>1.0.0+</version> - <superClass>AbstractRepositoryConfiguration</superClass> - <fields> - <field> - <name>url</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The URL for this repository. - </description> - </field> - <field> - <name>username</name> - <version>1.0.0+</version> - <type>String</type> - <description> - The Username for this repository. - </description> - </field> - <field> - <name>password</name> - <version>1.0.0+</version> - <type>String</type> - <description> - The Password for this repository. - </description> - </field> - <field> - <name>timeout</name> - <version>1.0.1+</version> - <type>int</type> - <description> - Timeout in seconds for connections to this repository - </description> - <defaultValue>60</defaultValue> - </field> - </fields> - </class> - <class> - <name>ManagedRepositoryConfiguration</name> - <version>1.0.0+</version> - <superClass>AbstractRepositoryConfiguration</superClass> - <fields> - <field> - <name>location</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The file system location for this repository. - </description> - </field> - <field> - <name>releases</name> - <version>1.0.0+</version> - <type>boolean</type> - <description>True if this repository contains release versioned artifacts.</description> - <defaultValue>true</defaultValue> - </field> - <field> - <name>snapshots</name> - <version>1.0.0+</version> - <type>boolean</type> - <description>True if this repository contains snapshot versioned artifacts.</description> - <defaultValue>false</defaultValue> - </field> - <field> - <name>scanned</name> - <version>1.0.0+</version> - <type>boolean</type> - <description>True if this repository should be scanned and processed.</description> - <defaultValue>true</defaultValue> - </field> - <field> - <name>indexDir</name> - <version>1.0.0+</version> - <type>String</type> - <description> - The directory for the indexes of this repository. - </description> - </field> - <field> - <name>refreshCronExpression</name> - <version>1.0.0+</version> - <type>String</type> - <description> - When to run the refresh task. - Default is every hour - </description> - <defaultValue>0 0 * * * ?</defaultValue> - </field> - <field> - <name>retentionCount</name> - <version>1.0.0+</version> - <type>int</type> - <description> - The total count of the artifact to be retained for each snapshot. - </description> - <defaultValue>2</defaultValue> - </field> - <field> - <name>daysOlder</name> - <version>1.0.0+</version> - <type>int</type> - <description> - The number of days old which will be the basis for removing a snapshot. - </description> - <defaultValue>100</defaultValue> - </field> - <field> - <name>deleteReleasedSnapshots</name> - <version>1.0.0+</version> - <type>boolean</type> - <description> - True if the released snapshots are to be removed from the repo during repository purge. - </description> - <defaultValue>false</defaultValue> - </field> - </fields> - </class> - <class> - <name>V1RepositoryConfiguration</name> - <version>1.0.0+</version> - <superClass>ManagedRepositoryConfiguration</superClass> - <fields> - <field> - <name>url</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The URL for this repository. - </description> - </field> - <field> - <name>indexed</name> - <version>1.0.0+</version> - <type>boolean</type> - <required>true</required> - </field> - </fields> - </class> - - <class> - <name>LegacyArtifactPath</name> - <version>1.1.0+</version> - <fields> - <field> - <name>path</name> - <version>1.1.0+</version> - <type>String</type> - <required>true</required> - <description> - The legacy path. - </description> - </field> - <field> - <name>artifact</name> - <version>1.1.0+</version> - <type>String</type> - <required>true</required> - <description> - The artifact reference, as " [groupId] : [artifactId] : [version] : [classifier] : [type] ". - </description> - </field> - </fields> - <codeSegments> - <codeSegment> - <version>1.0.0+</version> - <code><![CDATA[ - public boolean match( String path ) - { - return path.equals( this.path ); - } - - public String getGroupId() - { - return artifact.split( ":" )[0]; - } - - public String getArtifactId() - { - return artifact.split( ":" )[1]; - } - - public String getVersion() - { - return artifact.split( ":" )[2]; - } - - public String getClassifier() - { - String classifier = artifact.split( ":" )[3]; - return classifier.length() > 0 ? classifier : null; - } - - public String getType() - { - return artifact.split( ":" )[4]; - } - ]]></code> - </codeSegment> - </codeSegments> - </class> - - <!-- - ____ _ - / ___|___ _ __ _ __ ___ ___| |_ ___ _ __ ___ - | | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __| - | |__| (_) | | | | | | | __/ (__| || (_) | | \__ \ - \____\___/|_| |_|_| |_|\___|\___|\__\___/|_| |___/ - - --> - - <class> - <name>AbstractRepositoryConnectorConfiguration</name> - <abstract>true</abstract> - <version>1.0.0+</version> - <fields> - <field> - <name>sourceRepoId</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The Repository Source for this connector. - </description> - </field> - <field> - <name>targetRepoId</name> - <version>1.0.0+</version> - <type>String</type> - <required>true</required> - <description> - The Repository Target for this connector. - </description> - </field> - <field> - <name>proxyId</name> - <version>1.0.0+</version> - <type>String</type> - <description> - The network proxy ID to use for this connector. - </description> - </field> - <field> - <name>blackListPatterns</name> - <version>1.0.0+</version> - <association> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of blacklisted patterns for this connector. - </description> - </field> - <field> - <name>whiteListPatterns</name> - <version>1.0.0+</version> - <association> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of whitelisted patterns for this connector. - </description> - </field> - <field> - <name>policies</name> - <version>1.0.0+</version> - <type>Map</type> - <description>Policy configuration for the connector.</description> - <association xml.mapStyle="inline"> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - </field> - <field> - <name>properties</name> - <version>1.0.0+</version> - <type>Map</type> - <description>Configuration for the connector.</description> - <association xml.mapStyle="inline"> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - </field> - </fields> - <codeSegments> - <codeSegment> - <version>1.0.0+</version> - <code><![CDATA[ - /** - * Obtain a specific policy from the underlying connector. - * - * @param policyId the policy id to fetch. - * @param defaultValue the default value for the policy id. - * @return the configured policy value (or default value if not found). - */ - public String getPolicy( String policyId, String defaultValue ) - { - if ( this.getPolicies() == null ) - { - return null; - } - - Object value = this.getPolicies().get( policyId ); - - if ( value == null ) - { - return defaultValue; - } - - return (String) value; - } - ]]></code> - </codeSegment> - </codeSegments> - </class> - - <class> - <superClass>AbstractRepositoryConnectorConfiguration</superClass> - <name>ProxyConnectorConfiguration</name> - <version>1.0.0+</version> - <fields> - <field> - <name>order</name> - <version>1.0.0+</version> - <description> - The order of the proxy connectors. (0 means no order specified) - </description> - <type>int</type> - <defaultValue>0</defaultValue> - </field> - </fields> - <codeSegments> - <codeSegment> - <version>1.0.0+</version> - <code><![CDATA[ - /** - * The order id for UNORDERED - */ - public static final int UNORDERED = 0; - - /** - * The policy key {@link #getPolicies()} for snapshot handling. - * See {@link org.apache.maven.archiva.policies.SnapshotsPolicy} - * for details on potential values to this policy key. - */ - public static final String POLICY_SNAPSHOTS = "snapshots"; - - /** - * The policy key {@link #getPolicies()} for releases handling. - * See {@link org.apache.maven.archiva.policies.ReleasesPolicy} - * for details on potential values to this policy key. - */ - public static final String POLICY_RELEASES = "releases"; - - /** - * The policy key {@link #getPolicies()} for checksum handling. - * See {@link org.apache.maven.archiva.policies.ChecksumPolicy} - * for details on potential values to this policy key. - */ - public static final String POLICY_CHECKSUM = "checksum"; - - /** - * The policy key {@link #getPolicies()} for cache-failures handling. - * See {@link org.apache.maven.archiva.policies.CachedFailuresPolicy} - * for details on potential values to this policy key. - */ - public static final String POLICY_CACHE_FAILURES = "cache-failures"; - ]]></code> - </codeSegment> - </codeSegments> - </class> - - <class> - <superClass>AbstractRepositoryConnectorConfiguration</superClass> - <name>SyncConnectorConfiguration</name> - <abstract>true</abstract> - <version>1.0.0+</version> - <fields> - <field> - <name>cronExpression</name> - <version>1.0.0+</version> - <type>String</type> - <description>When to run the sync mechanism. Default is every hour on the hour.</description> - <defaultValue>0 0 * * * ?</defaultValue> - </field> - <field> - <name>method</name> - <version>1.0.0+</version> - <type>String</type> - <description>The type of synchronization to use.</description> - <defaultValue>rsync</defaultValue> - </field> - </fields> - </class> - - <!-- - ____ _ - | _ \ _ __ _____ _(_) ___ ___ - | |_) | '__/ _ \ \/ / |/ _ \/ __| - | __/| | | (_) > <| | __/\__ \ - |_| |_| \___/_/\_\_|\___||___/ - - --> - - <class> - <name>NetworkProxyConfiguration</name> - <version>1.0.0+</version> - <fields> - <field> - <name>id</name> - <version>1.0.0+</version> - <type>String</type> - <description> - The ID for this proxy. - </description> - </field> - <field> - <name>protocol</name> - <version>1.0.0+</version> - <description> - The network protocol to use with this proxy: "http", "socks-4" - </description> - <type>String</type> - <required>true</required> - <defaultValue>http</defaultValue> - </field> - <field> - <name>host</name> - <version>1.0.0+</version> - <description> - The proxy host. - </description> - <type>String</type> - <required>true</required> - </field> - <field> - <name>port</name> - <version>1.0.0+</version> - <description> - The proxy port. - </description> - <type>int</type> - <defaultValue>8080</defaultValue> - </field> - <field> - <name>username</name> - <version>1.0.0+</version> - <description> - The proxy user. - </description> - <type>String</type> - </field> - <field> - <name>password</name> - <version>1.0.0+</version> - <description> - The proxy password. - </description> - <type>String</type> - </field> - </fields> - </class> - - <!-- - ____ _ - / ___| ___ __ _ _ __ _ __ (_)_ __ __ _ - \___ \ / __/ _` | '_ \| '_ \| | '_ \ / _` | - ___) | (_| (_| | | | | | | | | | | | (_| | - |____/ \___\__,_|_| |_|_| |_|_|_| |_|\__, | - |___/ - - --> - <class> - <name>RepositoryScanningConfiguration</name> - <version>1.0.0+</version> - <fields> - <field> - <name>fileTypes</name> - <version>1.0.0+</version> - <required>true</required> - <association> - <type>FileType</type> - <multiplicity>*</multiplicity> - </association> - <description> - The FileTypes for the repository scanning configuration. - </description> - </field> - <field> - <name>knownContentConsumers</name> - <version>1.0.0+</version> - <required>true</required> - <association> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of active consumers IDs for known content. - </description> - </field> - <field> - <name>invalidContentConsumers</name> - <version>1.0.0+</version> - <required>true</required> - <association> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of active consumer IDs for invalid content. - </description> - </field> - </fields> - </class> - <class> - <name>FileType</name> - <version>1.0.0+</version> - <description>The FileType object</description> - <fields> - <field> - <name>id</name> - <version>1.0.0+</version> - <required>true</required> - <type>String</type> - </field> - <field> - <name>patterns</name> - <version>1.0.0+</version> - <required>true</required> - <association> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - </field> - </fields> - </class> - <class> - <name>DatabaseScanningConfiguration</name> - <version>1.0.0+</version> - <description> - The scanning configuration for unprocessed ArchivaArtifact database objects. - </description> - <fields> - <field> - <name>cronExpression</name> - <version>1.0.0+</version> - <type>String</type> - <description>When to run the database scanning mechanism. Default is every two hours on the hour. - </description> - <defaultValue>0 0 0/2 * * ?</defaultValue> - </field> - <field> - <name>unprocessedConsumers</name> - <version>1.0.0+</version> - <required>true</required> - <association> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of consumers for the unprocessed ArchivaArtifact database objects. - </description> - </field> - <field> - <name>cleanupConsumers</name> - <version>1.0.0+</version> - <required>true</required> - <association> - <type>String</type> - <multiplicity>*</multiplicity> - </association> - <description> - The list of consumers for previously processed ArchivaArtifact database - objects that no longer exist on the filesystem, and might need to - undergo a cleanup. - </description> - </field> - </fields> - </class> - - <!-- - __ _______ ____ _ ____ ____ - \ \ / / ____| __ ) / \ | _ \| _ \ - \ \ /\ / /| _| | _ \ / _ \ | |_) | |_) | - \ V V / | |___| |_) / ___ \| __/| __/ - \_/\_/ |_____|____/_/ \_\_| |_| - - --> - - <class> - <name>WebappConfiguration</name> - <version>1.0.0+</version> - <description> - The webapp configuration settings. - </description> - <fields> - <field> - <name>ui</name> - <description>options for altering the ui presentation</description> - <version>1.0.0+</version> - <association> - <type>UserInterfaceOptions</type> - </association> - </field> - </fields> - </class> - - <class> - <name>UserInterfaceOptions</name> - <version>1.0.0+</version> - <description> - The user interface configuration settings. - </description> - <fields> - <field> - <name>showFindArtifacts</name> - <description>true if find artifacts should be enabled</description> - <version>1.0.0+</version> - <type>boolean</type> - <defaultValue>true</defaultValue> - </field> - <field> - <name>appletFindEnabled</name> - <description>true if applet behavior for find artifacts should be enabled</description> - <version>1.0.0+</version> - <type>boolean</type> - <defaultValue>true</defaultValue> - </field> - </fields> - </class> - - </classes> -</model> - - diff --git a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/SyncedRepositoryConfiguration-conversion.properties b/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/SyncedRepositoryConfiguration-conversion.properties deleted file mode 100644 index 2beeea469..000000000 --- a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/SyncedRepositoryConfiguration-conversion.properties +++ /dev/null @@ -1,21 +0,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. -# - -Key_properties=java.lang.String -Element_properties=java.lang.String diff --git a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml b/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml deleted file mode 100644 index 87cf71e92..000000000 --- a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml +++ /dev/null @@ -1,176 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration> - <version>2</version> - <managedRepositories> - <managedRepository> - <id>internal</id> - <name>Archiva Managed Internal Repository</name> - <location>${appserver.base}/data/repositories/internal</location> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <scanned>true</scanned> - <refreshCronExpression>0 0 * * * ?</refreshCronExpression> - <daysOlder>30</daysOlder> - </managedRepository> - <managedRepository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <location>${appserver.base}/data/repositories/snapshots</location> - <layout>default</layout> - <releases>false</releases> - <snapshots>true</snapshots> - <scanned>true</scanned> - <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression> - <daysOlder>30</daysOlder> - </managedRepository> - </managedRepositories> - <remoteRepositories> - <remoteRepository> - <id>central</id> - <name>Central Repository</name> - <url>http://repo1.maven.org/maven2</url> - <layout>default</layout> - </remoteRepository> - <remoteRepository> - <id>maven2-repository.dev.java.net</id> - <name>Java.net Repository for Maven 2</name> - <url>http://download.java.net/maven/2/</url> - <layout>default</layout> - </remoteRepository> - </remoteRepositories> - - <proxyConnectors> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>central</targetRepoId> - <proxyId/> - <policies> - <snapshots>disabled</snapshots> - <releases>once</releases> - <checksum>fix</checksum> - <cache-failures>cached</cache-failures> - </policies> - <whiteListPatterns> - <whiteListPattern>**/*</whiteListPattern> - </whiteListPatterns> - </proxyConnector> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>maven2-repository.dev.java.net</targetRepoId> - <proxyId/> - <policies> - <snapshots>disabled</snapshots> - <releases>once</releases> - <checksum>fix</checksum> - <cache-failures>cached</cache-failures> - </policies> - <whiteListPatterns> - <whiteListPattern>javax/**</whiteListPattern> - </whiteListPatterns> - </proxyConnector> - </proxyConnectors> - - <legacyArtifactPaths> - <legacyArtifactPath> - <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path> - <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact> - </legacyArtifactPath> - </legacyArtifactPaths> - - <repositoryScanning> - <fileTypes> - <fileType> - <id>artifacts</id> - <patterns> - <pattern>**/*.pom</pattern> - <pattern>**/*.jar</pattern> - <pattern>**/*.ear</pattern> - <pattern>**/*.war</pattern> - <pattern>**/*.car</pattern> - <pattern>**/*.sar</pattern> - <pattern>**/*.mar</pattern> - <pattern>**/*.rar</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - <pattern>**/*.tar.gz</pattern> - <pattern>**/*.tar.bz2</pattern> - <pattern>**/*.zip</pattern> - </patterns> - </fileType> - <fileType> - <id>indexable-content</id> - <patterns> - <pattern>**/*.txt</pattern> - <pattern>**/*.TXT</pattern> - <pattern>**/*.block</pattern> - <pattern>**/*.config</pattern> - <pattern>**/*.pom</pattern> - <pattern>**/*.xml</pattern> - <pattern>**/*.xsd</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - </patterns> - </fileType> - <fileType> - <id>auto-remove</id> - <patterns> - <pattern>**/*.bak</pattern> - <pattern>**/*~</pattern> - <pattern>**/*-</pattern> - </patterns> - </fileType> - <fileType> - <id>ignored</id> - <patterns> - <pattern>**/.htaccess</pattern> - <pattern>**/KEYS</pattern> - <pattern>**/*.rb</pattern> - <pattern>**/*.sh</pattern> - <pattern>**/.svn/**</pattern> - <pattern>**/.DAV/**</pattern> - </patterns> - </fileType> - </fileTypes> - <knownContentConsumers> - <knownContentConsumer>update-db-artifact</knownContentConsumer> - <knownContentConsumer>create-missing-checksums</knownContentConsumer> - <knownContentConsumer>update-db-repository-metadata</knownContentConsumer> - <knownContentConsumer>validate-checksum</knownContentConsumer> - <knownContentConsumer>validate-signature</knownContentConsumer> - <knownContentConsumer>index-content</knownContentConsumer> - <knownContentConsumer>auto-remove</knownContentConsumer> - <knownContentConsumer>auto-rename</knownContentConsumer> - <knownContentConsumer>metadata-updater</knownContentConsumer> - <!--knownContentConsumer>repository-purge</knownContentConsumer--> - </knownContentConsumers> - <invalidContentConsumers> - <invalidContentConsumer>update-db-bad-content</invalidContentConsumer> - </invalidContentConsumers> - </repositoryScanning> - - <databaseScanning> - <cronExpression>0 0 * * * ?</cronExpression> - <unprocessedConsumers> - <unprocessedConsumer>index-artifact</unprocessedConsumer> - <unprocessedConsumer>update-db-project</unprocessedConsumer> - <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer> - <unprocessedConsumer>index-archive-toc</unprocessedConsumer> - <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> - <unprocessedConsumer>index-public-methods</unprocessedConsumer> - </unprocessedConsumers> - <cleanupConsumers> - <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> - <cleanupConsumer>not-present-remove-db-project</cleanupConsumer> - <cleanupConsumer>not-present-remove-indexed</cleanupConsumer> - </cleanupConsumers> - </databaseScanning> - - <webapp> - <ui> - <showFindArtifacts>true</showFindArtifacts> - <appletFindEnabled>true</appletFindEnabled> - </ui> - </webapp> - -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/archiva-0.9.xml b/archiva-base/archiva-configuration/src/test/conf/archiva-0.9.xml deleted file mode 100644 index c8032436a..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/archiva-0.9.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<configuration> - <repositories> - <repository> - <directory>managed-repository</directory> - <id>local</id> - <name>local</name> - </repository> - </repositories> - <proxiedRepositories> - <proxiedRepository> - <url>http://www.ibiblio.org/maven2/</url> - <managedRepository>local</managedRepository> - <useNetworkProxy>true</useNetworkProxy> - <id>ibiblio</id> - <name>Ibiblio</name> - </proxiedRepository> - <proxiedRepository> - <url>http://repository.codehaus.org/</url> - <managedRepository>local</managedRepository> - <id>codehaus</id> - <name>Codehaus</name> - </proxiedRepository> - </proxiedRepositories> -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/archiva-v1.xml b/archiva-base/archiva-configuration/src/test/conf/archiva-v1.xml deleted file mode 100644 index 917850952..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/archiva-v1.xml +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<configuration> - <repositories> - <repository> - <id>internal</id> - <name>Archiva Managed Internal Repository</name> - <url>file://${appserver.base}/repositories/internal</url> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <indexed>true</indexed> - <refreshCronExpression>0 0 * * ?</refreshCronExpression> - </repository> - <repository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <url>file://${appserver.base}/repositories/snapshots</url> - <layout>default</layout> - <releases>false</releases> - <snapshots>true</snapshots> - <indexed>false</indexed> - <refreshCronExpression>0 0,30 * * ?</refreshCronExpression> - </repository> - <repository> - <id>central</id> - <name>Central Repository</name> - <url>http://repo1.maven.org/maven2</url> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <indexed>false</indexed> - </repository> - <repository> - <id>maven2-repository.dev.java.net</id> - <name>Java.net Repository for Maven 2</name> - <url>https://maven2-repository.dev.java.net/nonav/repository</url> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <indexed>false</indexed> - </repository> - </repositories> - - <proxyConnectors> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>central</targetRepoId> - <proxyId/> - <snapshotsPolicy>disabled</snapshotsPolicy> - <releasePolicy>never</releasePolicy> - <failurePolicy>not-found</failurePolicy> - </proxyConnector> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>maven2-repository.dev.java.net</targetRepoId> - <proxyId/> - <snapshotsPolicy>disabled</snapshotsPolicy> - <releasePolicy>never</releasePolicy> - <failurePolicy>not-found</failurePolicy> - <whiteListPatterns> - <whiteListPattern>javax/**</whiteListPattern> - </whiteListPatterns> - </proxyConnector> - </proxyConnectors> - - <networkProxies> - <networkProxy> - <id>example</id> - <protocol>http</protocol> - <host>proxy.mycompany.com</host> - <port>8080</port> - <username>myself</username> - <password>mypass</password> - </networkProxy> - </networkProxies> - - <repositoryScanning> - <fileTypes> - <fileType> - <id>artifacts</id> - <patterns> - <pattern>**/*.pom</pattern> - <pattern>**/*.jar</pattern> - <pattern>**/*.ear</pattern> - <pattern>**/*.war</pattern> - <pattern>**/*.car</pattern> - <pattern>**/*.sar</pattern> - <pattern>**/*.mar</pattern> - <pattern>**/*.rar</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - <pattern>**/*.tar.gz</pattern> - <pattern>**/*.tar.bz2</pattern> - <pattern>**/*.zip</pattern> - </patterns> - </fileType> - <fileType> - <id>indexable-content</id> - <patterns> - <pattern>**/*.txt</pattern> - <pattern>**/*.TXT</pattern> - <pattern>**/*.block</pattern> - <pattern>**/*.config</pattern> - <pattern>**/*.pom</pattern> - <pattern>**/*.xml</pattern> - <pattern>**/*.xsd</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - </patterns> - </fileType> - <fileType> - <id>auto-remove</id> - <patterns> - <pattern>**/*.bak</pattern> - <pattern>**/*~</pattern> - <pattern>**/*-</pattern> - </patterns> - </fileType> - <fileType> - <id>ignored</id> - <patterns> - <pattern>**/.htaccess</pattern> - <pattern>**/KEYS</pattern> - <pattern>**/*.rb</pattern> - <pattern>**/*.sh</pattern> - <pattern>**/.svn/**</pattern> - <pattern>**/.DAV/**</pattern> - </patterns> - </fileType> - </fileTypes> - <knownContentConsumers> - <knownContentConsumer>update-db-artifact</knownContentConsumer> - <knownContentConsumer>create-missing-checksums</knownContentConsumer> - <knownContentConsumer>update-db-repository-metadata</knownContentConsumer> - <knownContentConsumer>validate-checksum</knownContentConsumer> - <knownContentConsumer>validate-signature</knownContentConsumer> - <knownContentConsumer>index-content</knownContentConsumer> - <knownContentConsumer>auto-remove</knownContentConsumer> - <knownContentConsumer>auto-rename</knownContentConsumer> - <knownContentConsumer>metadata-updater</knownContentConsumer> - <!--knownContentConsumer>repository-purge</knownContentConsumer--> - </knownContentConsumers> - <invalidContentConsumers> - <invalidContentConsumer>update-db-bad-content</invalidContentConsumer> - </invalidContentConsumers> - </repositoryScanning> - - <databaseScanning> - <cronExpression>0 0 * * ?</cronExpression> - <unprocessedConsumers> - <unprocessedConsumer>index-artifact</unprocessedConsumer> - <unprocessedConsumer>update-db-project</unprocessedConsumer> - <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer> - <unprocessedConsumer>index-archive-toc</unprocessedConsumer> - <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> - <unprocessedConsumer>index-public-methods</unprocessedConsumer> - </unprocessedConsumers> - <cleanupConsumers> - <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> - <cleanupConsumer>not-present-remove-db-project</cleanupConsumer> - <cleanupConsumer>not-present-remove-indexed</cleanupConsumer> - </cleanupConsumers> - </databaseScanning> - - <webapp> - <ui> - <showFindArtifacts>true</showFindArtifacts> - <appletFindEnabled>true</appletFindEnabled> - </ui> - </webapp> - -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/autodetect-v1.xml b/archiva-base/archiva-configuration/src/test/conf/autodetect-v1.xml deleted file mode 100644 index ab4417eb2..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/autodetect-v1.xml +++ /dev/null @@ -1,190 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<configuration> - <repositories> - <repository> - <id>internal</id> - <name>Archiva Managed Internal Repository</name> - <url>file://${appserver.base}/repositories/internal</url> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <indexed>true</indexed> - <refreshCronExpression>0 0 * * ?</refreshCronExpression> - </repository> - <repository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <url>file:${appserver.base}/repositories/snapshots</url> - <layout>default</layout> - <releases>false</releases> - <snapshots>true</snapshots> - <indexed>true</indexed> - <refreshCronExpression>0 0,30 * * ?</refreshCronExpression> - </repository> - <repository> - <id>central</id> - <name>Central Repository</name> - <url>http://repo1.maven.org/maven2</url> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <indexed>false</indexed> - </repository> - <repository> - <id>maven2-repository.dev.java.net</id> - <name>Java.net Repository for Maven 2</name> - <url>https://maven2-repository.dev.java.net/nonav/repository</url> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <indexed>false</indexed> - </repository> - </repositories> - - <proxyConnectors> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>central</targetRepoId> - <proxyId/> - <snapshotsPolicy>disabled</snapshotsPolicy> - <releasePolicy>never</releasePolicy> - <failurePolicy>not-found</failurePolicy> - </proxyConnector> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>maven2-repository.dev.java.net</targetRepoId> - <proxyId/> - <snapshotsPolicy>disabled</snapshotsPolicy> - <releasePolicy>never</releasePolicy> - <failurePolicy>not-found</failurePolicy> - <whiteListPatterns> - <whiteListPattern>javax/**</whiteListPattern> - </whiteListPatterns> - </proxyConnector> - </proxyConnectors> - - <networkProxies> - <networkProxy> - <id>example</id> - <protocol>http</protocol> - <host>proxy.mycompany.com</host> - <port>8080</port> - <username>myself</username> - <password>mypass</password> - </networkProxy> - </networkProxies> - - <repositoryScanning> - <fileTypes> - <fileType> - <id>artifacts</id> - <patterns> - <pattern>**/*.pom</pattern> - <pattern>**/*.jar</pattern> - <pattern>**/*.ear</pattern> - <pattern>**/*.war</pattern> - <pattern>**/*.car</pattern> - <pattern>**/*.sar</pattern> - <pattern>**/*.mar</pattern> - <pattern>**/*.rar</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - <pattern>**/*.tar.gz</pattern> - <pattern>**/*.tar.bz2</pattern> - <pattern>**/*.zip</pattern> - </patterns> - </fileType> - <fileType> - <id>indexable-content</id> - <patterns> - <pattern>**/*.txt</pattern> - <pattern>**/*.TXT</pattern> - <pattern>**/*.block</pattern> - <pattern>**/*.config</pattern> - <pattern>**/*.pom</pattern> - <pattern>**/*.xml</pattern> - <pattern>**/*.xsd</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - </patterns> - </fileType> - <fileType> - <id>auto-remove</id> - <patterns> - <pattern>**/*.bak</pattern> - <pattern>**/*~</pattern> - <pattern>**/*-</pattern> - </patterns> - </fileType> - <fileType> - <id>ignored</id> - <patterns> - <pattern>**/.htaccess</pattern> - <pattern>**/KEYS</pattern> - <pattern>**/*.rb</pattern> - <pattern>**/*.sh</pattern> - <pattern>**/.svn/**</pattern> - <pattern>**/.DAV/**</pattern> - </patterns> - </fileType> - </fileTypes> - <knownContentConsumers> - <knownContentConsumer>update-db-artifact</knownContentConsumer> - <knownContentConsumer>create-missing-checksums</knownContentConsumer> - <knownContentConsumer>update-db-repository-metadata</knownContentConsumer> - <knownContentConsumer>validate-checksum</knownContentConsumer> - <knownContentConsumer>validate-signature</knownContentConsumer> - <knownContentConsumer>index-content</knownContentConsumer> - <knownContentConsumer>auto-remove</knownContentConsumer> - <knownContentConsumer>auto-rename</knownContentConsumer> - <knownContentConsumer>metadata-updater</knownContentConsumer> - </knownContentConsumers> - <invalidContentConsumers> - <invalidContentConsumer>update-db-bad-content</invalidContentConsumer> - </invalidContentConsumers> - </repositoryScanning> - - <databaseScanning> - <cronExpression>0 0 * * ?</cronExpression> - <unprocessedConsumers> - <unprocessedConsumer>index-artifact</unprocessedConsumer> - <unprocessedConsumer>update-db-project</unprocessedConsumer> - <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer> - <unprocessedConsumer>index-archive-toc</unprocessedConsumer> - <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> - <unprocessedConsumer>index-public-methods</unprocessedConsumer> - </unprocessedConsumers> - <cleanupConsumers> - <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> - <cleanupConsumer>not-present-remove-db-project</cleanupConsumer> - <cleanupConsumer>not-present-remove-indexed</cleanupConsumer> - </cleanupConsumers> - </databaseScanning> - - <webapp> - <ui> - <showFindArtifacts>true</showFindArtifacts> - <appletFindEnabled>true</appletFindEnabled> - </ui> - </webapp> - -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/conf-base.xml b/archiva-base/archiva-configuration/src/test/conf/conf-base.xml deleted file mode 100644 index 2fdceab69..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/conf-base.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<configuration> - <version>2</version> - <managedRepositories> - <managedRepository> - <id>internal</id> - <name>Archiva Managed Internal Repository</name> - <location>${appserver.base}/repositories/internal</location> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <scanned>true</scanned> - <refreshCronExpression>0 0 * * ?</refreshCronExpression> - </managedRepository> - <managedRepository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <location>${appserver.base}/repositories/snapshots</location> - <layout>default</layout> - <releases>false</releases> - <snapshots>true</snapshots> - <scanned>true</scanned> - <refreshCronExpression>0 0,30 * * ?</refreshCronExpression> - </managedRepository> - </managedRepositories> - <remoteRepositories> - <remoteRepository> - <id>central</id> - <name>Central Repository</name> - <url>http://repo1.maven.org/maven2</url> - <layout>default</layout> - </remoteRepository> - <remoteRepository> - <id>maven2-repository.dev.java.net</id> - <name>Java.net Repository for Maven 2</name> - <url>https://maven2-repository.dev.java.net/nonav/repository</url> - <layout>default</layout> - </remoteRepository> - </remoteRepositories> - - <webapp> - <ui> - <showFindArtifacts>false</showFindArtifacts> - </ui> - </webapp> -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/conf-single-list-elements.xml b/archiva-base/archiva-configuration/src/test/conf/conf-single-list-elements.xml deleted file mode 100644 index 2fe0066d4..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/conf-single-list-elements.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<configuration> - <version>2</version> - <managedRepositories> - <managedRepository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <location>${appserver.base}/repositories/snapshots</location> - <layout>default</layout> - <releases>false</releases> - <snapshots>true</snapshots> - <scanned>true</scanned> - <refreshCronExpression>0 0,30 * * ?</refreshCronExpression> - </managedRepository> - </managedRepositories> - <remoteRepositories> - <remoteRepository> - <id>central</id> - <name>Central Repository</name> - <url>http://repo1.maven.org/maven2</url> - <layout>default</layout> - </remoteRepository> - </remoteRepositories> - <proxyConnectors> - <proxyConnector> - <order>2</order> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>maven2-repository.dev.java.net</targetRepoId> - <proxyId/> - <whiteListPatterns> - <whiteListPattern>javax/**</whiteListPattern> - </whiteListPatterns> - <policies> - <releases>once</releases> - <checksum>fix</checksum> - <snapshots>never</snapshots> - <cache-failures>yes</cache-failures> - </policies> - </proxyConnector> - </proxyConnectors> - <networkProxies> - <networkProxy> - <id>proxy</id> - <host>proxy</host> - <port>8080</port> - </networkProxy> - </networkProxies> - <legacyArtifactPaths> - <legacyArtifactPath> - <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path> - <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact> - </legacyArtifactPath> - </legacyArtifactPaths> - <repositoryScanning> - <knownContentConsumers> - <knownContentConsumer>auto-remove</knownContentConsumer> - </knownContentConsumers> - <invalidContentConsumers> - <invalidContentConsumer>update-db-bad-content</invalidContentConsumer> - </invalidContentConsumers> - </repositoryScanning> - <databaseScanning> - <unprocessedConsumers> - <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> - </unprocessedConsumers> - <cleanupConsumers> - <cleanupConsumer>not-present-remove-db-project</cleanupConsumer> - </cleanupConsumers> - </databaseScanning> -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/conf-user.xml b/archiva-base/archiva-configuration/src/test/conf/conf-user.xml deleted file mode 100644 index 61c4dadc2..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/conf-user.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?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. - --> -<configuration> - <version>2</version> - <proxyConnectors> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>central</targetRepoId> - <proxyId/> - <snapshotsPolicy>disabled</snapshotsPolicy> - <releasePolicy>never</releasePolicy> - <failurePolicy>not-found</failurePolicy> - </proxyConnector> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>maven2-repository.dev.java.net</targetRepoId> - <proxyId/> - <snapshotsPolicy>disabled</snapshotsPolicy> - <releasePolicy>never</releasePolicy> - <failurePolicy>not-found</failurePolicy> - <whiteListPatterns> - <whiteListPattern>javax/**</whiteListPattern> - </whiteListPatterns> - </proxyConnector> - </proxyConnectors> - - <webapp> - <ui> - <appletFindEnabled>false</appletFindEnabled> - </ui> - </webapp> -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/corrupt.xml b/archiva-base/archiva-configuration/src/test/conf/corrupt.xml deleted file mode 100644 index b4469289a..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/corrupt.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - diff --git a/archiva-base/archiva-configuration/src/test/conf/escape-cron-expressions.xml b/archiva-base/archiva-configuration/src/test/conf/escape-cron-expressions.xml deleted file mode 100644 index 48de2878d..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/escape-cron-expressions.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> -<!-- - ~ 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. - --> -<configuration> - <version>2</version> - <managedRepositories> - <managedRepository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <location>file://${appserver.base}/repositories/internal</location> - <releases>false</releases> - <snapshots>true</snapshots> - <refreshCronExpression>0 0\,30 * * ?</refreshCronExpression> - </managedRepository> - </managedRepositories> - <databaseScanning> - <cronExpression>0 0 0 * * ?</cronExpression> - <unprocessedConsumers> - <unprocessedConsumer>index-artifact</unprocessedConsumer> - <unprocessedConsumer>update-db-project</unprocessedConsumer> - <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer> - <unprocessedConsumer>index-archive-toc</unprocessedConsumer> - <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> - <unprocessedConsumer>index-public-methods</unprocessedConsumer> - </unprocessedConsumers> - <cleanupConsumers> - <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> - <cleanupConsumer>not-present-remove-db-project</cleanupConsumer> - <cleanupConsumer>not-present-remove-indexed</cleanupConsumer> - </cleanupConsumers> - </databaseScanning> - - <webapp> - <ui> - <showFindArtifacts>false</showFindArtifacts> - </ui> - </webapp> -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/conf/maven-proxy-complete.conf b/archiva-base/archiva-configuration/src/test/conf/maven-proxy-complete.conf deleted file mode 100644 index 7908a9ad9..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/maven-proxy-complete.conf +++ /dev/null @@ -1,144 +0,0 @@ -################ GLOBAL SETTINGS
-# This is where maven-proxy stores files it has downloaded
-repo.local.store=target
-
-#The port to listen on - not used if loaded as a webapp
-port=9999
-
-#This is the base area that all files are loaded from. While it is possible to leave this blank, this behaviour
-#is deprecated and will be disabled in version 2.0. There are too many namespace conflicts caused by not using
-#a prefix.
-#The repository will be shown at http://localhost:9999/repository/
-#for the .war loaded into a webapp server, the default prefix is "repository" (edit the web.xml to change)
-# As maven doesn't like a trailing slash, this address shouldn't have one either.
-prefix=repository
-
-#This is the simple date format used to display the last modified date while browsing the repository.
-lastModifiedDateFormat=yyyy/MM/dd HH:mm:ss
-
-################ SNAPSHOT HANDLING
-#If you want the proxy to look for newer snapshots, set to true
-snapshot.update=true
-
-################ M2 METADATA HANDLING
-#If you want the proxy to prevent looking for newer metadata, set to false (default is true)
-#metadata.update=false
-
-################ M2 POM HANDLING
-#If you want the proxy to look for newer POMs, set to true (default is false)
-pom.update=true
-
-################ PROMOTION HANDLING
-# ***** NOT CURRENTLY IMPLEMENTED *****
-#Promotion describes the process by which new artifacts are loaded to global maven-proxy repository. It
-# is designed to be used by "higher security installations" that do not want to acquire artifacts from
-# remote repositories without approval.
-#
-#If promotion handling is enabled, then the proxy will not download remote artifacts without permission
-# (local repositories with copy=false are considered to be local)
-#
-#Permission to download is granted via the Promotion menu which will be enabled
-# when promotion handling is enabled.
-#
-#If promotion is false, artifacts are sourced from any repository as per normal.
-#
-#Promotion and snapshots: If promotion is enabled, snapshots are not downloadable. The concept of using
-# a snapshot in a production build (which is primarily what promotion is for) is counterintuitive.
-##
-promotion=false
-
-################ WEB INTERFACE
-# This defines the absolute URL the server should use to identify itself.
-# This can often be determined automatically, but we recommend you specify
-# it explicitly to prevent problems during startup.
-# The prefix will be added to this for the actual repository
-# i.e. proxy available at http://localhost:9999/, repository at http://localhost:9999/repository
-serverName=http://localhost:9999
-
-#If true, the repository can be browsed
-browsable=true
-
-#If true, the repository can be searched
-searchable=true
-
-#Not currently implemented. Will allow webdav access to the repository at some point.
-webdav=true
-
-#Stylesheet - if configured, will override the default stylesheet shipped with maven-proxy - absolute URLs only
-#eg. /maven-proxy/style.css, http://www.example.com/style.css
-stylesheet=/maven-proxy/style.css
-
-#bgColor / bgColorHighlight are replaced in the built in stylesheet to produce a simple color scheme.
-#If a stylesheet is set, these are not used.
-bgColor=#14B
-bgColorHighlight=#94B
-
-#rowColor / rowColorHighlight are replaced in the built in stylesheet to produce a simple color scheme.
-#If a stylesheet is set, these are not used.
-rowColor=#CCF
-rowColorHighlight=#DDF
-
-
-################ PROXIES
-#This is just a hack, it should auto discover them
-proxy.list=one,two,three
-
-#Unauthenticated proxy
-proxy.one.host=proxy1.example.com
-proxy.one.port=3128
-
-#Authenticated proxy
-proxy.two.host=proxy2.example.org
-proxy.two.port=80
-proxy.two.username=username2
-proxy.two.password=password2
-
-#Authenticated proxy
-proxy.three.host=proxy3.example.net
-proxy.three.port=3129
-proxy.three.username=username3
-proxy.three.password=password3
-
-
-################# REPOSITORIES
-#This is not just a hack, it specifies the order repositories should be checked
-#Note that the proxy adds a "/" which is why the urls aren't suffixed with a "/"
-repo.list=local-repo,www-ibiblio-org,dist-codehaus-org,private-example-com
-
-#local-store
-# The local store represents a location that local jars you host can be located.
-# This could also be achieved by having a local http repository, but this is less cumbersome
-repo.local-repo.url=file://target
-repo.local-repo.description=Super Secret Custom Repository
-#If copy is true, jars are copied from the store to the proxy-repo. Only configurable for file:/// repos
-repo.local-repo.copy=false
-#If hardfail is true, any unexpected errors from the repository will cause
-#the client download to fail (typically with a 500 error)
-repo.local-repo.hardfail=true
-#Don't cache a file repository
-repo.local-repo.cache.period=0
-
-
-#www.ibiblio.org
-repo.www-ibiblio-org.url=http://www.ibiblio.org/maven2
-repo.www-ibiblio-org.description=www.ibiblio.org
-repo.www-ibiblio-org.proxy=one
-repo.www-ibiblio-org.hardfail=true
-#Cache this repository for 1 hour
-repo.www-ibiblio-org.cache.period=3600
-repo.www-ibiblio-org.cache.failures=true
-
-#dist.codehaus.org
-repo.dist-codehaus-org.url=http://dist.codehaus.org
-repo.dist-codehaus-org.proxy=two
-repo.dist-codehaus-org.hardfail=false
-repo.dist-codehaus-org.cache.period=3600
-repo.dist-codehaus-org.cache.failures=true
-
-#private.example.com
-repo.private-example-com.url=http://private.example.com/internal
-repo.private-example-com.description=Commercial In Confidence Repository
-repo.private-example-com.username=username1
-repo.private-example-com.password=password1
-repo.private-example-com.proxy=three
-repo.private-example-com.cache.period=3600
diff --git a/archiva-base/archiva-configuration/src/test/conf/repository-manager.xml b/archiva-base/archiva-configuration/src/test/conf/repository-manager.xml deleted file mode 100644 index 7566d549f..000000000 --- a/archiva-base/archiva-configuration/src/test/conf/repository-manager.xml +++ /dev/null @@ -1,193 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<configuration> - <version>2</version> - <managedRepositories> - <managedRepository> - <id>internal</id> - <name>Archiva Managed Internal Repository</name> - <location>${appserver.base}/repositories/internal</location> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <scanned>true</scanned> - <refreshCronExpression>0 0 * * ?</refreshCronExpression> - </managedRepository> - <managedRepository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <location>${appserver.base}/repositories/internal</location> - <layout>default</layout> - <releases>false</releases> - <snapshots>true</snapshots> - <scanned>true</scanned> - <refreshCronExpression>0 0,30 * * ?</refreshCronExpression> - </managedRepository> - </managedRepositories> - <remoteRepositories> - <remoteRepository> - <id>central</id> - <name>Central Repository</name> - <url>http://repo1.maven.org/maven2</url> - <layout>default</layout> - </remoteRepository> - <remoteRepository> - <id>maven2-repository.dev.java.net</id> - <name>Java.net Repository for Maven 2</name> - <url>https://maven2-repository.dev.java.net/nonav/repository</url> - <layout>default</layout> - <username></username> - <password></password> - </remoteRepository> - </remoteRepositories> - - <proxyConnectors> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>central</targetRepoId> - <proxyId/> - <policies> - <releases>ignored</releases> - <snapshots>disabled</snapshots> - <cache-failures>cached</cache-failures> - </policies> - </proxyConnector> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>maven2-repository.dev.java.net</targetRepoId> - <proxyId/> - <policies> - <releases>ignored</releases> - <snapshots>disabled</snapshots> - <cache-failures>cached</cache-failures> - </policies> - <whiteListPatterns> - <whiteListPattern>javax/**</whiteListPattern> - </whiteListPatterns> - </proxyConnector> - </proxyConnectors> - - <networkProxies> - <networkProxy> - <id>example</id> - <protocol>http</protocol> - <host>proxy.mycompany.com</host> - <port>8080</port> - <username>myself</username> - <password>mypass</password> - </networkProxy> - </networkProxies> - - <repositoryScanning> - <fileTypes> - <fileType> - <id>artifacts</id> - <patterns> - <pattern>**/*.pom</pattern> - <pattern>**/*.jar</pattern> - <pattern>**/*.ear</pattern> - <pattern>**/*.war</pattern> - <pattern>**/*.car</pattern> - <pattern>**/*.sar</pattern> - <pattern>**/*.mar</pattern> - <pattern>**/*.rar</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - <pattern>**/*.tar.gz</pattern> - <pattern>**/*.tar.bz2</pattern> - <pattern>**/*.zip</pattern> - </patterns> - </fileType> - <fileType> - <id>indexable-content</id> - <patterns> - <pattern>**/*.txt</pattern> - <pattern>**/*.TXT</pattern> - <pattern>**/*.block</pattern> - <pattern>**/*.config</pattern> - <pattern>**/*.pom</pattern> - <pattern>**/*.xml</pattern> - <pattern>**/*.xsd</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - </patterns> - </fileType> - <fileType> - <id>auto-remove</id> - <patterns> - <pattern>**/*.bak</pattern> - <pattern>**/*~</pattern> - <pattern>**/*-</pattern> - </patterns> - </fileType> - <fileType> - <id>ignored</id> - <patterns> - <pattern>**/.htaccess</pattern> - <pattern>**/KEYS</pattern> - <pattern>**/*.rb</pattern> - <pattern>**/*.sh</pattern> - <pattern>**/.svn/**</pattern> - <pattern>**/.DAV/**</pattern> - </patterns> - </fileType> - </fileTypes> - <knownContentConsumers> - <knownContentConsumer>update-db-artifact</knownContentConsumer> - <knownContentConsumer>create-missing-checksums</knownContentConsumer> - <knownContentConsumer>update-db-repository-metadata</knownContentConsumer> - <knownContentConsumer>validate-checksum</knownContentConsumer> - <knownContentConsumer>validate-signature</knownContentConsumer> - <knownContentConsumer>index-content</knownContentConsumer> - <knownContentConsumer>auto-remove</knownContentConsumer> - <knownContentConsumer>auto-rename</knownContentConsumer> - <knownContentConsumer>metadata-updater</knownContentConsumer> - </knownContentConsumers> - <invalidContentConsumers> - <invalidContentConsumer>update-db-bad-content</invalidContentConsumer> - </invalidContentConsumers> - </repositoryScanning> - - <databaseScanning> - <cronExpression>0 0 * * ?</cronExpression> - <unprocessedConsumers> - <unprocessedConsumer>index-artifact</unprocessedConsumer> - <unprocessedConsumer>update-db-project</unprocessedConsumer> - <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer> - <unprocessedConsumer>index-archive-toc</unprocessedConsumer> - <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> - <unprocessedConsumer>index-public-methods</unprocessedConsumer> - </unprocessedConsumers> - <cleanupConsumers> - <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> - <cleanupConsumer>not-present-remove-db-project</cleanupConsumer> - <cleanupConsumer>not-present-remove-indexed</cleanupConsumer> - </cleanupConsumers> - </databaseScanning> - - <webapp> - <ui> - <showFindArtifacts>true</showFindArtifacts> - <appletFindEnabled>true</appletFindEnabled> - </ui> - </webapp> - -</configuration> diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java deleted file mode 100644 index d96965c98..000000000 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java +++ /dev/null @@ -1,761 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.List; -import java.util.Map; - -import org.apache.commons.io.FileUtils; -import org.codehaus.plexus.registry.RegistryException; -import org.codehaus.plexus.spring.PlexusInSpringTestCase; -import org.custommonkey.xmlunit.XMLAssert; -import org.easymock.MockControl; - -/** - * Test the configuration store. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class ArchivaConfigurationTest - extends PlexusInSpringTestCase -{ - /** - * {@inheritDoc} - * @see org.codehaus.plexus.spring.PlexusInSpringTestCase#getSpringConfigLocation() - */ - protected String getSpringConfigLocation() - throws Exception - { - return "org/apache/maven/archiva/configuration/spring-context.xml"; - } - - public void testGetConfigurationFromRegistryWithASingleNamedConfigurationResource() - throws Exception - { - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-configuration" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertConfiguration( configuration ); - assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() ); - - ManagedRepositoryConfiguration repository = - (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 ); - - assertEquals( "check managed repositories", "${appserver.base}/repositories/internal", - repository.getLocation() ); - assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() ); - assertEquals( "check managed repositories", "internal", repository.getId() ); - assertEquals( "check managed repositories", "default", repository.getLayout() ); - assertTrue( "check managed repositories", repository.isScanned() ); - } - - public void testGetConfigurationFromDefaults() - throws Exception - { - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-defaults" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertConfiguration( configuration ); - assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() ); - - ManagedRepositoryConfiguration repository = - (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 ); - - assertEquals( "check managed repositories", "${appserver.base}/data/repositories/internal", - repository.getLocation() ); - assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() ); - assertEquals( "check managed repositories", "internal", repository.getId() ); - assertEquals( "check managed repositories", "default", repository.getLayout() ); - assertTrue( "check managed repositories", repository.isScanned() ); - } - - /** - * Ensures that the provided configuration matches the details present in the archiva-default.xml file. - */ - private void assertConfiguration( Configuration configuration ) - throws Exception - { - FileTypes filetypes = (FileTypes) lookup( FileTypes.class.getName() ); - - assertEquals( "check repositories", 2, configuration.getManagedRepositories().size() ); - assertEquals( "check repositories", 2, configuration.getRemoteRepositories().size() ); - assertEquals( "check proxy connectors", 2, configuration.getProxyConnectors().size() ); - - RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning(); - assertNotNull( "check repository scanning", repoScanning ); - assertEquals( "check file types", 4, repoScanning.getFileTypes().size() ); - assertEquals( "check known consumers", 9, repoScanning.getKnownContentConsumers().size() ); - assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() ); - - List<String> patterns = filetypes.getFileTypePatterns( "artifacts" ); - assertNotNull( "check 'artifacts' file type", patterns ); - assertEquals( "check 'artifacts' patterns", 13, patterns.size() ); - - DatabaseScanningConfiguration dbScanning = configuration.getDatabaseScanning(); - assertNotNull( "check database scanning", dbScanning ); - assertEquals( "check unprocessed consumers", 6, dbScanning.getUnprocessedConsumers().size() ); - assertEquals( "check cleanup consumers", 3, dbScanning.getCleanupConsumers().size() ); - - WebappConfiguration webapp = configuration.getWebapp(); - assertNotNull( "check webapp", webapp ); - - UserInterfaceOptions ui = webapp.getUi(); - assertNotNull( "check webapp ui", ui ); - assertTrue( "check showFindArtifacts", ui.isShowFindArtifacts() ); - assertTrue( "check appletFindEnabled", ui.isAppletFindEnabled() ); - } - - public void testGetConfigurationFromRegistryWithTwoConfigurationResources() - throws Exception - { - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-configuration-both" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - - // from base - assertEquals( "check repositories", 2, configuration.getManagedRepositories().size() ); - assertEquals( "check repositories", 2, configuration.getRemoteRepositories().size() ); - // from user - assertEquals( "check proxy connectors", 2, configuration.getProxyConnectors().size() ); - - WebappConfiguration webapp = configuration.getWebapp(); - assertNotNull( "check webapp", webapp ); - - UserInterfaceOptions ui = webapp.getUi(); - assertNotNull( "check webapp ui", ui ); - // from base - assertFalse( "check showFindArtifacts", ui.isShowFindArtifacts() ); - // from user - assertFalse( "check appletFindEnabled", ui.isAppletFindEnabled() ); - } - - public void testGetConfigurationSystemOverride() - throws Exception - { - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-configuration" ); - - System.setProperty( "org.apache.maven.archiva.webapp.ui.appletFindEnabled", "false" ); - - try - { - Configuration configuration = archivaConfiguration.getConfiguration(); - - assertFalse( "check boolean", configuration.getWebapp().getUi().isAppletFindEnabled() ); - } - finally - { - System.getProperties().remove( "org.apache.maven.archiva.webapp.ui.appletFindEnabled" ); - } - } - - public void testStoreConfiguration() - throws Exception - { - File file = getTestFile( "target/test/test-file.xml" ); - file.delete(); - assertFalse( file.exists() ); - - // TODO: remove with commons-configuration 1.4 - file.getParentFile().mkdirs(); - FileUtils.writeStringToFile( file, "<configuration/>", null ); - - DefaultArchivaConfiguration archivaConfiguration = - (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save" ); - - Configuration configuration = new Configuration(); - configuration.setVersion( "1" ); - configuration.setWebapp( new WebappConfiguration() ); - configuration.getWebapp().setUi( new UserInterfaceOptions() ); - configuration.getWebapp().getUi().setAppletFindEnabled( false ); - - // add a change listener - MockControl control = createConfigurationListenerMockControl(); - ConfigurationListener listener = (ConfigurationListener) control.getMock(); - archivaConfiguration.addListener( listener ); - - listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) ); - control.setVoidCallable(); - - control.replay(); - - archivaConfiguration.save( configuration ); - - control.verify(); - - assertTrue( "Check file exists", file.exists() ); - - // check it - configuration = archivaConfiguration.getConfiguration(); - assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - - // read it back - archivaConfiguration = - (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-read-saved" ); - configuration = archivaConfiguration.getConfiguration(); - assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - } - - private static MockControl createConfigurationListenerMockControl() - { - return MockControl.createControl( ConfigurationListener.class ); - } - - public void testStoreConfigurationUser() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - userFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( userFile, "<configuration/>", null ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); - - Configuration configuration = new Configuration(); - configuration.setWebapp( new WebappConfiguration() ); - configuration.getWebapp().setUi( new UserInterfaceOptions() ); - configuration.getWebapp().getUi().setAppletFindEnabled( false ); - - archivaConfiguration.save( configuration ); - - assertTrue( "Check file exists", userFile.exists() ); - assertFalse( "Check file not created", baseFile.exists() ); - - // check it - configuration = archivaConfiguration.getConfiguration(); - assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - } - - public void testStoreConfigurationLoadedFromDefaults() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); - - Configuration configuration = new Configuration(); - configuration.setWebapp( new WebappConfiguration() ); - configuration.getWebapp().setUi( new UserInterfaceOptions() ); - configuration.getWebapp().getUi().setAppletFindEnabled( false ); - - // add a change listener - MockControl control = createConfigurationListenerMockControl(); - ConfigurationListener listener = (ConfigurationListener) control.getMock(); - archivaConfiguration.addListener( listener ); - - listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) ); - // once from default creation, and again from manual call to save - control.setVoidCallable( 2 ); - - control.replay(); - - archivaConfiguration.save( configuration ); - - control.verify(); - - assertTrue( "Check file exists", userFile.exists() ); - assertFalse( "Check file not created", baseFile.exists() ); - - // check it - configuration = archivaConfiguration.getConfiguration(); - assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - } - - public void testDefaultUserConfigFilename() - throws Exception - { - DefaultArchivaConfiguration archivaConfiguration = - (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class.getName() ); - - assertEquals( System.getProperty( "user.home" ) + "/.m2/archiva.xml", - archivaConfiguration.getUserConfigFilename() ); - assertEquals( System.getProperty( "appserver.base", "${appserver.base}" ) + "/conf/archiva.xml", - archivaConfiguration.getAltConfigFilename() ); - } - - public void testStoreConfigurationFallback() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - baseFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( baseFile, "<configuration/>", null ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); - - Configuration configuration = new Configuration(); - configuration.setWebapp( new WebappConfiguration() ); - configuration.getWebapp().setUi( new UserInterfaceOptions() ); - configuration.getWebapp().getUi().setAppletFindEnabled( false ); - - archivaConfiguration.save( configuration ); - - assertTrue( "Check file exists", baseFile.exists() ); - assertFalse( "Check file not created", userFile.exists() ); - - // check it - configuration = archivaConfiguration.getConfiguration(); - assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - } - - public void testStoreConfigurationFailsWhenReadFromBothLocationsNoLists() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - baseFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( baseFile, "<configuration/>", null ); - - userFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( userFile, "<configuration/>", null ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - - configuration.getWebapp().getUi().setAppletFindEnabled( false ); - - archivaConfiguration.save( configuration ); - - assertTrue( "Check file exists", baseFile.exists() ); - assertEquals( "Check base file is unchanged", "<configuration/>", - FileUtils.readFileToString( baseFile, null ) ); - assertTrue( "Check file exists", userFile.exists() ); - assertFalse( "Check base file is changed", - "<configuration/>".equals( FileUtils.readFileToString( userFile, null ) ) ); - - // check it - configuration = archivaConfiguration.getConfiguration(); - assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - } - - public void testStoreConfigurationFailsWhenReadFromBothLocationsUserHasLists() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - userFile.getParentFile().mkdirs(); - FileUtils.copyFile( getTestFile( "src/test/conf/conf-user.xml" ), userFile ); - - baseFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( baseFile, "<configuration/>", null ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertTrue( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() ); - - configuration.getWebapp().getUi().setShowFindArtifacts( false ); - - archivaConfiguration.save( configuration ); - - assertTrue( "Check file exists", baseFile.exists() ); - assertEquals( "Check base file is unchanged", "<configuration/>", - FileUtils.readFileToString( baseFile, null ) ); - assertTrue( "Check file exists", userFile.exists() ); - assertFalse( "Check base file is changed", - "<configuration/>".equals( FileUtils.readFileToString( userFile, null ) ) ); - - // check it - configuration = archivaConfiguration.getConfiguration(); - assertFalse( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() ); - } - - public void testStoreConfigurationFailsWhenReadFromBothLocationsAppserverHasLists() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - baseFile.getParentFile().mkdirs(); - FileUtils.copyFile( getTestFile( "src/test/conf/conf-base.xml" ), baseFile ); - - userFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( userFile, "<configuration/>", null ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save-user" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - - configuration.getWebapp().getUi().setAppletFindEnabled( false ); - - try - { - archivaConfiguration.save( configuration ); - fail( "Configuration saving should not succeed if it was loaded from two locations" ); - } - catch ( IndeterminateConfigurationException e ) - { - // check it was reverted - configuration = archivaConfiguration.getConfiguration(); - assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() ); - } - } - - public void testLoadConfigurationFromInvalidBothLocationsOnDisk() - throws Exception - { - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-not-allowed-to-write-to-both" ); - Configuration config = archivaConfiguration.getConfiguration(); - - try - { - archivaConfiguration.save( config ); - fail( "Should have thrown a RegistryException because the configuration can't be saved." ); - } - catch ( RegistryException e ) - { - /* expected exception */ - } - } - - public void testLoadConfigurationFromInvalidUserLocationOnDisk() - throws Exception - { - File testConfDir = getTestFile( "target/test-appserver-base/conf/" ); - testConfDir.mkdirs(); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-not-allowed-to-write-to-user" ); - Configuration config = archivaConfiguration.getConfiguration(); - archivaConfiguration.save( config ); - // No Exception == test passes. - // Expected Path is: Should not have thrown an exception. - } - - public void testConfigurationUpgradeFrom09() - throws Exception - { - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-upgrade-09" ); - - // we just use the defaults when upgrading from 0.9 at this point. - Configuration configuration = archivaConfiguration.getConfiguration(); - assertConfiguration( configuration ); - assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() ); - - ManagedRepositoryConfiguration repository = - (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 ); - - assertEquals( "check managed repositories", "${appserver.base}/data/repositories/internal", - repository.getLocation() ); - assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() ); - assertEquals( "check managed repositories", "internal", repository.getId() ); - assertEquals( "check managed repositories", "default", repository.getLayout() ); - assertTrue( "check managed repositories", repository.isScanned() ); - } - - public void testAutoDetectV1() - throws Exception - { - // Setup the autodetect-v1.xml file in the target directory (so we can save/load it) - File userFile = getTestFile( "target/test-autodetect-v1/archiva-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - userFile.getParentFile().mkdirs(); - FileUtils.copyFile( getTestFile( "src/test/conf/autodetect-v1.xml" ), userFile ); - - // Load the original (unconverted) archiva.xml - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-autodetect-v1" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertConfiguration( configuration ); - assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() ); - - ManagedRepositoryConfiguration repository = - (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 ); - - assertEquals( "check managed repositories", "${appserver.base}/repositories/internal", - repository.getLocation() ); - assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() ); - assertEquals( "check managed repositories", "internal", repository.getId() ); - assertEquals( "check managed repositories", "default", repository.getLayout() ); - assertTrue( "check managed repositories", repository.isScanned() ); - - // Test that only 1 set of repositories exist. - assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositories().size() ); - assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositories().size() ); - assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() ); - - // Save the file. - archivaConfiguration.save( configuration ); - - // Release existing -// FIXME spring equivalent ? release( archivaConfiguration ); - - // Reload. - archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-autodetect-v1" ); - configuration = archivaConfiguration.getConfiguration(); - - // Test that only 1 set of repositories exist. - assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositories().size() ); - assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositoriesAsMap().size() ); - assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositories().size() ); - assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositoriesAsMap().size() ); - assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() ); - - String actualXML = FileUtils.readFileToString( userFile, null ); - XMLAssert.assertXpathNotExists( "//configuration/repositories/repository", actualXML ); - XMLAssert.assertXpathNotExists( "//configuration/repositories", actualXML ); - } - - public void testArchivaV1() - throws Exception - { - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-archiva-v1" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertConfiguration( configuration ); - assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() ); - - assertEquals( "check managed repositories", 2, configuration.getManagedRepositories().size() ); - assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() ); - - Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap(); - - ManagedRepositoryConfiguration repository = map.get( "internal" ); - assertEquals( "check managed repositories", "${appserver.base}/repositories/internal", - repository.getLocation() ); - assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() ); - assertEquals( "check managed repositories", "internal", repository.getId() ); - assertEquals( "check managed repositories", "default", repository.getLayout() ); - assertTrue( "check managed repositories", repository.isScanned() ); - assertFalse( "check managed repositories", repository.isSnapshots() ); - - repository = map.get( "snapshots" ); - assertEquals( "check managed repositories", "${appserver.base}/repositories/snapshots", - repository.getLocation() ); - assertEquals( "check managed repositories", "Archiva Managed Snapshot Repository", repository.getName() ); - assertEquals( "check managed repositories", "snapshots", repository.getId() ); - assertEquals( "check managed repositories", "default", repository.getLayout() ); - assertFalse( "check managed repositories", repository.isScanned() ); - assertTrue( "check managed repositories", repository.isSnapshots() ); - } - - public void testCronExpressionsWithComma() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - baseFile.getParentFile().mkdirs(); - FileUtils.copyFile( getTestFile( "src/test/conf/escape-cron-expressions.xml" ), baseFile ); - - userFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( userFile, "<configuration/>", null ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-cron-expressions" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - - ManagedRepositoryConfiguration repository = - (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 ); - - assertEquals( "check cron expression", "0 0,30 * * ?", repository.getRefreshCronExpression().trim() ); - - configuration.getDatabaseScanning().setCronExpression( "0 0,15 0 * * ?" ); - - archivaConfiguration.save( configuration ); - - configuration = archivaConfiguration.getConfiguration(); - - assertEquals( "check cron expression", "0 0,15 0 * * ?", - configuration.getDatabaseScanning().getCronExpression() ); - - // test for the escape character '\' showing up on repositories.jsp - repository.setRefreshCronExpression( "0 0,20 0 * * ?" ); - - archivaConfiguration.save( configuration ); - - repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( "snapshots" ); - - assertEquals( "check cron expression", "0 0,20 0 * * ?", repository.getRefreshCronExpression() ); - } - - public void testRemoveLastElements() - throws Exception - { - File baseFile = getTestFile( "target/test/test-file.xml" ); - baseFile.delete(); - assertFalse( baseFile.exists() ); - - File userFile = getTestFile( "target/test/test-file-user.xml" ); - userFile.delete(); - assertFalse( userFile.exists() ); - - baseFile.getParentFile().mkdirs(); - FileUtils.copyFile( getTestFile( "src/test/conf/conf-single-list-elements.xml" ), baseFile ); - - userFile.getParentFile().mkdirs(); - FileUtils.writeStringToFile( userFile, "<configuration/>", null ); - - ArchivaConfiguration archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-remove-central" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - - RemoteRepositoryConfiguration repository = configuration.getRemoteRepositoriesAsMap().get( "central" ); - assertNotNull( repository ); - configuration.removeRemoteRepository( repository ); - assertTrue( configuration.getRemoteRepositories().isEmpty() ); - - ManagedRepositoryConfiguration managedRepository = - configuration.getManagedRepositoriesAsMap().get( "snapshots" ); - assertNotNull( managedRepository ); - configuration.removeManagedRepository( managedRepository ); - assertTrue( configuration.getManagedRepositories().isEmpty() ); - - ProxyConnectorConfiguration proxyConnector = - (ProxyConnectorConfiguration) configuration.getProxyConnectors().get( 0 ); - assertNotNull( proxyConnector ); - configuration.removeProxyConnector( proxyConnector ); - assertTrue( configuration.getProxyConnectors().isEmpty() ); - - NetworkProxyConfiguration networkProxy = configuration.getNetworkProxiesAsMap().get( "proxy" ); - assertNotNull( networkProxy ); - configuration.removeNetworkProxy( networkProxy ); - assertTrue( configuration.getNetworkProxies().isEmpty() ); - - LegacyArtifactPath path = (LegacyArtifactPath) configuration.getLegacyArtifactPaths().get( 0 ); - assertNotNull( path ); - configuration.removeLegacyArtifactPath( path ); - assertTrue( configuration.getLegacyArtifactPaths().isEmpty() ); - - RepositoryScanningConfiguration scanning = configuration.getRepositoryScanning(); - String consumer = (String) scanning.getKnownContentConsumers().get( 0 ); - assertNotNull( consumer ); - scanning.removeKnownContentConsumer( consumer ); - assertTrue( scanning.getKnownContentConsumers().isEmpty() ); - consumer = (String) scanning.getInvalidContentConsumers().get( 0 ); - assertNotNull( consumer ); - scanning.removeInvalidContentConsumer( consumer ); - assertTrue( scanning.getInvalidContentConsumers().isEmpty() ); - - DatabaseScanningConfiguration databaseScanning = configuration.getDatabaseScanning(); - consumer = (String) databaseScanning.getCleanupConsumers().get( 0 ); - assertNotNull( consumer ); - databaseScanning.removeCleanupConsumer( consumer ); - assertTrue( databaseScanning.getCleanupConsumers().isEmpty() ); - consumer = (String) databaseScanning.getUnprocessedConsumers().get( 0 ); - assertNotNull( consumer ); - databaseScanning.removeUnprocessedConsumer( consumer ); - assertTrue( databaseScanning.getUnprocessedConsumers().isEmpty() ); - - archivaConfiguration.save( configuration ); - - archivaConfiguration = - (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-read-saved" ); - configuration = archivaConfiguration.getConfiguration(); - assertNull( configuration.getRemoteRepositoriesAsMap().get( "central" ) ); - assertNull( configuration.getManagedRepositoriesAsMap().get( "snapshots" ) ); - assertTrue( configuration.getProxyConnectors().isEmpty() ); - assertNull( configuration.getNetworkProxiesAsMap().get( "proxy" ) ); - assertTrue( configuration.getLegacyArtifactPaths().isEmpty() ); - scanning = configuration.getRepositoryScanning(); - assertTrue( scanning.getKnownContentConsumers().isEmpty() ); - assertTrue( scanning.getInvalidContentConsumers().isEmpty() ); - databaseScanning = configuration.getDatabaseScanning(); - assertTrue( databaseScanning.getCleanupConsumers().isEmpty() ); - assertTrue( databaseScanning.getUnprocessedConsumers().isEmpty() ); - } - - /** - * [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration. - */ - public void testGetConfigurationFixEmptyRemoteRepoUsernamePassword() - throws Exception - { - ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( - ArchivaConfiguration.class.getName(), - "test-configuration" ); - - Configuration configuration = archivaConfiguration.getConfiguration(); - assertConfiguration( configuration ); - assertEquals( "check remote repositories", 2, configuration.getRemoteRepositories().size() ); - - RemoteRepositoryConfiguration repository = (RemoteRepositoryConfiguration) configuration - .getRemoteRepositoriesAsMap().get( "maven2-repository.dev.java.net" ); - - assertEquals( "remote repository.url", "https://maven2-repository.dev.java.net/nonav/repository", repository.getUrl() ); - assertEquals( "remote repository.name", "Java.net Repository for Maven 2", repository.getName() ); - assertEquals( "remote repository.id", "maven2-repository.dev.java.net", repository.getId() ); - assertEquals( "remote repository.layout", "default", repository.getLayout() ); - assertNull( "remote repository.username == null", repository.getUsername() ); - assertNull( "remote repository.password == null", repository.getPassword() ); - } -} diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationTest.java deleted file mode 100644 index fa6699766..000000000 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationTest.java +++ /dev/null @@ -1,144 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import junit.framework.TestCase; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; - -/** - * Test the generated Configuration class from Modello. This is primarily to test the hand coded methods. - */ -public class ConfigurationTest - extends TestCase -{ - private Configuration configuration = new Configuration(); - - public void testNetworkProxyRetrieval() - { - NetworkProxyConfiguration proxy1 = createNetworkProxy( "id1", "host1", 8080 ); - configuration.addNetworkProxy( proxy1 ); - NetworkProxyConfiguration proxy2 = createNetworkProxy( "id2", "host2", 9090 ); - configuration.addNetworkProxy( proxy2 ); - - Map<String, NetworkProxyConfiguration> map = configuration.getNetworkProxiesAsMap(); - assertNotNull( map ); - assertEquals( 2, map.size() ); - assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() ); - assertEquals( new HashSet<NetworkProxyConfiguration>( Arrays.asList( proxy1, proxy2 ) ), - new HashSet<NetworkProxyConfiguration>( map.values() ) ); - } - - private NetworkProxyConfiguration createNetworkProxy( String id, String host, int port ) - { - NetworkProxyConfiguration proxy = new NetworkProxyConfiguration(); - proxy.setId( id ); - proxy.setHost( host ); - proxy.setPort( port ); - proxy.setProtocol( "http" ); - return proxy; - } - - public void testRemoteRepositoryRetrieval() - { - RemoteRepositoryConfiguration repo1 = createRemoteRepository( "id1", "name 1", "url 1" ); - configuration.addRemoteRepository( repo1 ); - RemoteRepositoryConfiguration repo2 = createRemoteRepository( "id2", "name 2", "url 2" ); - configuration.addRemoteRepository( repo2 ); - - Map<String, RemoteRepositoryConfiguration> map = configuration.getRemoteRepositoriesAsMap(); - assertNotNull( map ); - assertEquals( 2, map.size() ); - assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() ); - assertEquals( new HashSet<RemoteRepositoryConfiguration>( Arrays.asList( repo1, repo2 ) ), - new HashSet<RemoteRepositoryConfiguration>( map.values() ) ); - - assertEquals( repo1, configuration.findRemoteRepositoryById( "id1" ) ); - assertEquals( repo2, configuration.findRemoteRepositoryById( "id2" ) ); - assertNull( configuration.findRemoteRepositoryById( "id3" ) ); - } - - private RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url ) - { - RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration(); - repo.setId( id ); - repo.setName( name ); - repo.setLayout( "default" ); - repo.setUrl( url ); - return repo; - } - - public void testManagedRepositoryRetrieval() - { - ManagedRepositoryConfiguration repo1 = createManagedRepository( "id1", "name 1", "path 1", false ); - configuration.addManagedRepository( repo1 ); - ManagedRepositoryConfiguration repo2 = createManagedRepository( "id2", "name 2", "path 2", true ); - configuration.addManagedRepository( repo2 ); - - Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap(); - assertNotNull( map ); - assertEquals( 2, map.size() ); - assertEquals( new HashSet<String>( Arrays.asList( "id1", "id2" ) ), map.keySet() ); - assertEquals( new HashSet<ManagedRepositoryConfiguration>( Arrays.asList( repo1, repo2 ) ), - new HashSet<ManagedRepositoryConfiguration>( map.values() ) ); - - assertEquals( repo1, configuration.findManagedRepositoryById( "id1" ) ); - assertEquals( repo2, configuration.findManagedRepositoryById( "id2" ) ); - assertNull( configuration.findManagedRepositoryById( "id3" ) ); - } - - private ManagedRepositoryConfiguration createManagedRepository( String id, String name, String location, - boolean scanned ) - { - ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); - repo.setId( id ); - repo.setName( name ); - repo.setLocation( location ); - repo.setScanned( scanned ); - return repo; - } - - public void testNetworkProxyRetrievalWhenEmpty() - { - Map<String, NetworkProxyConfiguration> map = configuration.getNetworkProxiesAsMap(); - assertNotNull( map ); - assertTrue( map.isEmpty() ); - } - - public void testRemoteRepositoryRetrievalWhenEmpty() - { - Map<String, RemoteRepositoryConfiguration> map = configuration.getRemoteRepositoriesAsMap(); - assertNotNull( map ); - assertTrue( map.isEmpty() ); - - assertNull( configuration.findRemoteRepositoryById( "id" ) ); - } - - public void testManagedRepositoryRetrievalWhenEmpty() - { - Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap(); - assertNotNull( map ); - assertTrue( map.isEmpty() ); - - assertNull( configuration.findManagedRepositoryById( "id" ) ); - } -} diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/FileTypesTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/FileTypesTest.java deleted file mode 100644 index 6c5df3bf8..000000000 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/FileTypesTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.codehaus.plexus.spring.PlexusInSpringTestCase; - -public class FileTypesTest - extends PlexusInSpringTestCase -{ - private FileTypes filetypes; - - protected void setUp() - throws Exception - { - super.setUp(); - - filetypes = (FileTypes) lookup( FileTypes.class ); - } - - public void testIsArtifact() - { - assertTrue( filetypes.matchesArtifactPattern( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) ); - assertTrue( filetypes.matchesArtifactPattern( - "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) ); - assertTrue( filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz" ) ); - - assertFalse( - filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.sha1" ) ); - assertFalse( - filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.md5" ) ); - assertFalse( - filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.asc" ) ); - assertFalse( - filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.pgp" ) ); - assertFalse( filetypes.matchesArtifactPattern( "org/apache/derby/derby/10.2.2.0/maven-metadata.xml" ) ); - assertFalse( filetypes.matchesArtifactPattern( "org/apache/derby/derby/maven-metadata.xml" ) ); - } -} diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java deleted file mode 100644 index 528804a0a..000000000 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.maven.archiva.configuration;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-
-/**
- * Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods.
- * @since 1.1
- */
-public class LegacyArtifactPathTest
- extends TestCase
-{
-
- private LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath();
-
- public void testLegacyArtifactPathWithClassifierResolution()
- {
- legacyArtifactPath.setArtifact( "groupId:artifactId:version:classifier:type" );
-
- assertEquals( "groupId", legacyArtifactPath.getGroupId() );
- assertEquals( "artifactId", legacyArtifactPath.getArtifactId() );
- assertEquals( "version", legacyArtifactPath.getVersion() );
- assertEquals( "classifier", legacyArtifactPath.getClassifier() );
- assertEquals( "type", legacyArtifactPath.getType() );
- }
-
-
- public void testLegacyArtifactPathWithoutClassifierResolution()
- {
- legacyArtifactPath.setArtifact( "groupId:artifactId:version::type" );
-
- assertEquals( "groupId", legacyArtifactPath.getGroupId() );
- assertEquals( "artifactId", legacyArtifactPath.getArtifactId() );
- assertEquals( "version", legacyArtifactPath.getVersion() );
- assertNull( legacyArtifactPath.getClassifier() );
- assertEquals( "type", legacyArtifactPath.getType() );
- }
-}
diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java deleted file mode 100644 index 8bfc6e81d..000000000 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Map; -import java.util.Properties; - -import org.codehaus.plexus.spring.PlexusInSpringTestCase; - -/** - * @author Edwin Punzalan - */ -public class MavenProxyPropertyLoaderTest - extends PlexusInSpringTestCase -{ - private MavenProxyPropertyLoader loader; - - /** - * {@inheritDoc} - * @see org.codehaus.plexus.spring.PlexusInSpringTestCase#getSpringConfigLocation() - */ - protected String getSpringConfigLocation() - throws Exception - { - return "org/apache/maven/archiva/configuration/spring-context.xml"; - } - - public void testLoadValidMavenProxyConfiguration() - throws IOException, InvalidConfigurationException - { - File confFile = getTestFile( "src/test/conf/maven-proxy-complete.conf" ); - - Configuration configuration = new Configuration(); - NetworkProxyConfiguration proxy = new NetworkProxyConfiguration(); - proxy.setHost( "original-host" ); - configuration.addNetworkProxy( proxy ); // overwritten - - loader.load( new FileInputStream( confFile ), configuration ); - - Map<String, ManagedRepositoryConfiguration> repositoryIdMap = configuration.getManagedRepositoriesAsMap(); - assertEquals( "Count repositories", 1, repositoryIdMap.size() ); - assertRepositoryExists( "maven-proxy", "target", repositoryIdMap.get( "maven-proxy" ) ); - - Map<String, RemoteRepositoryConfiguration> remoteRepositoryMap = configuration.getRemoteRepositoriesAsMap(); - assertEquals( "Count repositories", 4, remoteRepositoryMap.size() ); - assertRepositoryExists( "local-repo", "file://target", remoteRepositoryMap.get( "local-repo" ) ); - assertRepositoryExists( "www-ibiblio-org", "http://www.ibiblio.org/maven2", - remoteRepositoryMap.get( "www-ibiblio-org" ) ); - assertRepositoryExists( "dist-codehaus-org", "http://dist.codehaus.org", - remoteRepositoryMap.get( "dist-codehaus-org" ) ); - assertRepositoryExists( "private-example-com", "http://private.example.com/internal", - remoteRepositoryMap.get( "private-example-com" ) ); - } - - private void assertRepositoryExists( String id, String expectedLocation, ManagedRepositoryConfiguration repo ) - { - assertNotNull( "Repository id [" + id + "] should not be null", repo ); - assertEquals( "Repository id", id, repo.getId() ); - assertEquals( "Repository url", expectedLocation, repo.getLocation() ); - } - - private void assertRepositoryExists( String id, String expectedUrl, RemoteRepositoryConfiguration repo ) - { - assertNotNull( "Repository id [" + id + "] should not be null", repo ); - assertEquals( "Repository id", id, repo.getId() ); - assertEquals( "Repository url", expectedUrl, repo.getUrl() ); - } - - public void testInvalidConfiguration() - { - Configuration configuration = new Configuration(); - try - { - loader.load( new Properties(), configuration ); - fail( "Incomplete config should have failed" ); - } - catch ( InvalidConfigurationException e ) - { - assertTrue( true ); - } - } - - protected void setUp() - throws Exception - { - super.setUp(); - loader = new MavenProxyPropertyLoader(); - } -} diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java deleted file mode 100644 index 9d1552b6a..000000000 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import junit.framework.TestCase; - -/** - * ProxyConnectorConfigurationOrderComparatorTest - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class ProxyConnectorConfigurationOrderComparatorTest - extends TestCase -{ - public void testSortOfAllZeros() - { - List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>(); - - proxies.add( createConnector( "corporate", 0 ) ); - proxies.add( createConnector( "snapshots", 0 ) ); - proxies.add( createConnector( "3rdparty", 0 ) ); - proxies.add( createConnector( "sandbox", 0 ) ); - - Collections.sort( proxies, ProxyConnectorConfigurationOrderComparator.getInstance() ); - - assertProxyOrder( new String[] { "corporate", "snapshots", "3rdparty", "sandbox" }, proxies ); - } - - public void testSortNormal() - { - List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>(); - - proxies.add( createConnector( "corporate", 3 ) ); - proxies.add( createConnector( "snapshots", 1 ) ); - proxies.add( createConnector( "3rdparty", 2 ) ); - proxies.add( createConnector( "sandbox", 4 ) ); - - Collections.sort( proxies, new ProxyConnectorConfigurationOrderComparator() ); - - assertProxyOrder( new String[] { "snapshots", "3rdparty", "corporate", "sandbox" }, proxies ); - } - - public void testSortPartial() - { - List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>(); - - proxies.add( createConnector( "corporate", 3 ) ); - proxies.add( createConnector( "snapshots", 0 ) ); - proxies.add( createConnector( "3rdparty", 2 ) ); - proxies.add( createConnector( "sandbox", 0 ) ); - - Collections.sort( proxies, new ProxyConnectorConfigurationOrderComparator() ); - - assertProxyOrder( new String[] { "3rdparty", "corporate", "snapshots", "sandbox" }, proxies ); - } - - private void assertProxyOrder( String[] ids, List<ProxyConnectorConfiguration> proxies ) - { - assertEquals( "Proxies.size() == ids.length", ids.length, proxies.size() ); - - int orderFailedAt = -1; - - for ( int i = 0; i < ids.length; i++ ) - { - if ( !StringUtils.equals( ids[i], proxies.get( i ).getProxyId() ) ) - { - orderFailedAt = i; - break; - } - } - - if ( orderFailedAt >= 0 ) - { - StringBuffer msg = new StringBuffer(); - - msg.append( "Failed expected order of the proxies <" ); - msg.append( StringUtils.join( ids, ", " ) ); - msg.append( ">, actual <" ); - - boolean needsComma = false; - for ( ProxyConnectorConfiguration proxy : proxies ) - { - if ( needsComma ) - { - msg.append( ", " ); - } - msg.append( proxy.getProxyId() ); - needsComma = true; - } - msg.append( "> failure at index <" ).append( orderFailedAt ).append( ">." ); - - fail( msg.toString() ); - } - } - - private ProxyConnectorConfiguration createConnector( String id, int order ) - { - ProxyConnectorConfiguration proxy = new ProxyConnectorConfiguration(); - proxy.setProxyId( id ); - proxy.setOrder( order ); - proxy.setSourceRepoId( id + "_m" ); - proxy.setTargetRepoId( id + "_r" ); - - return proxy; - } -} diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java deleted file mode 100644 index 3dd314842..000000000 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.apache.maven.archiva.configuration.functors; - -/* - * 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 junit.framework.TestCase; -import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration; -import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; - -import java.util.Comparator; - -/** - * Test the repositry comparator. - */ -public class RepositoryConfigurationComparatorTest - extends TestCase -{ - public void testComparator() - { - Comparator<AbstractRepositoryConfiguration> comparator = new RepositoryConfigurationComparator(); - - assertEquals( 0, comparator.compare( null, null ) ); - assertEquals( 1, comparator.compare( createRepository( "id" ), null ) ); - assertEquals( -1, comparator.compare( null, createRepository( "id" ) ) ); - assertEquals( 0, comparator.compare( createRepository( "id1" ), createRepository( "id1" ) ) ); - assertEquals( -1, comparator.compare( createRepository( "id1" ), createRepository( "id2" ) ) ); - assertEquals( 1, comparator.compare( createRepository( "id2" ), createRepository( "id1" ) ) ); - } - - private ManagedRepositoryConfiguration createRepository( String id ) - { - ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); - repo.setId( id ); - return repo; - } -} diff --git a/archiva-base/archiva-configuration/src/test/resources/log4j.properties b/archiva-base/archiva-configuration/src/test/resources/log4j.properties deleted file mode 100644 index 6d107570b..000000000 --- a/archiva-base/archiva-configuration/src/test/resources/log4j.properties +++ /dev/null @@ -1,10 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n - diff --git a/archiva-base/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.xml b/archiva-base/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.xml deleted file mode 100644 index 319fc4e32..000000000 --- a/archiva-base/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.xml +++ /dev/null @@ -1,474 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<component-set> - <components> - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-defaults</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>empty</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>empty</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-upgrade-09</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>upgrade-09</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>upgrade-09</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/src/test/conf/archiva-0.9.xml" - config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-configuration</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>configured</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>configured</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <system/> - <xml fileName="${basedir}/src/test/conf/repository-manager.xml" - config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-autodetect-v1</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>autodetect-v1</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>autodetect-v1</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <system/> - <xml fileName="${basedir}/target/test-autodetect-v1/archiva-user.xml" config-optional="true" - config-name="org.apache.maven.archiva.user" - config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-archiva-v1</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>archiva-v1</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>archiva-v1</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <system/> - <xml fileName="${basedir}/src/test/conf/archiva-v1.xml" - config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-save</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>save</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>save</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-save-user</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>save-user</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - <configuration> - <userConfigFilename>${basedir}/target/test/test-file-user.xml</userConfigFilename> - </configuration> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>save-user</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/target/test/test-file-user.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.user" config-at="org.apache.maven.archiva"/> - <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-configuration-both</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>configuration-both</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>configuration-both</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/src/test/conf/conf-user.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.user" config-at="org.apache.maven.archiva"/> - <xml fileName="${basedir}/src/test/conf/conf-base.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-read-saved</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>read-saved</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - <configuration> - <userConfigFilename>${basedir}/target/test/test-file.xml</userConfigFilename> - </configuration> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>read-saved</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-cron-expressions</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>cron-expressions</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - <configuration> - <userConfigFilename>${basedir}/target/test/test-file.xml</userConfigFilename> - </configuration> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>cron-expressions</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-remove-central</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>remove-central</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - <configuration> - <userConfigFilename>${basedir}/target/test/test-file.xml</userConfigFilename> - </configuration> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>remove-central</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true" - config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-not-allowed-to-write-to-both</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>not-allowed-to-write-to-both</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - <configuration> - <user-config-filename>${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml</user-config-filename> - <alt-config-filename>${basedir}/target/*intentionally:invalid*/conf/archiva.xml</alt-config-filename> - </configuration> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>not-allowed-to-write-to-both</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml" config-optional="true" - config-name="org.apache.maven.archiva.user" config-at="org.apache.maven.archiva"/> - <xml fileName="${basedir}/target/*intentionally:invalid*/conf/archiva.xml" config-optional="true" - config-name="org.apache.maven.archiva.user" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <role-hint>test-not-allowed-to-write-to-user</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>not-allowed-to-write-to-user</role-hint> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role> - <field-name>prePolicies</field-name> - </requirement> - <requirement> - <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role> - <field-name>postPolicies</field-name> - </requirement> - </requirements> - <configuration> - <user-config-filename>${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml</user-config-filename> - <alt-config-filename>${basedir}/target/test-appserver-base/conf/archiva.xml</alt-config-filename> - </configuration> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>not-allowed-to-write-to-user</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <xml fileName="${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml" config-optional="true" - config-name="org.apache.maven.archiva.user" config-at="org.apache.maven.archiva"/> - <xml fileName="${basedir}/target/test-appserver-base/conf/archiva.xml" config-optional="true" - config-name="org.apache.maven.archiva.user" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.codehaus.plexus.cache.Cache</role> - <role-hint>url-failures-cache</role-hint> - <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation> - <description>URL Failure Cache</description> - <configuration> - <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds> - <disk-persistent>false</disk-persistent> - <eternal>false</eternal> - <max-elements-in-memory>1000</max-elements-in-memory> - <memory-eviction-policy>LRU</memory-eviction-policy> - <name>cache</name> - <overflow-to-disk>false</overflow-to-disk> - <!-- 45 minutes = 2700 seconds --> - <time-to-idle-seconds>2700</time-to-idle-seconds> - <!-- 30 minutes = 1800 seconds --> - <time-to-live-seconds>1800</time-to-live-seconds> - </configuration> - </component> - </components> -</component-set> |