diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-11-01 06:21:26 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-11-01 06:21:26 +0000 |
commit | baf4c89435e946517008e02706d98029adebbdec (patch) | |
tree | 2ac4ceb5b2989411d612f700c8c2330e4d293390 | |
parent | 255949579d3ab36bf59eda5948cf28321db59e18 (diff) | |
download | archiva-baf4c89435e946517008e02706d98029adebbdec.tar.gz archiva-baf4c89435e946517008e02706d98029adebbdec.zip |
[MRM-547] proxy connectors: cache failures options are confusing
[MRM-549] proxy connectors: no "always" option for releases and snapshots policies
Applying changes to policy naming per decisions made in dev@archiva mailing list.
Updating DefaultArchivaConfiguration.load() to automatically adjust old configuration settings to new values.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@590908 13f79535-47bb-0310-9956-ffa450edef68
41 files changed, 667 insertions, 282 deletions
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 index 4ea345016..52701830c 100644 --- 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 @@ -19,10 +19,18 @@ package org.apache.maven.archiva.configuration; * under the License. */ +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.MapUtils; import org.apache.commons.io.FileUtils; 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; @@ -37,13 +45,16 @@ import org.codehaus.plexus.util.StringUtils; 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.Set; +import java.util.Map.Entry; /** * <p> @@ -87,9 +98,17 @@ public class DefaultArchivaConfiguration */ private Configuration configuration; - private static final String KEY = "org.apache.maven.archiva"; + /** + * @plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy" + */ + private Map<String, PreDownloadPolicy> prePolicies; /** + * @plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy" + */ + private Map<String, PostDownloadPolicy> postPolicies; + + /** * @plexus.configuration default-value="${user.home}/.m2/archiva.xml" */ private String userConfigFilename; @@ -115,6 +134,8 @@ public class DefaultArchivaConfiguration */ private boolean isConfigurationDefaulted = false; + private static final String KEY = "org.apache.maven.archiva"; + public synchronized Configuration getConfiguration() { if ( configuration == null ) @@ -176,9 +197,89 @@ public class DefaultArchivaConfiguration registry.removeSubset( KEY + ".repositories" ); } - // Normalize the order fields in the proxy connectors. 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. + getLogger().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(); @@ -200,6 +301,54 @@ public class DefaultArchivaConfiguration return config; } + private DownloadPolicy findPolicy( String policyId ) + { + if ( MapUtils.isEmpty( prePolicies ) ) + { + getLogger().error( "No PreDownloadPolicies found!" ); + return null; + } + + if ( MapUtils.isEmpty( postPolicies ) ) + { + getLogger().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 ) ) + { + getLogger().error( "No PreDownloadPolicies found!" ); + return false; + } + + if ( MapUtils.isEmpty( postPolicies ) ) + { + getLogger().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) @@ -288,7 +437,7 @@ public class DefaultArchivaConfiguration { // 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 ) ) { 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 index 33fdb51b3..e48b2d39a 100644 --- 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 @@ -107,7 +107,7 @@ public class MavenProxyPropertyLoader proxyConnector.setProxyId( proxyKey ); // TODO: convert cachePeriod to closest "daily" or "hourly" proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, SnapshotsPolicy.DAILY ); - proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, ReleasesPolicy.IGNORED ); + proxyConnector.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, ReleasesPolicy.ALWAYS ); configuration.addProxyConnector( proxyConnector ); } 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 index b0ca9d638..abd8baae5 100644 --- 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 @@ -29,6 +29,14 @@ <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> @@ -48,6 +56,14 @@ <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> @@ -71,6 +87,14 @@ <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> @@ -95,6 +119,14 @@ <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> @@ -120,6 +152,14 @@ <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> @@ -144,6 +184,14 @@ <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> @@ -167,6 +215,14 @@ <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> @@ -195,6 +251,14 @@ <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> @@ -220,6 +284,14 @@ <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> @@ -246,6 +318,14 @@ <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> @@ -272,6 +352,14 @@ <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> @@ -301,6 +389,14 @@ <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> @@ -320,6 +416,25 @@ </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> diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml index e5675fb12..8ccdc3b44 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml @@ -65,6 +65,14 @@ <role>org.codehaus.plexus.registry.Registry</role> <role-hint>retention-count</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> @@ -160,6 +168,14 @@ <role>org.codehaus.plexus.registry.Registry</role> <role-hint>days-old</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> diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml index 712381c1c..2c0dd53e1 100644 --- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml @@ -29,6 +29,14 @@ <role>org.codehaus.plexus.registry.Registry</role> <role-hint>database-cleanup</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> @@ -54,4 +62,4 @@ </requirements> </component> </components> -</component-set>
\ No newline at end of file +</component-set> diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml index 712381c1c..2c0dd53e1 100644 --- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml @@ -29,6 +29,14 @@ <role>org.codehaus.plexus.registry.Registry</role> <role-hint>database-cleanup</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> @@ -54,4 +62,4 @@ </requirements> </component> </components> -</component-set>
\ No newline at end of file +</component-set> diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.xml b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.xml index 99a7a2d9f..0c096a7c0 100644 --- a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.xml +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.xml @@ -55,6 +55,14 @@ <role>org.codehaus.plexus.registry.Registry</role> <role-hint>lucene-cleanup</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> diff --git a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java index 536bda9de..3f099e657 100644 --- a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java +++ b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java @@ -40,10 +40,14 @@ public abstract class AbstractUpdatePolicy implements PreDownloadPolicy { /** - * The DISABLED policy means that the artifact retrieval isn't even attempted, - * let alone updated locally. + * The ALWAYS policy setting means that the artifact is always uipdated from the remote repo. */ - public static final String DISABLED = "disabled"; + public static final String ALWAYS = "always"; + + /** + * The NEVER policy setting means that the artifact is never updated from the remote repo. + */ + public static final String NEVER = "never"; /** * <p> @@ -80,11 +84,11 @@ public abstract class AbstractUpdatePolicy public AbstractUpdatePolicy() { - options.add( IGNORED ); - options.add( DISABLED ); - options.add( DAILY ); + options.add( ALWAYS ); options.add( HOURLY ); + options.add( DAILY ); options.add( ONCE ); + options.add( NEVER ); } protected abstract boolean isSnapshotPolicy(); @@ -120,10 +124,10 @@ public abstract class AbstractUpdatePolicy + "], valid settings are [" + StringUtils.join( options.iterator(), "," ) + "]" ); } - if ( IGNORED.equals( policySetting ) ) + if ( ALWAYS.equals( policySetting ) ) { - // Ignored means ok to update. - getLogger().debug( "OK to update, " + getUpdateMode() + " policy set to IGNORED." ); + // Skip means ok to update. + getLogger().debug( "OK to update, " + getUpdateMode() + " policy set to ALWAYS." ); return; } @@ -140,10 +144,10 @@ public abstract class AbstractUpdatePolicy return; } - if ( DISABLED.equals( policySetting ) ) + if ( NEVER.equals( policySetting ) ) { - // Disabled means no. - throw new PolicyViolationException( "NO to update, " + getUpdateMode() + " policy set to DISABLED." ); + // Reject means no. + throw new PolicyViolationException( "NO to update, " + getUpdateMode() + " policy set to NEVER." ); } if ( !localFile.exists() ) diff --git a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/CachedFailuresPolicy.java b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/CachedFailuresPolicy.java index 46a0f3252..c7d44258c 100644 --- a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/CachedFailuresPolicy.java +++ b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/CachedFailuresPolicy.java @@ -41,11 +41,16 @@ public class CachedFailuresPolicy implements PreDownloadPolicy { /** - * The CACHED policy indicates that if the URL provided exists in the - * cached failures pool, then the policy fails, and the download isn't even - * attempted. + * The NO policy setting means that the the existence of old failures is <strong>not</strong> checked. + * All resource requests are allowed thru to the remote repo. */ - public static final String CACHED = "cached"; + public static final String NO = "no"; + + /** + * The YES policy setting means that the existence of old failures is checked, and will + * prevent the request from being performed against the remote repo. + */ + public static final String YES = "yes"; /** * @plexus.requirement role-hint="default" @@ -56,8 +61,8 @@ public class CachedFailuresPolicy public CachedFailuresPolicy() { - options.add( IGNORED ); - options.add( CACHED ); + options.add( NO ); + options.add( YES ); } public void applyPolicy( String policySetting, Properties request, File localFile ) @@ -70,10 +75,10 @@ public class CachedFailuresPolicy + "], valid settings are [" + StringUtils.join( options.iterator(), "," ) + "]" ); } - if ( IGNORED.equals( policySetting ) ) + if ( NO.equals( policySetting ) ) { - // Ignore. - getLogger().debug( "OK to fetch, check-failures policy set to IGNORED." ); + // Skip. + getLogger().debug( "OK to fetch, check-failures policy set to NO." ); return; } @@ -92,7 +97,7 @@ public class CachedFailuresPolicy public String getDefaultOption() { - return IGNORED; + return NO; } public String getId() diff --git a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ChecksumPolicy.java b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ChecksumPolicy.java index 2f80d5aa5..c86bbaaec 100644 --- a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ChecksumPolicy.java +++ b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ChecksumPolicy.java @@ -43,6 +43,13 @@ public class ChecksumPolicy implements PostDownloadPolicy { /** + * The IGNORE policy indicates that if the checksum policy is ignored, and + * the state of, contents of, or validity of the checksum files are not + * checked. + */ + public static final String IGNORE = "ignore"; + + /** * The FAIL policy indicates that if the checksum does not match the * downloaded file, then remove the downloaded artifact, and checksum * files, and fail the transfer to the client side. @@ -67,7 +74,7 @@ public class ChecksumPolicy { options.add( FAIL ); options.add( FIX ); - options.add( IGNORED ); + options.add( IGNORE ); } public void applyPolicy( String policySetting, Properties request, File localFile ) @@ -80,9 +87,10 @@ public class ChecksumPolicy + "], valid settings are [" + StringUtils.join( options.iterator(), "," ) + "]" ); } - if ( IGNORED.equals( policySetting ) ) + if ( IGNORE.equals( policySetting ) ) { // Ignore. + getLogger().debug( "Checksum policy set to IGNORE." ); return; } @@ -123,6 +131,7 @@ public class ChecksumPolicy { if( checksums.update( localFile ) ) { + getLogger().debug( "Checksum policy set to FIX, checksum files have been updated." ); return; } else diff --git a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/DownloadPolicy.java b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/DownloadPolicy.java index e9ff75319..6d506308d 100644 --- a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/DownloadPolicy.java +++ b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/DownloadPolicy.java @@ -32,14 +32,6 @@ import java.util.Properties; public interface DownloadPolicy { /** - * The IGNORED policy means that the policy is ignored. - */ - public static final String IGNORED = "ignored"; - - public static final boolean PASS = true; - public static final boolean FAIL = false; - - /** * Get the list of options for this policy. * * @return the list of options for this policy. diff --git a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ReleasesPolicy.java b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ReleasesPolicy.java index 724bf7992..8b53461a8 100644 --- a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ReleasesPolicy.java +++ b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ReleasesPolicy.java @@ -33,9 +33,12 @@ public class ReleasesPolicy extends AbstractUpdatePolicy implements PreDownloadPolicy { + /** + * Defaults to {@link AbstractUpdatePolicy#HOURLY} + */ public String getDefaultOption() { - return AbstractUpdatePolicy.IGNORED; + return AbstractUpdatePolicy.HOURLY; } protected boolean isSnapshotPolicy() diff --git a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/SnapshotsPolicy.java b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/SnapshotsPolicy.java index 62161a101..ffa903262 100644 --- a/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/SnapshotsPolicy.java +++ b/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/SnapshotsPolicy.java @@ -33,9 +33,12 @@ public class SnapshotsPolicy extends AbstractUpdatePolicy implements PreDownloadPolicy { + /** + * Defaults to {@link AbstractUpdatePolicy#HOURLY} + */ public String getDefaultOption() { - return AbstractUpdatePolicy.IGNORED; + return AbstractUpdatePolicy.HOURLY; } protected boolean isSnapshotPolicy() diff --git a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/CachedFailuresPolicyTest.java b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/CachedFailuresPolicyTest.java index 5d70a9db7..61e89ab3e 100644 --- a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/CachedFailuresPolicyTest.java +++ b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/CachedFailuresPolicyTest.java @@ -58,7 +58,7 @@ public class CachedFailuresPolicyTest return request; } - public void testIgnored() + public void testPolicyNo() throws Exception { DownloadPolicy policy = lookupPolicy(); @@ -67,10 +67,10 @@ public class CachedFailuresPolicyTest request.setProperty( "url", "http://a.bad.hostname.maven.org/path/to/resource.txt" ); - policy.applyPolicy( CachedFailuresPolicy.IGNORED, request, localFile ); + policy.applyPolicy( CachedFailuresPolicy.NO, request, localFile ); } - public void testCachedNotInCache() + public void testPolicyYesNotInCache() throws Exception { DownloadPolicy policy = lookupPolicy(); @@ -79,10 +79,10 @@ public class CachedFailuresPolicyTest request.setProperty( "url", "http://a.bad.hostname.maven.org/path/to/resource.txt" ); - policy.applyPolicy( CachedFailuresPolicy.CACHED, request, localFile ); + policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile ); } - public void testCachedInCache() + public void testPolicyYesInCache() throws Exception { UrlFailureCache urlFailureCache = lookupUrlFailureCache(); @@ -99,7 +99,7 @@ public class CachedFailuresPolicyTest try { - policy.applyPolicy( CachedFailuresPolicy.CACHED, request, localFile ); + policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile ); fail( "Expected a PolicyViolationException." ); } catch ( PolicyViolationException e ) diff --git a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java index 5c33317d5..a1d83d36f 100644 --- a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java +++ b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java @@ -148,14 +148,14 @@ public class ChecksumPolicyTest assertFixSetting( true, null, GOOD ); } - public void testIgnored() + public void testIgnore() throws Exception { PostDownloadPolicy policy = lookupPolicy(); File localFile = createTestableFiles( null, null ); Properties request = createRequest(); - policy.applyPolicy( ChecksumPolicy.IGNORED, request, localFile ); + policy.applyPolicy( ChecksumPolicy.IGNORE, request, localFile ); } private void assertFailSetting( boolean expectedResult, String md5State, String sha1State ) diff --git a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ReleasePolicyTest.java b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ReleasePolicyTest.java index 548693f4e..3ede659be 100644 --- a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ReleasePolicyTest.java +++ b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ReleasePolicyTest.java @@ -126,34 +126,34 @@ public class ReleasePolicyTest assertReleasesPolicy( ReleasesPolicy.DAILY, PATH_VERSION_METADATA, WITH_LOCAL ); } - public void testReleasePolicyDisabledProjectMetadata() + public void testReleasePolicyRejectProjectMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertReleasesPolicy( ReleasesPolicy.DISABLED, PATH_PROJECT_METADATA, NO_LOCAL ); - assertReleasesPolicy( ReleasesPolicy.DISABLED, PATH_PROJECT_METADATA, WITH_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.NEVER, PATH_PROJECT_METADATA, NO_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.NEVER, PATH_PROJECT_METADATA, WITH_LOCAL ); } - public void testReleasePolicyDisabledReleaseArtifact() + public void testReleasePolicyRejectReleaseArtifact() throws Exception { - assertReleasesPolicyViolation( ReleasesPolicy.DISABLED, PATH_RELEASE_ARTIFACT, NO_LOCAL ); - assertReleasesPolicyViolation( ReleasesPolicy.DISABLED, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); + assertReleasesPolicyViolation( ReleasesPolicy.NEVER, PATH_RELEASE_ARTIFACT, NO_LOCAL ); + assertReleasesPolicyViolation( ReleasesPolicy.NEVER, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); } - public void testReleasePolicyDisabledSnapshotArtifact() + public void testReleasePolicyRejectSnapshotArtifact() throws Exception { - assertReleasesPolicy( ReleasesPolicy.DISABLED, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); - assertReleasesPolicy( ReleasesPolicy.DISABLED, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.NEVER, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.NEVER, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); } - public void testReleasePolicyDisabledVersionedMetadata() + public void testReleasePolicyRejectVersionedMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertReleasesPolicy( ReleasesPolicy.DISABLED, PATH_VERSION_METADATA, NO_LOCAL ); - assertReleasesPolicy( ReleasesPolicy.DISABLED, PATH_VERSION_METADATA, WITH_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.NEVER, PATH_VERSION_METADATA, NO_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.NEVER, PATH_VERSION_METADATA, WITH_LOCAL ); } public void testReleasePolicyHourlyProjectMetadata() @@ -218,34 +218,34 @@ public class ReleasePolicyTest assertReleasesPolicy( ReleasesPolicy.HOURLY, PATH_VERSION_METADATA, WITH_LOCAL ); } - public void testReleasePolicyIgnoredProjectMetadata() + public void testReleasePolicyAlwaysProjectMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_PROJECT_METADATA, NO_LOCAL ); - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_PROJECT_METADATA, WITH_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_PROJECT_METADATA, NO_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_PROJECT_METADATA, WITH_LOCAL ); } - public void testReleasePolicyIgnoredReleaseArtifact() + public void testReleasePolicyAlwaysReleaseArtifact() throws Exception { - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_RELEASE_ARTIFACT, NO_LOCAL ); - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_RELEASE_ARTIFACT, NO_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); } - public void testReleasePolicyIgnoredSnapshotArtifact() + public void testReleasePolicyAlwaysSnapshotArtifact() throws Exception { - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); } - public void testReleasePolicyIgnoredVersionedMetadata() + public void testReleasePolicyAlwaysVersionedMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_VERSION_METADATA, NO_LOCAL ); - assertReleasesPolicy( ReleasesPolicy.IGNORED, PATH_VERSION_METADATA, WITH_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_VERSION_METADATA, NO_LOCAL ); + assertReleasesPolicy( ReleasesPolicy.ALWAYS, PATH_VERSION_METADATA, WITH_LOCAL ); } public void testReleasePolicyOnceProjectMetadata() diff --git a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/SnapshotsPolicyTest.java b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/SnapshotsPolicyTest.java index 96f6bd899..0879a7ea8 100644 --- a/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/SnapshotsPolicyTest.java +++ b/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/SnapshotsPolicyTest.java @@ -126,34 +126,34 @@ public class SnapshotsPolicyTest assertSnapshotPolicy( SnapshotsPolicy.DAILY, PATH_VERSION_METADATA, WITH_LOCAL ); } - public void testSnapshotPolicyDisabledProjectMetadata() + public void testSnapshotPolicyRejectProjectMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertSnapshotPolicy( SnapshotsPolicy.DISABLED, PATH_PROJECT_METADATA, NO_LOCAL ); - assertSnapshotPolicy( SnapshotsPolicy.DISABLED, PATH_PROJECT_METADATA, WITH_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.NEVER, PATH_PROJECT_METADATA, NO_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.NEVER, PATH_PROJECT_METADATA, WITH_LOCAL ); } - public void testSnapshotPolicyDisabledReleaseArtifact() + public void testSnapshotPolicyRejectReleaseArtifact() throws Exception { - assertSnapshotPolicy( SnapshotsPolicy.DISABLED, PATH_RELEASE_ARTIFACT, NO_LOCAL ); - assertSnapshotPolicy( SnapshotsPolicy.DISABLED, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.NEVER, PATH_RELEASE_ARTIFACT, NO_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.NEVER, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); } - public void testSnapshotPolicyDisabledSnapshotArtifact() + public void testSnapshotPolicyRejectSnapshotArtifact() throws Exception { - assertSnapshotPolicyViolation( SnapshotsPolicy.DISABLED, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); - assertSnapshotPolicyViolation( SnapshotsPolicy.DISABLED, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); + assertSnapshotPolicyViolation( SnapshotsPolicy.NEVER, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); + assertSnapshotPolicyViolation( SnapshotsPolicy.NEVER, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); } - public void testSnapshotPolicyDisabledVersionedMetadata() + public void testSnapshotPolicyRejectVersionedMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertSnapshotPolicy( SnapshotsPolicy.DISABLED, PATH_VERSION_METADATA, NO_LOCAL ); - assertSnapshotPolicy( SnapshotsPolicy.DISABLED, PATH_VERSION_METADATA, WITH_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.NEVER, PATH_VERSION_METADATA, NO_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.NEVER, PATH_VERSION_METADATA, WITH_LOCAL ); } public void testSnapshotPolicyHourlyProjectMetadata() @@ -218,34 +218,34 @@ public class SnapshotsPolicyTest assertSnapshotPolicy( SnapshotsPolicy.HOURLY, PATH_VERSION_METADATA, WITH_LOCAL ); } - public void testSnapshotPolicyIgnoredProjectMetadata() + public void testSnapshotPolicyAlwaysProjectMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_PROJECT_METADATA, NO_LOCAL ); - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_PROJECT_METADATA, WITH_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_PROJECT_METADATA, NO_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_PROJECT_METADATA, WITH_LOCAL ); } - public void testSnapshotPolicyIgnoredReleaseArtifact() + public void testSnapshotPolicyAlwaysReleaseArtifact() throws Exception { - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_RELEASE_ARTIFACT, NO_LOCAL ); - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_RELEASE_ARTIFACT, NO_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_RELEASE_ARTIFACT, WITH_LOCAL ); } - public void testSnapshotPolicyIgnoredSnapshotArtifact() + public void testSnapshotPolicyAlwaysSnapshotArtifact() throws Exception { - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_SNAPSHOT_ARTIFACT, NO_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_SNAPSHOT_ARTIFACT, WITH_LOCAL ); } - public void testSnapshotPolicyIgnoredVersionedMetadata() + public void testSnapshotPolicyAlwaysVersionedMetadata() throws Exception { // Pass the policy when working with metadata, no matter what. - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_VERSION_METADATA, NO_LOCAL ); - assertSnapshotPolicy( SnapshotsPolicy.IGNORED, PATH_VERSION_METADATA, WITH_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_VERSION_METADATA, NO_LOCAL ); + assertSnapshotPolicy( SnapshotsPolicy.ALWAYS, PATH_VERSION_METADATA, WITH_LOCAL ); } public void testSnapshotPolicyOnceProjectMetadata() diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java index fa0d7c13d..8527ade4f 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java @@ -298,8 +298,8 @@ public abstract class AbstractProxyTestCase protected void saveConnector( String sourceRepoId, String targetRepoId ) { - saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); } protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java index 270c59f93..bcb774640 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java @@ -56,10 +56,10 @@ public class CacheFailuresTransferTest saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://bad.machine.com/repo/", "default" ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.CACHED ); - saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.CACHED ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); wagonMock.get( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) ); wagonMockControl.setThrowable( new ResourceDoesNotExistException( "resource does not exist." ), 2 ); @@ -91,10 +91,10 @@ public class CacheFailuresTransferTest saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://bad.machine.com/repo/", "default" ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); wagonMock.get( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) ); wagonMockControl.setThrowable( new ResourceDoesNotExistException( "resource does not exist." ), 2 ); @@ -126,10 +126,10 @@ public class CacheFailuresTransferTest failurlCache.cacheFailure( url ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.CACHED ); - saveConnector( ID_DEFAULT_MANAGED, "proxied2", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.CACHED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + saveConnector( ID_DEFAULT_MANAGED, "proxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java index cbf84282f..e51447ec3 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java @@ -52,8 +52,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -77,8 +77,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -102,8 +102,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -126,8 +126,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -150,8 +150,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -174,8 +174,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -196,8 +196,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -221,8 +221,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -243,8 +243,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -268,8 +268,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -290,8 +290,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -315,8 +315,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -340,8 +340,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -365,8 +365,8 @@ public class ChecksumTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -393,8 +393,8 @@ public class ChecksumTransferTest saveRemoteRepositoryConfig( "badproxied", "Bad Proxied", "test://bad.machine.com/repo/", "default" ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); wagonMock.get( path, new File( expectedFile.getAbsolutePath() + ".tmp" ) ); wagonMockControl.setVoidCallable(); @@ -436,8 +436,8 @@ public class ChecksumTransferTest ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -462,8 +462,8 @@ public class ChecksumTransferTest ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FAIL, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -488,8 +488,8 @@ public class ChecksumTransferTest ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java index e90c6c2ee..1564cc55f 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java @@ -54,7 +54,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, - CachedFailuresPolicy.IGNORED ); + CachedFailuresPolicy.NO ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -85,7 +85,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, - CachedFailuresPolicy.IGNORED ); + CachedFailuresPolicy.NO ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -128,8 +128,8 @@ public class ManagedDefaultTransferTest assertTrue( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -172,8 +172,8 @@ public class ManagedDefaultTransferTest assertTrue( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -204,7 +204,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.DAILY, SnapshotsPolicy.DAILY, - CachedFailuresPolicy.IGNORED ); + CachedFailuresPolicy.NO ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java index b7a9301a9..662897857 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java @@ -79,8 +79,8 @@ public class ManagedLegacyTransferTest ArtifactReference artifact = managedLegacyRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java index e224b79c9..a4459d6c1 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java @@ -142,10 +142,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -168,10 +168,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -194,8 +194,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -216,10 +216,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertProjectMetadataContents( requestedResource, new String[] { "1.0" }, null, null ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -242,10 +242,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertProjectMetadataContents( requestedResource, new String[] { "1.0-beta-2" }, null, null ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -270,8 +270,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertProjectMetadataContents( requestedResource, new String[] { "1.0.8", "1.0.22" }, null, null ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -343,10 +343,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -373,8 +373,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceNotFound( requestedResource ); @@ -400,8 +400,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -427,8 +427,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertReleaseMetadataContents( requestedResource ); @@ -453,10 +453,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertReleaseMetadataContents( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -484,8 +484,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertReleaseMetadataContents( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -535,10 +535,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -560,8 +560,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertNoMetadata( requestedResource ); @@ -581,8 +581,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceNotFound( requestedResource ); @@ -601,10 +601,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertSnapshotMetadataContents( requestedResource, "20070822", "021008", 3 ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -626,10 +626,10 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertResourceExists( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -652,8 +652,8 @@ public class MetadataTransferTest setupTestableManagedRepository( requestedResource ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); assertSnapshotMetadataContents( requestedResource, "20050831", "101112", 1 ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java index d182e1089..23a36e6c2 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java @@ -50,8 +50,7 @@ public class SnapshotTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); assertNotDownloaded( downloadedFile ); @@ -71,8 +70,7 @@ public class SnapshotTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -94,8 +92,7 @@ public class SnapshotTransferTest expectedFile.setLastModified( getPastDate().getTime() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -210,8 +207,7 @@ public class SnapshotTransferTest proxiedFile.setLastModified( getFutureDate().getTime() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -234,8 +230,7 @@ public class SnapshotTransferTest ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -257,10 +252,10 @@ public class SnapshotTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.CACHED ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.CACHED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -282,8 +277,7 @@ public class SnapshotTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -309,8 +303,7 @@ public class SnapshotTransferTest expectedFile.setLastModified( getPastDate().getTime() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED, - SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java index 0bec4a919..223238da2 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java @@ -24,7 +24,10 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; import org.apache.maven.archiva.model.ProjectReference; import org.apache.maven.archiva.model.VersionedReference; -import org.apache.maven.archiva.policies.DownloadPolicy; +import org.apache.maven.archiva.policies.CachedFailuresPolicy; +import org.apache.maven.archiva.policies.ChecksumPolicy; +import org.apache.maven.archiva.policies.ReleasesPolicy; +import org.apache.maven.archiva.policies.SnapshotsPolicy; import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase; import org.apache.maven.archiva.repository.ManagedRepositoryContent; import org.apache.maven.archiva.repository.MockConfiguration; @@ -484,10 +487,10 @@ public class MetadataToolsTest ProxyConnectorConfiguration connectorConfig = new ProxyConnectorConfiguration(); connectorConfig.setSourceRepoId( sourceRepoId ); connectorConfig.setTargetRepoId( targetRepoId ); - connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, DownloadPolicy.IGNORED ); - connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, DownloadPolicy.IGNORED ); - connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, DownloadPolicy.IGNORED ); - connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, DownloadPolicy.IGNORED ); + connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, ChecksumPolicy.IGNORE ); + connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, ReleasesPolicy.ALWAYS ); + connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, SnapshotsPolicy.ALWAYS ); + connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, CachedFailuresPolicy.NO ); int count = config.getConfiguration().getProxyConnectors().size(); config.getConfiguration().addProxyConnector( connectorConfig ); diff --git a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/content/RepositoryRequestTest.xml b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/content/RepositoryRequestTest.xml index 1d099487e..b77b71142 100644 --- a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/content/RepositoryRequestTest.xml +++ b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/content/RepositoryRequestTest.xml @@ -28,6 +28,14 @@ <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> diff --git a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.xml b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.xml index f8c35f489..11f6ff4af 100644 --- a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.xml +++ b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.xml @@ -28,6 +28,14 @@ <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> diff --git a/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseConsumersTest.xml b/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseConsumersTest.xml index 07ff811a5..c9e47bd41 100644 --- a/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseConsumersTest.xml +++ b/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseConsumersTest.xml @@ -10,6 +10,14 @@ <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> diff --git a/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseUpdaterTest.xml b/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseUpdaterTest.xml index 07ff811a5..c9e47bd41 100644 --- a/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseUpdaterTest.xml +++ b/archiva-database/src/test/resources/org/apache/maven/archiva/database/updater/DatabaseUpdaterTest.xml @@ -10,6 +10,14 @@ <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> diff --git a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml index c5e313fde..24e60e8fb 100644 --- a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml +++ b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml @@ -42,6 +42,14 @@ <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> diff --git a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml index cd6fbe9fb..f903ba33f 100644 --- a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml +++ b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml @@ -51,6 +51,14 @@ <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> diff --git a/archiva-web/archiva-webapp/pom.xml b/archiva-web/archiva-webapp/pom.xml index db05ca8fa..342dd6260 100644 --- a/archiva-web/archiva-webapp/pom.xml +++ b/archiva-web/archiva-webapp/pom.xml @@ -420,6 +420,7 @@ </roleDefaults> </configuration> </plugin> + <!-- <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> @@ -438,6 +439,7 @@ </execution> </executions> </plugin> + --> </plugins> </build> <profiles> diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java index e7c9118ca..a5cd1ba11 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java @@ -387,10 +387,11 @@ public class AddProxyConnectorActionTest connector.setSourceRepoId( "corporate" ); connector.setTargetRepoId( "central" ); - connector.getPolicies().put( "releases", ReleasesPolicy.IGNORED ); - connector.getPolicies().put( "snapshots", SnapshotsPolicy.DISABLED ); - connector.getPolicies().put( "checksum", ChecksumPolicy.FIX ); - connector.getPolicies().put( "cache-failures", CachedFailuresPolicy.IGNORED ); + // TODO: Set these options programatically via list of available policies. + connector.getPolicies().put( "releases", new ReleasesPolicy().getDefaultOption() ); + connector.getPolicies().put( "snapshots", new SnapshotsPolicy().getDefaultOption() ); + connector.getPolicies().put( "checksum", new ChecksumPolicy().getDefaultOption() ); + connector.getPolicies().put( "cache-failures", new CachedFailuresPolicy().getDefaultOption() ); } @Override diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java index c1dd465ad..f24918d68 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java @@ -390,10 +390,12 @@ public class EditProxyConnectorActionTest ProxyConnectorConfiguration connector = new ProxyConnectorConfiguration(); connector.setSourceRepoId( TEST_SOURCE_ID ); connector.setTargetRepoId( TEST_TARGET_ID ); - connector.getPolicies().put( "releases", ReleasesPolicy.IGNORED ); - connector.getPolicies().put( "snapshots", SnapshotsPolicy.DISABLED ); - connector.getPolicies().put( "checksum", ChecksumPolicy.FIX ); - connector.getPolicies().put( "cache-failures", CachedFailuresPolicy.IGNORED ); + + // TODO: Set these options programatically via list of available policies. + connector.getPolicies().put( "releases", new ReleasesPolicy().getDefaultOption() ); + connector.getPolicies().put( "snapshots", new SnapshotsPolicy().getDefaultOption() ); + connector.getPolicies().put( "checksum", new ChecksumPolicy().getDefaultOption() ); + connector.getPolicies().put( "cache-failures", new CachedFailuresPolicy().getDefaultOption() ); config.addProxyConnector( connector ); diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedTestCase.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedTestCase.java index 5d9088aa4..28a68977d 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedTestCase.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedTestCase.java @@ -167,8 +167,8 @@ public abstract class AbstractRepositoryServletProxiedTestCase connector.setTargetRepoId( remoteRepo.id ); connector.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, releasesPolicy ); connector.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, snapshotsPolicy ); - connector.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, ChecksumPolicy.IGNORED ); - connector.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, CachedFailuresPolicy.IGNORED ); + connector.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, ChecksumPolicy.IGNORE ); + connector.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, CachedFailuresPolicy.NO ); archivaConfiguration.getConfiguration().addProxyConnector( connector ); } @@ -218,17 +218,17 @@ public abstract class AbstractRepositoryServletProxiedTestCase protected void setupConnector( String repoId, RemoteRepoInfo remoteRepo ) { - setupConnector( repoId, remoteRepo, ReleasesPolicy.IGNORED, SnapshotsPolicy.IGNORED ); + setupConnector( repoId, remoteRepo, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS ); } protected void setupReleaseConnector( String managedRepoId, RemoteRepoInfo remoteRepo, String releasePolicy ) { - setupConnector( managedRepoId, remoteRepo, releasePolicy, SnapshotsPolicy.IGNORED ); + setupConnector( managedRepoId, remoteRepo, releasePolicy, SnapshotsPolicy.ALWAYS ); } protected void setupSnapshotConnector( String managedRepoId, RemoteRepoInfo remoteRepo, String snapshotsPolicy ) { - setupConnector( managedRepoId, remoteRepo, ReleasesPolicy.IGNORED, snapshotsPolicy ); + setupConnector( managedRepoId, remoteRepo, ReleasesPolicy.ALWAYS, snapshotsPolicy ); } protected void setupSnapshotsRemoteRepo() diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedPluginSnapshotPolicyTest.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedPluginSnapshotPolicyTest.java index 456f09945..7d252bb1d 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedPluginSnapshotPolicyTest.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedPluginSnapshotPolicyTest.java @@ -40,21 +40,21 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.IGNORED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ALWAYS, HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) ); } public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, HAS_MANAGED_COPY, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, HAS_MANAGED_COPY, ( OLDER * OVER_ONE_DAY ) ); } public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, NO_MANAGED_COPY ); + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY ); } public void testGetProxiedSnapshotsArtifactPolicyDailyFail() @@ -77,23 +77,23 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest ( OLDER * OVER_ONE_DAY ) ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledFail() + public void testGetProxiedSnapshotsArtifactPolicyRejectFail() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.NEVER, HAS_MANAGED_COPY ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledNoManagedContentFail() + public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.DISABLED, NO_MANAGED_COPY ); + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledPass() + public void testGetProxiedSnapshotsArtifactPolicyRejectPass() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.NEVER, HAS_MANAGED_COPY ); } diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java index 2e985e9cc..ebf944e1a 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java @@ -40,21 +40,21 @@ public class RepositoryServletProxiedReleasePolicyTest public void testGetProxiedReleaseArtifactPolicyAlwaysManagedNewer() throws Exception { - assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.IGNORED, HAS_MANAGED_COPY, + assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.ALWAYS, HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) ); } public void testGetProxiedReleaseArtifactPolicyAlwaysManagedOlder() throws Exception { - assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.IGNORED, HAS_MANAGED_COPY, + assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ALWAYS, HAS_MANAGED_COPY, ( OLDER * OVER_ONE_DAY ) ); } public void testGetProxiedReleaseArtifactPolicyAlwaysNoManagedContent() throws Exception { - assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.IGNORED, NO_MANAGED_COPY ); + assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ALWAYS, NO_MANAGED_COPY ); } public void testGetProxiedReleaseArtifactPolicyDailyFail() @@ -77,22 +77,22 @@ public class RepositoryServletProxiedReleasePolicyTest ( OLDER * OVER_ONE_DAY ) ); } - public void testGetProxiedReleaseArtifactPolicyDisabledFail() + public void testGetProxiedReleaseArtifactPolicyRejectFail() throws Exception { - assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.DISABLED, HAS_MANAGED_COPY ); + assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.NEVER, HAS_MANAGED_COPY ); } - public void testGetProxiedReleaseArtifactPolicyDisabledNoManagedContentFail() + public void testGetProxiedReleaseArtifactPolicyRejectNoManagedContentFail() throws Exception { - assertGetProxiedReleaseArtifactWithPolicy( EXPECT_NOT_FOUND, ReleasesPolicy.DISABLED, NO_MANAGED_COPY ); + assertGetProxiedReleaseArtifactWithPolicy( EXPECT_NOT_FOUND, ReleasesPolicy.NEVER, NO_MANAGED_COPY ); } - public void testGetProxiedReleaseArtifactPolicyDisabledPass() + public void testGetProxiedReleaseArtifactPolicyRejectPass() throws Exception { - assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.DISABLED, HAS_MANAGED_COPY ); + assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.NEVER, HAS_MANAGED_COPY ); } public void testGetProxiedReleaseArtifactPolicyHourlyFail() diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java index 2167955ff..7db24e4f9 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java @@ -40,21 +40,21 @@ public class RepositoryServletProxiedSnapshotPolicyTest public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.IGNORED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ALWAYS, HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) ); } public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, HAS_MANAGED_COPY, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, HAS_MANAGED_COPY, ( OLDER * OVER_ONE_DAY ) ); } public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, NO_MANAGED_COPY ); + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY ); } public void testGetProxiedSnapshotsArtifactPolicyDailyFail() @@ -77,23 +77,23 @@ public class RepositoryServletProxiedSnapshotPolicyTest ( OLDER * OVER_ONE_DAY ) ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledFail() + public void testGetProxiedSnapshotsArtifactPolicyRejectFail() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.NEVER, HAS_MANAGED_COPY ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledNoManagedContentFail() + public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.DISABLED, NO_MANAGED_COPY ); + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledPass() + public void testGetProxiedSnapshotsArtifactPolicyRejectPass() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.NEVER, HAS_MANAGED_COPY ); } diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java index fb4f8edc1..dbff0a725 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java @@ -40,21 +40,21 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.IGNORED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ALWAYS, HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) ); } public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, HAS_MANAGED_COPY, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, HAS_MANAGED_COPY, ( OLDER * OVER_ONE_DAY ) ); } public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, NO_MANAGED_COPY ); + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY ); } public void testGetProxiedSnapshotsArtifactPolicyDailyFail() @@ -77,23 +77,23 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest ( OLDER * OVER_ONE_DAY ) ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledFail() + public void testGetProxiedSnapshotsArtifactPolicyRejectFail() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.NEVER, HAS_MANAGED_COPY ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledNoManagedContentFail() + public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.DISABLED, NO_MANAGED_COPY ); + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY ); } - public void testGetProxiedSnapshotsArtifactPolicyDisabledPass() + public void testGetProxiedSnapshotsArtifactPolicyRejectPass() throws Exception { - assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED, + assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.NEVER, HAS_MANAGED_COPY ); } diff --git a/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml b/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml index beccf43c9..15ea6ed1a 100644 --- a/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml +++ b/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml @@ -40,6 +40,14 @@ <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> diff --git a/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml b/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml index 974e148d2..4f0ff5531 100644 --- a/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml +++ b/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml @@ -40,6 +40,14 @@ <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> |