]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1332] remove database scanning configuration and handle upgrade.
authorOlivier Lamy <olamy@apache.org>
Tue, 4 Oct 2011 21:14:27 +0000 (21:14 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 4 Oct 2011 21:14:27 +0000 (21:14 +0000)
ensure some consumers are here and remove db consumers.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1178954 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
archiva-modules/archiva-base/archiva-configuration/src/test/conf/archiva-1.3.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java
archiva-modules/archiva-base/archiva-configuration/src/test/resources/spring-context.xml

index f5ae2954054541feb001ef5a3aa508ae704d11c5..afa12c4fd9fae359b618966e4c04464ef21d55e8 100644 (file)
@@ -52,6 +52,7 @@ import javax.inject.Named;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -136,12 +137,12 @@ public class DefaultArchivaConfiguration
     /**
      * Configuration Listeners we've registered.
      */
-    private Set<ConfigurationListener> listeners = new HashSet<ConfigurationListener>();
+    private Set<ConfigurationListener> listeners = new HashSet<ConfigurationListener>( );
 
     /**
      * Registry Listeners we've registered.
      */
-    private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>();
+    private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>( );
 
     /**
      * Boolean to help determine if the configuration exists as a result of pulling in
@@ -151,16 +152,16 @@ public class DefaultArchivaConfiguration
 
     private static final String KEY = "org.apache.archiva";
 
-    public Configuration getConfiguration()
+    public Configuration getConfiguration( )
     {
-        return loadConfiguration();
+        return loadConfiguration( );
     }
 
-    private synchronized Configuration loadConfiguration()
+    private synchronized Configuration loadConfiguration( )
     {
         if ( configuration == null )
         {
-            configuration = load();
+            configuration = load( );
             configuration = unescapeExpressions( configuration );
             if ( isConfigurationDefaulted )
             {
@@ -172,113 +173,113 @@ public class DefaultArchivaConfiguration
     }
 
     @SuppressWarnings( "unchecked" )
-    private Configuration load()
+    private Configuration load( )
     {
         // TODO: should this be the same as section? make sure unnamed sections still work (eg, sys properties)
         Registry subset = registry.getSubset( KEY );
         if ( subset.getString( "version" ) == null )
         {
             // a little autodetection of v1, even if version is omitted (this was previously allowed)
-            if ( subset.getSubset( "repositoryScanning" ).isEmpty() )
+            if ( subset.getSubset( "repositoryScanning" ).isEmpty( ) )
             {
                 // only for empty, or v < 1
-                subset = readDefaultConfiguration();
+                subset = readDefaultConfiguration( );
             }
         }
 
-        Configuration config = new ConfigurationRegistryReader().read( subset );
+        Configuration config = new ConfigurationRegistryReader( ).read( subset );
 
-        config.getRepositoryGroups();
-        config.getRepositoryGroupsAsMap();
-        if ( !config.getRepositories().isEmpty() )
+        config.getRepositoryGroups( );
+        config.getRepositoryGroupsAsMap( );
+        if ( !config.getRepositories( ).isEmpty( ) )
         {
-            for ( Iterator<V1RepositoryConfiguration> i = config.getRepositories().iterator(); i.hasNext(); )
+            for ( Iterator<V1RepositoryConfiguration> i = config.getRepositories( ).iterator( ); i.hasNext( ); )
             {
-                V1RepositoryConfiguration r = i.next();
-                r.setScanned( r.isIndexed() );
+                V1RepositoryConfiguration r = i.next( );
+                r.setScanned( r.isIndexed( ) );
 
-                if ( StringUtils.startsWith( r.getUrl(), "file://" ) )
+                if ( StringUtils.startsWith( r.getUrl( ), "file://" ) )
                 {
-                    r.setLocation( r.getUrl().substring( 7 ) );
+                    r.setLocation( r.getUrl( ).substring( 7 ) );
                     config.addManagedRepository( r );
                 }
-                else if ( StringUtils.startsWith( r.getUrl(), "file:" ) )
+                else if ( StringUtils.startsWith( r.getUrl( ), "file:" ) )
                 {
-                    r.setLocation( r.getUrl().substring( 5 ) );
+                    r.setLocation( r.getUrl( ).substring( 5 ) );
                     config.addManagedRepository( r );
                 }
-                else if ( StringUtils.isEmpty( r.getUrl() ) )
+                else if ( StringUtils.isEmpty( r.getUrl( ) ) )
                 {
                     // in case of empty url we can consider it as a managed one
                     // check if location is null
                     //file://${appserver.base}/repositories/${id}
-                    if ( StringUtils.isEmpty( r.getLocation() ) )
+                    if ( StringUtils.isEmpty( r.getLocation( ) ) )
                     {
-                        r.setLocation( "file://${appserver.base}/repositories/" + r.getId() );
+                        r.setLocation( "file://${appserver.base}/repositories/" + r.getId( ) );
                     }
                     config.addManagedRepository( r );
                 }
                 else
                 {
-                    RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
-                    repo.setId( r.getId() );
-                    repo.setLayout( r.getLayout() );
-                    repo.setName( r.getName() );
-                    repo.setUrl( r.getUrl() );
+                    RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration( );
+                    repo.setId( r.getId( ) );
+                    repo.setLayout( r.getLayout( ) );
+                    repo.setName( r.getName( ) );
+                    repo.setUrl( r.getUrl( ) );
                     config.addRemoteRepository( repo );
                 }
             }
 
             // Prevent duplicate repositories from showing up.
-            config.getRepositories().clear();
+            config.getRepositories( ).clear( );
 
             registry.removeSubset( KEY + ".repositories" );
         }
 
-        if ( !CollectionUtils.isEmpty( config.getRemoteRepositories() ) )
+        if ( !CollectionUtils.isEmpty( config.getRemoteRepositories( ) ) )
         {
-            List<RemoteRepositoryConfiguration> remoteRepos = config.getRemoteRepositories();
+            List<RemoteRepositoryConfiguration> remoteRepos = config.getRemoteRepositories( );
             for ( RemoteRepositoryConfiguration repo : remoteRepos )
             {
                 // [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
-                if ( StringUtils.isBlank( repo.getUsername() ) )
+                if ( StringUtils.isBlank( repo.getUsername( ) ) )
                 {
                     repo.setUsername( null );
                 }
 
-                if ( StringUtils.isBlank( repo.getPassword() ) )
+                if ( StringUtils.isBlank( repo.getPassword( ) ) )
                 {
                     repo.setPassword( null );
                 }
             }
         }
 
-        if ( !config.getProxyConnectors().isEmpty() )
+        if ( !config.getProxyConnectors( ).isEmpty( ) )
         {
             // Fix Proxy Connector Settings.
 
-            List<ProxyConnectorConfiguration> proxyConnectorList = new ArrayList<ProxyConnectorConfiguration>();
+            List<ProxyConnectorConfiguration> proxyConnectorList = new ArrayList<ProxyConnectorConfiguration>( );
             // Create a copy of the list to read from (to prevent concurrent modification exceptions)
-            proxyConnectorList.addAll( config.getProxyConnectors() );
+            proxyConnectorList.addAll( config.getProxyConnectors( ) );
             // Remove the old connector list.
-            config.getProxyConnectors().clear();
+            config.getProxyConnectors( ).clear( );
 
             for ( ProxyConnectorConfiguration connector : proxyConnectorList )
             {
                 // Fix policies
                 boolean connectorValid = true;
 
-                Map<String, String> policies = new HashMap<String, String>();
+                Map<String, String> policies = new HashMap<String, String>( );
                 // Make copy of policies
-                policies.putAll( connector.getPolicies() );
+                policies.putAll( connector.getPolicies( ) );
                 // Clear out policies
-                connector.getPolicies().clear();
+                connector.getPolicies( ).clear( );
 
                 // Work thru policies. cleaning them up.
-                for ( Entry<String, String> entry : policies.entrySet() )
+                for ( Entry<String, String> entry : policies.entrySet( ) )
                 {
-                    String policyId = entry.getKey();
-                    String setting = entry.getValue();
+                    String policyId = entry.getKey( );
+                    String setting = entry.getValue( );
 
                     // Upgrade old policy settings.
                     if ( "releases".equals( policyId ) || "snapshots".equals( policyId ) )
@@ -316,9 +317,9 @@ public class DefaultArchivaConfiguration
                     {
                         Policy policy = findPolicy( policyId );
                         // Does option exist?
-                        if ( !policy.getOptions().contains( setting ) )
+                        if ( !policy.getOptions( ).contains( setting ) )
                         {
-                            setting = policy.getDefaultOption();
+                            setting = policy.getDefaultOption( );
                         }
                         connector.addPolicy( policyId, setting );
                     }
@@ -337,12 +338,12 @@ public class DefaultArchivaConfiguration
 
             // Normalize the order fields in the proxy connectors.
             Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap =
-                config.getProxyConnectorAsMap();
+                config.getProxyConnectorAsMap( );
 
-            for ( List<ProxyConnectorConfiguration> connectors : proxyConnectorMap.values() )
+            for ( List<ProxyConnectorConfiguration> connectors : proxyConnectorMap.values( ) )
             {
                 // Sort connectors by order field.
-                Collections.sort( connectors, ProxyConnectorConfigurationOrderComparator.getInstance() );
+                Collections.sort( connectors, ProxyConnectorConfigurationOrderComparator.getInstance( ) );
 
                 // Normalize the order field values.
                 int order = 1;
@@ -404,7 +405,7 @@ public class DefaultArchivaConfiguration
         return ( prePolicies.containsKey( policyId ) || postPolicies.containsKey( policyId ) );
     }
 
-    private Registry readDefaultConfiguration()
+    private Registry readDefaultConfiguration( )
     {
         // if it contains some old configuration, remove it (Archiva 0.9)
         registry.removeSubset( KEY );
@@ -433,23 +434,23 @@ public class DefaultArchivaConfiguration
             section = baseSection;
             if ( section == null )
             {
-                section = createDefaultConfigurationFile();
+                section = createDefaultConfigurationFile( );
             }
         }
         else if ( baseSection != null )
         {
-            Collection<String> keys = baseSection.getKeys();
+            Collection<String> keys = baseSection.getKeys( );
             boolean foundList = false;
-            for ( Iterator<String> i = keys.iterator(); i.hasNext() && !foundList; )
+            for ( Iterator<String> i = keys.iterator( ); i.hasNext( ) && !foundList; )
             {
-                String key = i.next();
+                String key = i.next( );
 
                 // a little aggressive with the repositoryScanning and databaseScanning - should be no need to split
                 // that configuration
-                if ( key.startsWith( "repositories" ) || key.startsWith( "proxyConnectors" )
-                    || key.startsWith( "networkProxies" ) || key.startsWith( "repositoryScanning" )
-                    || key.startsWith( "databaseScanning" ) || key.startsWith( "remoteRepositories" )
-                    || key.startsWith( "managedRepositories" ) || key.startsWith( "repositoryGroups" ) )
+                if ( key.startsWith( "repositories" ) || key.startsWith( "proxyConnectors" ) || key.startsWith(
+                    "networkProxies" ) || key.startsWith( "repositoryScanning" ) || key.startsWith(
+                    "remoteRepositories" ) || key.startsWith( "managedRepositories" ) || key.startsWith(
+                    "repositoryGroups" ) )
                 {
                     foundList = true;
                 }
@@ -468,45 +469,45 @@ public class DefaultArchivaConfiguration
         escapeCronExpressions( configuration );
 
         // [MRM-661] Due to a bug in the modello registry writer, we need to take these out by hand. They'll be put back by the writer.
-        if ( configuration.getManagedRepositories().isEmpty() && section != null )
+        if ( configuration.getManagedRepositories( ).isEmpty( ) && section != null )
         {
             section.removeSubset( "managedRepositories" );
         }
-        if ( configuration.getRemoteRepositories().isEmpty() && section != null )
+        if ( configuration.getRemoteRepositories( ).isEmpty( ) && section != null )
         {
             section.removeSubset( "remoteRepositories" );
 
         }
-        if ( configuration.getProxyConnectors().isEmpty() && section != null )
+        if ( configuration.getProxyConnectors( ).isEmpty( ) && section != null )
         {
             section.removeSubset( "proxyConnectors" );
         }
-        if ( configuration.getNetworkProxies().isEmpty() && section != null )
+        if ( configuration.getNetworkProxies( ).isEmpty( ) && section != null )
         {
             section.removeSubset( "networkProxies" );
         }
-        if ( configuration.getLegacyArtifactPaths().isEmpty() && section != null )
+        if ( configuration.getLegacyArtifactPaths( ).isEmpty( ) && section != null )
         {
             section.removeSubset( "legacyArtifactPaths" );
         }
-        if ( configuration.getRepositoryGroups().isEmpty() && section != null )
+        if ( configuration.getRepositoryGroups( ).isEmpty( ) && section != null )
         {
             section.removeSubset( "repositoryGroups" );
         }
-        if ( configuration.getRepositoryScanning() != null )
+        if ( configuration.getRepositoryScanning( ) != null )
         {
-            if ( configuration.getRepositoryScanning().getKnownContentConsumers().isEmpty() && section != null )
+            if ( configuration.getRepositoryScanning( ).getKnownContentConsumers( ).isEmpty( ) && section != null )
             {
                 section.removeSubset( "repositoryScanning.knownContentConsumers" );
             }
-            if ( configuration.getRepositoryScanning().getInvalidContentConsumers().isEmpty() && section != null )
+            if ( configuration.getRepositoryScanning( ).getInvalidContentConsumers( ).isEmpty( ) && section != null )
             {
                 section.removeSubset( "repositoryScanning.invalidContentConsumers" );
             }
         }
 
-        new ConfigurationRegistryWriter().write( configuration, section );
-        section.save();
+        new ConfigurationRegistryWriter( ).write( configuration, section );
+        section.save( );
 
         this.configuration = unescapeExpressions( configuration );
 
@@ -515,15 +516,15 @@ public class DefaultArchivaConfiguration
 
     private void escapeCronExpressions( Configuration configuration )
     {
-        for ( ManagedRepositoryConfiguration c : (List<ManagedRepositoryConfiguration>) configuration.getManagedRepositories() )
+        for ( ManagedRepositoryConfiguration c : (List<ManagedRepositoryConfiguration>) configuration.getManagedRepositories( ) )
         {
-            c.setRefreshCronExpression( escapeCronExpression( c.getRefreshCronExpression() ) );
+            c.setRefreshCronExpression( escapeCronExpression( c.getRefreshCronExpression( ) ) );
         }
 
 
     }
 
-    private Registry createDefaultConfigurationFile()
+    private Registry createDefaultConfigurationFile( )
         throws RegistryException
     {
         // TODO: may not be needed under commons-configuration 1.4 - check
@@ -551,7 +552,7 @@ public class DefaultArchivaConfiguration
 
         ( (CommonsConfigurationRegistry) registry ).setProperties( contents );
 
-        registry.initialize();
+        registry.initialize( );
 
         for ( RegistryListener regListener : registryListeners )
         {
@@ -561,7 +562,7 @@ public class DefaultArchivaConfiguration
         triggerEvent( ConfigurationEvent.SAVED );
 
         Registry section = registry.getSection( KEY + ".user" );
-        return section == null ? new CommonsConfigurationRegistry( new BaseConfiguration() ) : section;
+        return section == null ? new CommonsConfigurationRegistry( new BaseConfiguration( ) ) : section;
     }
 
     /**
@@ -581,10 +582,10 @@ public class DefaultArchivaConfiguration
         try
         {
             // Check parent directory (if it is declared)
-            if ( file.getParentFile() != null )
+            if ( file.getParentFile( ) != null )
             {
                 // Check that directory exists
-                if ( ( file.getParentFile().exists() == false ) || ( file.getParentFile().isDirectory() == false ) )
+                if ( ( file.getParentFile( ).exists( ) == false ) || ( file.getParentFile( ).isDirectory( ) == false ) )
                 {
                     // Directory to file must exist for file to be created
                     return false;
@@ -596,7 +597,7 @@ public class DefaultArchivaConfiguration
         }
         catch ( IOException e )
         {
-            log.error( "Unable to create " + filetype + " file: " + e.getMessage(), e );
+            log.error( "Unable to create " + filetype + " file: " + e.getMessage( ), e );
             return false;
         }
     }
@@ -653,7 +654,7 @@ public class DefaultArchivaConfiguration
     }
 
     @PostConstruct
-    public void initialize()
+    public void initialize( )
     {
 
         this.postPolicies = componentContainer.buildMapWithRole( PostDownloadPolicy.class );
@@ -661,8 +662,8 @@ public class DefaultArchivaConfiguration
         // Resolve expressions in the userConfigFilename and altConfigFilename
         try
         {
-            ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator();
-            expressionEvaluator.addExpressionSource( new SystemPropertyExpressionSource() );
+            ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator( );
+            expressionEvaluator.addExpressionSource( new SystemPropertyExpressionSource( ) );
             String userConfigFileNameSysProps = System.getProperty( "archiva.user.configFileName" );
             if ( StringUtils.isNotBlank( userConfigFileNameSysProps ) )
             {
@@ -673,7 +674,16 @@ public class DefaultArchivaConfiguration
                 userConfigFilename = expressionEvaluator.expand( userConfigFilename );
             }
             altConfigFilename = expressionEvaluator.expand( altConfigFilename );
-            loadConfiguration();
+            loadConfiguration( );
+            handleUpgradeConfiguration( );
+        }
+        catch ( IndeterminateConfigurationException e )
+        {
+            throw new RuntimeException( "failed during upgrade from previous version" + e.getMessage( ), e );
+        }
+        catch ( RegistryException e )
+        {
+            throw new RuntimeException( "failed during upgrade from previous version" + e.getMessage( ), e );
         }
         catch ( EvaluatorException e )
         {
@@ -683,18 +693,60 @@ public class DefaultArchivaConfiguration
         registry.addChangeListener( this );
     }
 
-    public void reload()
+    /**
+     * upgrade from 1.3
+     */
+    private void handleUpgradeConfiguration( )
+        throws RegistryException, IndeterminateConfigurationException
+    {
+
+        // remove database consumers
+        List<String> dbConsumers = Arrays.asList( "update-db-artifact", "update-db-repository-metadata" );
+        List<String> knowContentConsumers = new ArrayList<String>( );
+        for ( String knowContentConsumer : configuration.getRepositoryScanning( ).getKnownContentConsumers( ) )
+        {
+            if ( !dbConsumers.contains( knowContentConsumer ) )
+            {
+                knowContentConsumers.add( knowContentConsumer );
+            }
+        }
+
+        configuration.getRepositoryScanning( ).setKnownContentConsumers( knowContentConsumers );
+        save( configuration );
+
+        // ensure create-archiva-metadata is here
+        if ( !configuration.getRepositoryScanning( ).getKnownContentConsumers( ).contains( "create-archiva-metadata" ) )
+        {
+            knowContentConsumers =
+                new ArrayList<String>( configuration.getRepositoryScanning( ).getKnownContentConsumers( ) );
+            knowContentConsumers.add( "create-archiva-metadata" );
+            configuration.getRepositoryScanning( ).setKnownContentConsumers( knowContentConsumers );
+            save( configuration );
+        }
+
+        // ensure duplicate-artifacts is here
+        if ( !configuration.getRepositoryScanning( ).getKnownContentConsumers( ).contains( "duplicate-artifacts" ) )
+        {
+            knowContentConsumers =
+                new ArrayList<String>( configuration.getRepositoryScanning( ).getKnownContentConsumers( ) );
+            knowContentConsumers.add( "duplicate-artifacts" );
+            configuration.getRepositoryScanning( ).setKnownContentConsumers( knowContentConsumers );
+            save( configuration );
+        }
+    }
+
+    public void reload( )
     {
         this.configuration = null;
         try
         {
-            this.registry.initialize();
+            this.registry.initialize( );
         }
         catch ( RegistryException e )
         {
-            throw new ConfigurationRuntimeException( e.getMessage(), e );
+            throw new ConfigurationRuntimeException( e.getMessage( ), e );
         }
-        this.initialize();
+        this.initialize( );
     }
 
     public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
@@ -729,11 +781,11 @@ public class DefaultArchivaConfiguration
     private Configuration unescapeExpressions( Configuration config )
     {
         // TODO: for commons-configuration 1.3 only
-        for ( Iterator<ManagedRepositoryConfiguration> i = config.getManagedRepositories().iterator(); i.hasNext(); )
+        for ( Iterator<ManagedRepositoryConfiguration> i = config.getManagedRepositories( ).iterator( ); i.hasNext( ); )
         {
-            ManagedRepositoryConfiguration c = i.next();
-            c.setLocation( removeExpressions( c.getLocation() ) );
-            c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) );
+            ManagedRepositoryConfiguration c = i.next( );
+            c.setLocation( removeExpressions( c.getLocation( ) ) );
+            c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression( ) ) );
         }
 
         return config;
@@ -743,37 +795,37 @@ public class DefaultArchivaConfiguration
     {
         // additional check for [MRM-789], ensure that the location of the default repositories 
         // are not installed in the server installation        
-        for ( ManagedRepositoryConfiguration repo : (List<ManagedRepositoryConfiguration>) config.getManagedRepositories() )
+        for ( ManagedRepositoryConfiguration repo : (List<ManagedRepositoryConfiguration>) config.getManagedRepositories( ) )
         {
-            String repoPath = repo.getLocation();
+            String repoPath = repo.getLocation( );
             File repoLocation = new File( repoPath );
 
-            if ( repoLocation.exists() && repoLocation.isDirectory() && !repoPath.endsWith(
-                "data/repositories/" + repo.getId() ) )
+            if ( repoLocation.exists( ) && repoLocation.isDirectory( ) && !repoPath.endsWith(
+                "data/repositories/" + repo.getId( ) ) )
             {
-                repo.setLocation( repoPath + "/data/repositories/" + repo.getId() );
+                repo.setLocation( repoPath + "/data/repositories/" + repo.getId( ) );
             }
         }
 
         return config;
     }
 
-    public String getUserConfigFilename()
+    public String getUserConfigFilename( )
     {
         return userConfigFilename;
     }
 
-    public String getAltConfigFilename()
+    public String getAltConfigFilename( )
     {
         return altConfigFilename;
     }
 
-    public boolean isDefaulted()
+    public boolean isDefaulted( )
     {
         return this.isConfigurationDefaulted;
     }
 
-    public Registry getRegistry()
+    public Registry getRegistry( )
     {
         return registry;
     }
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/conf/archiva-1.3.xml b/archiva-modules/archiva-base/archiva-configuration/src/test/conf/archiva-1.3.xml
new file mode 100644 (file)
index 0000000..5d2a85d
--- /dev/null
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+<version>2</version>
+<repositoryScanning>
+<fileTypes>
+<fileType>
+<id>artifacts</id>
+<patterns>
+<pattern>**/*.pom</pattern>
+<pattern>**/*.jar</pattern>
+<pattern>**/*.ear</pattern>
+<pattern>**/*.war</pattern>
+<pattern>**/*.car</pattern>
+<pattern>**/*.sar</pattern>
+<pattern>**/*.mar</pattern>
+<pattern>**/*.rar</pattern>
+<pattern>**/*.dtd</pattern>
+<pattern>**/*.tld</pattern>
+<pattern>**/*.tar.gz</pattern>
+<pattern>**/*.tar.bz2</pattern>
+<pattern>**/*.zip</pattern>
+</patterns>
+</fileType>
+<fileType>
+<id>indexable-content</id>
+<patterns>
+<pattern>**/*.txt</pattern>
+<pattern>**/*.TXT</pattern>
+<pattern>**/*.block</pattern>
+<pattern>**/*.config</pattern>
+<pattern>**/*.pom</pattern>
+<pattern>**/*.xml</pattern>
+<pattern>**/*.xsd</pattern>
+<pattern>**/*.dtd</pattern>
+<pattern>**/*.tld</pattern>
+</patterns>
+</fileType>
+<fileType>
+<id>auto-remove</id>
+<patterns>
+<pattern>**/*.bak</pattern>
+<pattern>**/*~</pattern>
+<pattern>**/*-</pattern>
+</patterns>
+</fileType>
+<fileType>
+<id>ignored</id>
+<patterns>
+<pattern>**/.htaccess</pattern>
+<pattern>**/KEYS</pattern>
+<pattern>**/*.rb</pattern>
+<pattern>**/*.sh</pattern>
+<pattern>**/.svn/**</pattern>
+<pattern>**/.DAV/**</pattern>
+</patterns>
+</fileType>
+</fileTypes>
+<knownContentConsumers>
+<knownContentConsumer>update-db-artifact</knownContentConsumer>
+<knownContentConsumer>create-missing-checksums</knownContentConsumer>
+<knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+<knownContentConsumer>validate-checksum</knownContentConsumer>
+<knownContentConsumer>validate-signature</knownContentConsumer>
+<knownContentConsumer>index-content</knownContentConsumer>
+<knownContentConsumer>auto-remove</knownContentConsumer>
+<knownContentConsumer>auto-rename</knownContentConsumer>
+<knownContentConsumer>metadata-updater</knownContentConsumer>
+</knownContentConsumers>
+<invalidContentConsumers>
+<invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+</invalidContentConsumers>
+</repositoryScanning>
+<databaseScanning>
+<cronExpression>0 0 * * * ?</cronExpression>
+<unprocessedConsumers>
+<unprocessedConsumer>update-db-project</unprocessedConsumer>
+</unprocessedConsumers>
+<cleanupConsumers>
+<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+<cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+<cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+</cleanupConsumers>
+</databaseScanning>
+<managedRepositories>
+<managedRepository>
+<location>${appserver.base}/data/repositories/internal</location>
+<blockRedeployments>true</blockRedeployments>
+<daysOlder>30</daysOlder>
+<id>internal</id>
+<name>Archiva Managed Internal Repository</name>
+</managedRepository>
+<managedRepository>
+<location>${appserver.base}/data/repositories/snapshots</location>
+<releases>false</releases>
+<snapshots>true</snapshots>
+<refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression>
+<daysOlder>30</daysOlder>
+<id>snapshots</id>
+<name>Archiva Managed Snapshot Repository</name>
+</managedRepository>
+</managedRepositories>
+<remoteRepositories>
+<remoteRepository>
+<url>http://repo1.maven.org/maven2</url>
+<id>central</id>
+<name>Central Repository</name>
+</remoteRepository>
+<remoteRepository>
+<url>http://download.java.net/maven/2/</url>
+<id>maven2-repository.dev.java.net</id>
+<name>Java.net Repository for Maven 2</name>
+</remoteRepository>
+</remoteRepositories>
+<proxyConnectors>
+<proxyConnector>
+<order>1</order>
+<sourceRepoId>internal</sourceRepoId>
+<targetRepoId>central</targetRepoId>
+<proxyId/>
+<whiteListPatterns>
+<whiteListPattern>**/*</whiteListPattern>
+</whiteListPatterns>
+<policies>
+<releases>once</releases>
+<checksum>fix</checksum>
+<snapshots>never</snapshots>
+<cache-failures>yes</cache-failures>
+</policies>
+</proxyConnector>
+<proxyConnector>
+<order>2</order>
+<sourceRepoId>internal</sourceRepoId>
+<targetRepoId>maven2-repository.dev.java.net</targetRepoId>
+<proxyId/>
+<whiteListPatterns>
+<whiteListPattern>javax/**</whiteListPattern>
+<whiteListPattern>org/jvnet/**</whiteListPattern>
+<whiteListPattern>com/sun/**</whiteListPattern>
+</whiteListPatterns>
+<policies>
+<releases>once</releases>
+<checksum>fix</checksum>
+<snapshots>never</snapshots>
+<cache-failures>yes</cache-failures>
+</policies>
+</proxyConnector>
+</proxyConnectors>
+<legacyArtifactPaths>
+<legacyArtifactPath>
+<path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
+<artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
+</legacyArtifactPath>
+</legacyArtifactPaths>
+</configuration>
index 52d0d252e36bcee1681ffadbbebf2c8b06118407..a46a1a5b62b2de991b498ca75dba854b65fe71da 100644 (file)
@@ -29,6 +29,8 @@ import org.custommonkey.xmlunit.XMLAssert;
 import org.easymock.MockControl;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
@@ -46,12 +48,14 @@ public class ArchivaConfigurationTest
     extends TestCase
 {
 
+    private Logger log = LoggerFactory.getLogger( getClass( ) );
+
     @Inject
     private ComponentContainer componentContainer;
 
     public static File getTestFile( String path )
     {
-        return new File( FileUtil.getBasedir(), path );
+        return new File( FileUtil.getBasedir( ), path );
     }
 
     protected <T> T lookup( Class<T> clazz, String hint )
@@ -65,64 +69,64 @@ public class ArchivaConfigurationTest
     }
 
     @Test
-    public void testGetConfigurationFromRegistryWithASingleNamedConfigurationResource()
+    public void testGetConfigurationFromRegistryWithASingleNamedConfigurationResource( )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
         assertConfiguration( configuration, 2, 2, 2 );
-        assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() );
+        assertEquals( "check network proxies", 1, configuration.getNetworkProxies( ).size( ) );
 
-        ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+        ManagedRepositoryConfiguration repository = configuration.getManagedRepositories( ).get( 0 );
 
         assertEquals( "check managed repositories", "${appserver.base}/repositories/internal",
-                      repository.getLocation() );
-        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
-        assertEquals( "check managed repositories", "internal", repository.getId() );
-        assertEquals( "check managed repositories", "default", repository.getLayout() );
-        assertTrue( "check managed repositories", repository.isScanned() );
+                      repository.getLocation( ) );
+        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName( ) );
+        assertEquals( "check managed repositories", "internal", repository.getId( ) );
+        assertEquals( "check managed repositories", "default", repository.getLayout( ) );
+        assertTrue( "check managed repositories", repository.isScanned( ) );
     }
 
     @Test
-    public void testGetConfigurationFromDefaults()
+    public void testGetConfigurationFromDefaults( )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-defaults" );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
         assertConfiguration( configuration, 2, 1, 1 );
-        assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() );
+        assertEquals( "check network proxies", 0, configuration.getNetworkProxies( ).size( ) );
 
         ManagedRepositoryConfiguration repository =
-            (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 );
+            (ManagedRepositoryConfiguration) configuration.getManagedRepositories( ).get( 0 );
 
         assertEquals( "check managed repositories", "${appserver.base}/data/repositories/internal",
-                      repository.getLocation() );
-        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
-        assertEquals( "check managed repositories", "internal", repository.getId() );
-        assertEquals( "check managed repositories", "default", repository.getLayout() );
-        assertTrue( "check managed repositories", repository.isScanned() );
+                      repository.getLocation( ) );
+        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName( ) );
+        assertEquals( "check managed repositories", "internal", repository.getId( ) );
+        assertEquals( "check managed repositories", "default", repository.getLayout( ) );
+        assertTrue( "check managed repositories", repository.isScanned( ) );
     }
 
     // test for [MRM-789]
     @Test
-    public void testGetConfigurationFromDefaultsWithDefaultRepoLocationAlreadyExisting()
+    public void testGetConfigurationFromDefaultsWithDefaultRepoLocationAlreadyExisting( )
         throws Exception
     {
-        File repo = new File( FileUtil.getBasedir(), "/target/test-classes/existing_snapshots" );
-        repo.mkdirs();
+        File repo = new File( FileUtil.getBasedir( ), "/target/test-classes/existing_snapshots" );
+        repo.mkdirs( );
 
-        repo = new File( FileUtil.getBasedir(), "/target/test-classes/existing_internal" );
-        repo.mkdirs();
+        repo = new File( FileUtil.getBasedir( ), "/target/test-classes/existing_internal" );
+        repo.mkdirs( );
 
         String existingTestDefaultArchivaConfigFile = FileUtils.readFileToString(
             getTestFile( "target/test-classes/org/apache/archiva/configuration/test-default-archiva.xml" ) );
         existingTestDefaultArchivaConfigFile =
-            StringUtils.replace( existingTestDefaultArchivaConfigFile, "${appserver.base}", FileUtil.getBasedir() );
+            StringUtils.replace( existingTestDefaultArchivaConfigFile, "${appserver.base}", FileUtil.getBasedir( ) );
 
-        File generatedTestDefaultArchivaConfigFile = new File( FileUtil.getBasedir(),
+        File generatedTestDefaultArchivaConfigFile = new File( FileUtil.getBasedir( ),
                                                                "target/test-classes/org/apache/archiva/configuration/default-archiva.xml" );
 
         FileUtils.writeStringToFile( generatedTestDefaultArchivaConfigFile, existingTestDefaultArchivaConfigFile,
@@ -131,15 +135,15 @@ public class ArchivaConfigurationTest
         ArchivaConfiguration archivaConfiguration =
             lookup( ArchivaConfiguration.class, "test-defaults-default-repo-location-exists" );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
         assertConfiguration( configuration, 2, 1, 1 );
 
         ManagedRepositoryConfiguration repository =
-            (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 );
-        assertTrue( "check managed repositories", repository.getLocation().endsWith( "data/repositories/internal" ) );
+            (ManagedRepositoryConfiguration) configuration.getManagedRepositories( ).get( 0 );
+        assertTrue( "check managed repositories", repository.getLocation( ).endsWith( "data/repositories/internal" ) );
 
-        generatedTestDefaultArchivaConfigFile.delete();
-        assertFalse( generatedTestDefaultArchivaConfigFile.exists() );
+        generatedTestDefaultArchivaConfigFile.delete( );
+        assertFalse( generatedTestDefaultArchivaConfigFile.exists( ) );
     }
 
     private void assertConfiguration( Configuration configuration )
@@ -157,59 +161,59 @@ public class ArchivaConfigurationTest
     {
         FileTypes filetypes = lookup( FileTypes.class );
 
-        assertEquals( "check managed repositories: " + configuration.getManagedRepositories(), managedExpected,
-                      configuration.getManagedRepositories().size() );
-        assertEquals( "check remote repositories: " + configuration.getRemoteRepositories(), remoteExpected,
-                      configuration.getRemoteRepositories().size() );
-        assertEquals( "check proxy connectors:" + configuration.getProxyConnectors(), proxyConnectorExpected,
-                      configuration.getProxyConnectors().size() );
+        assertEquals( "check managed repositories: " + configuration.getManagedRepositories( ), managedExpected,
+                      configuration.getManagedRepositories( ).size( ) );
+        assertEquals( "check remote repositories: " + configuration.getRemoteRepositories( ), remoteExpected,
+                      configuration.getRemoteRepositories( ).size( ) );
+        assertEquals( "check proxy connectors:" + configuration.getProxyConnectors( ), proxyConnectorExpected,
+                      configuration.getProxyConnectors( ).size( ) );
 
-        RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning();
+        RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning( );
         assertNotNull( "check repository scanning", repoScanning );
-        assertEquals( "check file types", 4, repoScanning.getFileTypes().size() );
-        assertEquals( "check known consumers", 9, repoScanning.getKnownContentConsumers().size() );
-        assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() );
+        assertEquals( "check file types", 4, repoScanning.getFileTypes( ).size( ) );
+        assertEquals( "check known consumers", 9, repoScanning.getKnownContentConsumers( ).size( ) );
+        assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers( ).size( ) );
 
         List<String> patterns = filetypes.getFileTypePatterns( "artifacts" );
         assertNotNull( "check 'artifacts' file type", patterns );
-        assertEquals( "check 'artifacts' patterns", 13, patterns.size() );
+        assertEquals( "check 'artifacts' patterns", 13, patterns.size( ) );
 
-        WebappConfiguration webapp = configuration.getWebapp();
+        WebappConfiguration webapp = configuration.getWebapp( );
         assertNotNull( "check webapp", webapp );
 
-        UserInterfaceOptions ui = webapp.getUi();
+        UserInterfaceOptions ui = webapp.getUi( );
         assertNotNull( "check webapp ui", ui );
-        assertTrue( "check showFindArtifacts", ui.isShowFindArtifacts() );
-        assertTrue( "check appletFindEnabled", ui.isAppletFindEnabled() );
+        assertTrue( "check showFindArtifacts", ui.isShowFindArtifacts( ) );
+        assertTrue( "check appletFindEnabled", ui.isAppletFindEnabled( ) );
     }
 
     @Test
-    public void testGetConfigurationFromRegistryWithTwoConfigurationResources()
+    public void testGetConfigurationFromRegistryWithTwoConfigurationResources( )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration-both" );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
 
         // from base
-        assertEquals( "check repositories", 2, configuration.getManagedRepositories().size() );
-        assertEquals( "check repositories", 2, configuration.getRemoteRepositories().size() );
+        assertEquals( "check repositories", 2, configuration.getManagedRepositories( ).size( ) );
+        assertEquals( "check repositories", 2, configuration.getRemoteRepositories( ).size( ) );
         // from user
-        assertEquals( "check proxy connectors", 2, configuration.getProxyConnectors().size() );
+        assertEquals( "check proxy connectors", 2, configuration.getProxyConnectors( ).size( ) );
 
-        WebappConfiguration webapp = configuration.getWebapp();
+        WebappConfiguration webapp = configuration.getWebapp( );
         assertNotNull( "check webapp", webapp );
 
-        UserInterfaceOptions ui = webapp.getUi();
+        UserInterfaceOptions ui = webapp.getUi( );
         assertNotNull( "check webapp ui", ui );
         // from base
-        assertFalse( "check showFindArtifacts", ui.isShowFindArtifacts() );
+        assertFalse( "check showFindArtifacts", ui.isShowFindArtifacts( ) );
         // from user
-        assertFalse( "check appletFindEnabled", ui.isAppletFindEnabled() );
+        assertFalse( "check appletFindEnabled", ui.isAppletFindEnabled( ) );
     }
 
     @Test
-    public void testGetConfigurationSystemOverride()
+    public void testGetConfigurationSystemOverride( )
         throws Exception
     {
 
@@ -217,27 +221,27 @@ public class ArchivaConfigurationTest
 
         ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
         try
         {
-            Configuration configuration = archivaConfiguration.getConfiguration();
+            Configuration configuration = archivaConfiguration.getConfiguration( );
 
-            assertFalse( "check boolean", configuration.getWebapp().getUi().isAppletFindEnabled() );
+            assertFalse( "check boolean", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
         }
         finally
         {
-            System.getProperties().remove( "org.apache.archiva.webapp.ui.appletFindEnabled" );
+            System.getProperties( ).remove( "org.apache.archiva.webapp.ui.appletFindEnabled" );
         }
     }
 
     @Test
-    public void testStoreConfiguration()
+    public void testStoreConfiguration( )
         throws Exception
     {
         File file = getTestFile( "target/test/test-file.xml" );
-        file.delete();
-        assertFalse( file.exists() );
+        file.delete( );
+        assertFalse( file.exists( ) );
 
         // TODO: remove with commons-configuration 1.4
         //file.getParentFile().mkdirs();
@@ -246,286 +250,286 @@ public class ArchivaConfigurationTest
         DefaultArchivaConfiguration archivaConfiguration =
             (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = new Configuration();
+        Configuration configuration = new Configuration( );
         configuration.setVersion( "1" );
-        configuration.setWebapp( new WebappConfiguration() );
-        configuration.getWebapp().setUi( new UserInterfaceOptions() );
-        configuration.getWebapp().getUi().setAppletFindEnabled( false );
+        configuration.setWebapp( new WebappConfiguration( ) );
+        configuration.getWebapp( ).setUi( new UserInterfaceOptions( ) );
+        configuration.getWebapp( ).getUi( ).setAppletFindEnabled( false );
 
         // add a change listener
-        MockControl control = createConfigurationListenerMockControl();
-        ConfigurationListener listener = (ConfigurationListener) control.getMock();
+        MockControl control = createConfigurationListenerMockControl( );
+        ConfigurationListener listener = (ConfigurationListener) control.getMock( );
         archivaConfiguration.addListener( listener );
 
         listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
-        control.setVoidCallable();
+        control.setVoidCallable( );
 
-        control.replay();
+        control.replay( );
 
         archivaConfiguration.save( configuration );
 
-        control.verify();
+        control.verify( );
 
-        assertTrue( "Check file exists", file.exists() );
+        assertTrue( "Check file exists", file.exists( ) );
 
         // check it
-        configuration = archivaConfiguration.getConfiguration();
-        assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertFalse( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
 
         // read it back
         archivaConfiguration = (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-read-saved" );
 
-        archivaConfiguration.reload();
-        configuration = archivaConfiguration.getConfiguration();
-        assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        archivaConfiguration.reload( );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertFalse( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
     }
 
-    private static MockControl createConfigurationListenerMockControl()
+    private static MockControl createConfigurationListenerMockControl( )
     {
         return MockControl.createControl( ConfigurationListener.class );
     }
 
     @Test
-    public void testStoreConfigurationUser()
+    public void testStoreConfigurationUser( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        userFile.getParentFile().mkdirs();
+        userFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( userFile, "<configuration/>", null );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user" );
 
-        Configuration configuration = new Configuration();
-        configuration.setWebapp( new WebappConfiguration() );
-        configuration.getWebapp().setUi( new UserInterfaceOptions() );
-        configuration.getWebapp().getUi().setAppletFindEnabled( false );
+        Configuration configuration = new Configuration( );
+        configuration.setWebapp( new WebappConfiguration( ) );
+        configuration.getWebapp( ).setUi( new UserInterfaceOptions( ) );
+        configuration.getWebapp( ).getUi( ).setAppletFindEnabled( false );
 
         archivaConfiguration.save( configuration );
 
-        assertTrue( "Check file exists", userFile.exists() );
-        assertFalse( "Check file not created", baseFile.exists() );
+        assertTrue( "Check file exists", userFile.exists( ) );
+        assertFalse( "Check file not created", baseFile.exists( ) );
 
         // check it
-        configuration = archivaConfiguration.getConfiguration();
-        assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertFalse( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
     }
 
     @Test
-    public void testStoreConfigurationLoadedFromDefaults()
+    public void testStoreConfigurationLoadedFromDefaults( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user-defaults" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = new Configuration();
-        configuration.setWebapp( new WebappConfiguration() );
-        configuration.getWebapp().setUi( new UserInterfaceOptions() );
-        configuration.getWebapp().getUi().setAppletFindEnabled( false );
+        Configuration configuration = new Configuration( );
+        configuration.setWebapp( new WebappConfiguration( ) );
+        configuration.getWebapp( ).setUi( new UserInterfaceOptions( ) );
+        configuration.getWebapp( ).getUi( ).setAppletFindEnabled( false );
 
         // add a change listener
-        MockControl control = createConfigurationListenerMockControl();
-        ConfigurationListener listener = (ConfigurationListener) control.getMock();
+        MockControl control = createConfigurationListenerMockControl( );
+        ConfigurationListener listener = (ConfigurationListener) control.getMock( );
         archivaConfiguration.addListener( listener );
 
         listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
 
         control.setVoidCallable( 1 );
 
-        control.replay();
+        control.replay( );
 
         archivaConfiguration.save( configuration );
 
-        control.verify();
+        control.verify( );
 
-        assertTrue( "Check file exists", userFile.exists() );
-        assertFalse( "Check file not created", baseFile.exists() );
+        assertTrue( "Check file exists", userFile.exists( ) );
+        assertFalse( "Check file not created", baseFile.exists( ) );
 
         // check it
-        configuration = archivaConfiguration.getConfiguration();
-        assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertFalse( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
     }
 
     @Test
-    public void testDefaultUserConfigFilename()
+    public void testDefaultUserConfigFilename( )
         throws Exception
     {
         DefaultArchivaConfiguration archivaConfiguration =
             (DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "default" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
         assertEquals( System.getProperty( "user.home" ) + "/.m2/archiva.xml",
-                      archivaConfiguration.getUserConfigFilename() );
+                      archivaConfiguration.getUserConfigFilename( ) );
         assertEquals( System.getProperty( "appserver.base", "${appserver.base}" ) + "/conf/archiva.xml",
-                      archivaConfiguration.getAltConfigFilename() );
+                      archivaConfiguration.getAltConfigFilename( ) );
     }
 
     @Test
-    public void testStoreConfigurationFallback()
+    public void testStoreConfigurationFallback( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        baseFile.getParentFile().mkdirs();
+        baseFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( baseFile, "<configuration/>", null );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user-fallback" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = new Configuration();
-        configuration.setWebapp( new WebappConfiguration() );
-        configuration.getWebapp().setUi( new UserInterfaceOptions() );
-        configuration.getWebapp().getUi().setAppletFindEnabled( false );
+        Configuration configuration = new Configuration( );
+        configuration.setWebapp( new WebappConfiguration( ) );
+        configuration.getWebapp( ).setUi( new UserInterfaceOptions( ) );
+        configuration.getWebapp( ).getUi( ).setAppletFindEnabled( false );
 
         archivaConfiguration.save( configuration );
 
-        assertTrue( "Check file exists", baseFile.exists() );
-        assertFalse( "Check file not created", userFile.exists() );
+        assertTrue( "Check file exists", baseFile.exists( ) );
+        assertFalse( "Check file not created", userFile.exists( ) );
 
         // check it
-        configuration = archivaConfiguration.getConfiguration();
-        assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertFalse( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
     }
 
     @Test
-    public void testStoreConfigurationFailsWhenReadFromBothLocationsNoLists()
+    public void testStoreConfigurationFailsWhenReadFromBothLocationsNoLists( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        baseFile.getParentFile().mkdirs();
+        baseFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( baseFile, "<configuration/>", null );
 
-        userFile.getParentFile().mkdirs();
+        userFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( userFile, "<configuration/>", null );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
-        assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        Configuration configuration = archivaConfiguration.getConfiguration( );
+        assertTrue( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
 
-        configuration.getWebapp().getUi().setAppletFindEnabled( false );
+        configuration.getWebapp( ).getUi( ).setAppletFindEnabled( false );
 
         archivaConfiguration.save( configuration );
 
-        assertTrue( "Check file exists", baseFile.exists() );
+        assertTrue( "Check file exists", baseFile.exists( ) );
         assertEquals( "Check base file is unchanged", "<configuration/>",
                       FileUtils.readFileToString( baseFile, null ) );
-        assertTrue( "Check file exists", userFile.exists() );
+        assertTrue( "Check file exists", userFile.exists( ) );
         assertFalse( "Check base file is changed",
                      "<configuration/>".equals( FileUtils.readFileToString( userFile, null ) ) );
 
         // check it
-        configuration = archivaConfiguration.getConfiguration();
-        assertFalse( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertFalse( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
     }
 
     @Test
-    public void testStoreConfigurationFailsWhenReadFromBothLocationsUserHasLists()
+    public void testStoreConfigurationFailsWhenReadFromBothLocationsUserHasLists( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        userFile.getParentFile().mkdirs();
+        userFile.getParentFile( ).mkdirs( );
         FileUtils.copyFile( getTestFile( "src/test/conf/conf-user.xml" ), userFile );
 
-        baseFile.getParentFile().mkdirs();
+        baseFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( baseFile, "<configuration/>", null );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
-        assertTrue( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() );
+        Configuration configuration = archivaConfiguration.getConfiguration( );
+        assertTrue( "check value", configuration.getWebapp( ).getUi( ).isShowFindArtifacts( ) );
 
-        configuration.getWebapp().getUi().setShowFindArtifacts( false );
+        configuration.getWebapp( ).getUi( ).setShowFindArtifacts( false );
 
         archivaConfiguration.save( configuration );
 
-        assertTrue( "Check file exists", baseFile.exists() );
+        assertTrue( "Check file exists", baseFile.exists( ) );
         assertEquals( "Check base file is unchanged", "<configuration/>",
                       FileUtils.readFileToString( baseFile, null ) );
-        assertTrue( "Check file exists", userFile.exists() );
+        assertTrue( "Check file exists", userFile.exists( ) );
         assertFalse( "Check base file is changed",
                      "<configuration/>".equals( FileUtils.readFileToString( userFile, null ) ) );
 
         // check it
-        configuration = archivaConfiguration.getConfiguration();
-        assertFalse( "check value", configuration.getWebapp().getUi().isShowFindArtifacts() );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertFalse( "check value", configuration.getWebapp( ).getUi( ).isShowFindArtifacts( ) );
     }
 
     @Test
-    public void testStoreConfigurationFailsWhenReadFromBothLocationsAppserverHasLists()
+    public void testStoreConfigurationFailsWhenReadFromBothLocationsAppserverHasLists( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        baseFile.getParentFile().mkdirs();
+        baseFile.getParentFile( ).mkdirs( );
         FileUtils.copyFile( getTestFile( "src/test/conf/conf-base.xml" ), baseFile );
 
-        userFile.getParentFile().mkdirs();
+        userFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( userFile, "<configuration/>", null );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
-        assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+        Configuration configuration = archivaConfiguration.getConfiguration( );
+        assertTrue( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
 
-        configuration.getWebapp().getUi().setAppletFindEnabled( false );
+        configuration.getWebapp( ).getUi( ).setAppletFindEnabled( false );
 
         try
         {
@@ -535,18 +539,18 @@ public class ArchivaConfigurationTest
         catch ( IndeterminateConfigurationException e )
         {
             // check it was reverted
-            configuration = archivaConfiguration.getConfiguration();
-            assertTrue( "check value", configuration.getWebapp().getUi().isAppletFindEnabled() );
+            configuration = archivaConfiguration.getConfiguration( );
+            assertTrue( "check value", configuration.getWebapp( ).getUi( ).isAppletFindEnabled( ) );
         }
     }
 
     @Test
-    public void testLoadConfigurationFromInvalidBothLocationsOnDisk()
+    public void testLoadConfigurationFromInvalidBothLocationsOnDisk( )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-not-allowed-to-write-to-both" );
-        Configuration config = archivaConfiguration.getConfiguration();
+        Configuration config = archivaConfiguration.getConfiguration( );
 
         try
         {
@@ -560,76 +564,107 @@ public class ArchivaConfigurationTest
     }
 
     @Test
-    public void testLoadConfigurationFromInvalidUserLocationOnDisk()
+    public void testLoadConfigurationFromInvalidUserLocationOnDisk( )
         throws Exception
     {
         File testConfDir = getTestFile( "target/test-appserver-base/conf/" );
-        testConfDir.mkdirs();
+        testConfDir.mkdirs( );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-not-allowed-to-write-to-user" );
-        Configuration config = archivaConfiguration.getConfiguration();
+        Configuration config = archivaConfiguration.getConfiguration( );
         archivaConfiguration.save( config );
         // No Exception == test passes.
         // Expected Path is: Should not have thrown an exception.
     }
 
     @Test
-    public void testConfigurationUpgradeFrom09()
+    public void testConfigurationUpgradeFrom09( )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-upgrade-09" );
 
         // we just use the defaults when upgrading from 0.9 at this point.
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
         // test-upgrade-09 contains a managed with id: local so it's 3 managed
         assertConfiguration( configuration, 3, 1, 1 );
-        assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() );
+        assertEquals( "check network proxies", 0, configuration.getNetworkProxies( ).size( ) );
+
+        ManagedRepositoryConfiguration repository = configuration.getManagedRepositories( ).get( 0 );
+
+        assertEquals( "check managed repositories", "${appserver.base}/data/repositories/internal",
+                      repository.getLocation( ) );
+        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName( ) );
+        assertEquals( "check managed repositories", "internal", repository.getId( ) );
+        assertEquals( "check managed repositories", "default", repository.getLayout( ) );
+        assertTrue( "check managed repositories", repository.isScanned( ) );
+    }
+
+    @Test
+    public void testConfigurationUpgradeFrom13( )
+        throws Exception
+    {
+        ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-upgrade-1.3" );
+
+        // we just use the defaults when upgrading from 1.3 at this point.
+        Configuration configuration = archivaConfiguration.getConfiguration( );
+        assertConfiguration( configuration, 2, 2, 2 );
+        assertEquals( "check network proxies", 0, configuration.getNetworkProxies( ).size( ) );
 
-        ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+        ManagedRepositoryConfiguration repository = configuration.getManagedRepositories( ).get( 0 );
 
         assertEquals( "check managed repositories", "${appserver.base}/data/repositories/internal",
-                      repository.getLocation() );
-        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
-        assertEquals( "check managed repositories", "internal", repository.getId() );
-        assertEquals( "check managed repositories", "default", repository.getLayout() );
-        assertTrue( "check managed repositories", repository.isScanned() );
+                      repository.getLocation( ) );
+        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName( ) );
+        assertEquals( "check managed repositories", "internal", repository.getId( ) );
+        assertEquals( "check managed repositories", "default", repository.getLayout( ) );
+        assertTrue( "check managed repositories", repository.isScanned( ) );
+
+        log.info( "knowContentConsumers " + configuration.getRepositoryScanning( ).getKnownContentConsumers( ) );
+
+        assertFalse(
+            configuration.getRepositoryScanning( ).getKnownContentConsumers( ).contains( "update-db-artifact" ) );
+        assertFalse( configuration.getRepositoryScanning( ).getKnownContentConsumers( ).contains(
+            "update-db-repository-metadata" ) );
+
+        assertTrue(
+            configuration.getRepositoryScanning( ).getKnownContentConsumers( ).contains( "create-archiva-metadata" ) );
     }
 
     @Test
-    public void testAutoDetectV1()
+    public void testAutoDetectV1( )
         throws Exception
     {
         // Setup the autodetect-v1.xml file in the target directory (so we can save/load it)
         File userFile = getTestFile( "target/test-autodetect-v1/archiva-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        userFile.getParentFile().mkdirs();
+        userFile.getParentFile( ).mkdirs( );
         FileUtils.copyFile( getTestFile( "src/test/conf/autodetect-v1.xml" ), userFile );
 
         // Load the original (unconverted) archiva.xml
         ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-autodetect-v1" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
         assertConfiguration( configuration, 2, 2, 2 );
-        assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() );
+        assertEquals( "check network proxies", 1, configuration.getNetworkProxies( ).size( ) );
 
-        ManagedRepositoryConfiguration repository = configuration.getManagedRepositories().get( 0 );
+        ManagedRepositoryConfiguration repository = configuration.getManagedRepositories( ).get( 0 );
 
         assertEquals( "check managed repositories", "${appserver.base}/repositories/internal",
-                      repository.getLocation() );
-        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
-        assertEquals( "check managed repositories", "internal", repository.getId() );
-        assertEquals( "check managed repositories", "default", repository.getLayout() );
-        assertTrue( "check managed repositories", repository.isScanned() );
+                      repository.getLocation( ) );
+        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName( ) );
+        assertEquals( "check managed repositories", "internal", repository.getId( ) );
+        assertEquals( "check managed repositories", "default", repository.getLayout( ) );
+        assertTrue( "check managed repositories", repository.isScanned( ) );
 
         // Test that only 1 set of repositories exist.
-        assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositories().size() );
-        assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositories().size() );
-        assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() );
+        assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositories( ).size( ) );
+        assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositories( ).size( ) );
+        assertEquals( "check v1 repositories size.", 0, configuration.getRepositories( ).size( ) );
 
         // Save the file.
         archivaConfiguration.save( configuration );
@@ -639,14 +674,14 @@ public class ArchivaConfigurationTest
 
         // Reload.
         archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-autodetect-v1" );
-        configuration = archivaConfiguration.getConfiguration();
+        configuration = archivaConfiguration.getConfiguration( );
 
         // Test that only 1 set of repositories exist.
-        assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositories().size() );
-        assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositoriesAsMap().size() );
-        assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositories().size() );
-        assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositoriesAsMap().size() );
-        assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() );
+        assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositories( ).size( ) );
+        assertEquals( "check managed repositories size.", 2, configuration.getManagedRepositoriesAsMap( ).size( ) );
+        assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositories( ).size( ) );
+        assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositoriesAsMap( ).size( ) );
+        assertEquals( "check v1 repositories size.", 0, configuration.getRepositories( ).size( ) );
 
         String actualXML = FileUtils.readFileToString( userFile, null );
         XMLAssert.assertXpathNotExists( "//configuration/repositories/repository", actualXML );
@@ -654,199 +689,199 @@ public class ArchivaConfigurationTest
     }
 
     @Test
-    public void testArchivaV1()
+    public void testArchivaV1( )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-archiva-v1" );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
         assertConfiguration( configuration, 2, 2, 2 );
-        assertEquals( "check network proxies", 1, configuration.getNetworkProxies().size() );
+        assertEquals( "check network proxies", 1, configuration.getNetworkProxies( ).size( ) );
 
-        assertEquals( "check managed repositories", 2, configuration.getManagedRepositories().size() );
-        assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() );
+        assertEquals( "check managed repositories", 2, configuration.getManagedRepositories( ).size( ) );
+        assertEquals( "check v1 repositories size.", 0, configuration.getRepositories( ).size( ) );
 
-        Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap();
+        Map<String, ManagedRepositoryConfiguration> map = configuration.getManagedRepositoriesAsMap( );
 
         ManagedRepositoryConfiguration repository = map.get( "internal" );
         assertEquals( "check managed repositories", "${appserver.base}/repositories/internal",
-                      repository.getLocation() );
-        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName() );
-        assertEquals( "check managed repositories", "internal", repository.getId() );
-        assertEquals( "check managed repositories", "default", repository.getLayout() );
-        assertTrue( "check managed repositories", repository.isScanned() );
-        assertFalse( "check managed repositories", repository.isSnapshots() );
+                      repository.getLocation( ) );
+        assertEquals( "check managed repositories", "Archiva Managed Internal Repository", repository.getName( ) );
+        assertEquals( "check managed repositories", "internal", repository.getId( ) );
+        assertEquals( "check managed repositories", "default", repository.getLayout( ) );
+        assertTrue( "check managed repositories", repository.isScanned( ) );
+        assertFalse( "check managed repositories", repository.isSnapshots( ) );
 
         repository = map.get( "snapshots" );
         assertEquals( "check managed repositories", "${appserver.base}/repositories/snapshots",
-                      repository.getLocation() );
-        assertEquals( "check managed repositories", "Archiva Managed Snapshot Repository", repository.getName() );
-        assertEquals( "check managed repositories", "snapshots", repository.getId() );
-        assertEquals( "check managed repositories", "default", repository.getLayout() );
-        assertFalse( "check managed repositories", repository.isScanned() );
-        assertTrue( "check managed repositories", repository.isSnapshots() );
+                      repository.getLocation( ) );
+        assertEquals( "check managed repositories", "Archiva Managed Snapshot Repository", repository.getName( ) );
+        assertEquals( "check managed repositories", "snapshots", repository.getId( ) );
+        assertEquals( "check managed repositories", "default", repository.getLayout( ) );
+        assertFalse( "check managed repositories", repository.isScanned( ) );
+        assertTrue( "check managed repositories", repository.isSnapshots( ) );
     }
 
     @Test
-    public void testCronExpressionsWithComma()
+    public void testCronExpressionsWithComma( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        baseFile.getParentFile().mkdirs();
+        baseFile.getParentFile( ).mkdirs( );
         FileUtils.copyFile( getTestFile( "src/test/conf/escape-cron-expressions.xml" ), baseFile );
 
-        userFile.getParentFile().mkdirs();
+        userFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( userFile, "<configuration/>", null );
 
         final ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-cron-expressions" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
 
         ManagedRepositoryConfiguration repository =
-            (ManagedRepositoryConfiguration) configuration.getManagedRepositories().get( 0 );
+            (ManagedRepositoryConfiguration) configuration.getManagedRepositories( ).get( 0 );
 
-        assertEquals( "check cron expression", "0 0,30 * * * ?", repository.getRefreshCronExpression().trim() );
+        assertEquals( "check cron expression", "0 0,30 * * * ?", repository.getRefreshCronExpression( ).trim( ) );
 
         // add a test listener to confirm it doesn't see the escaped format. We don't need to test the number of calls,
         // etc. as it's done in other tests
-        archivaConfiguration.addListener( new ConfigurationListener()
+        archivaConfiguration.addListener( new ConfigurationListener( )
         {
             public void configurationEvent( ConfigurationEvent event )
             {
-                assertEquals( ConfigurationEvent.SAVED, event.getType() );
+                assertEquals( ConfigurationEvent.SAVED, event.getType( ) );
 
             }
         } );
 
         archivaConfiguration.save( configuration );
 
-        configuration = archivaConfiguration.getConfiguration();
+        configuration = archivaConfiguration.getConfiguration( );
 
         // test for the escape character '\' showing up on repositories.jsp
         repository.setRefreshCronExpression( "0 0,20 0 * * ?" );
 
         archivaConfiguration.save( configuration );
 
-        repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( "snapshots" );
+        repository = archivaConfiguration.getConfiguration( ).findManagedRepositoryById( "snapshots" );
 
-        assertEquals( "check cron expression", "0 0,20 0 * * ?", repository.getRefreshCronExpression() );
+        assertEquals( "check cron expression", "0 0,20 0 * * ?", repository.getRefreshCronExpression( ) );
     }
 
     @Test
-    public void testRemoveLastElements()
+    public void testRemoveLastElements( )
         throws Exception
     {
         File baseFile = getTestFile( "target/test/test-file.xml" );
-        baseFile.delete();
-        assertFalse( baseFile.exists() );
+        baseFile.delete( );
+        assertFalse( baseFile.exists( ) );
 
         File userFile = getTestFile( "target/test/test-file-user.xml" );
-        userFile.delete();
-        assertFalse( userFile.exists() );
+        userFile.delete( );
+        assertFalse( userFile.exists( ) );
 
-        baseFile.getParentFile().mkdirs();
+        baseFile.getParentFile( ).mkdirs( );
         FileUtils.copyFile( getTestFile( "src/test/conf/conf-single-list-elements.xml" ), baseFile );
 
-        userFile.getParentFile().mkdirs();
+        userFile.getParentFile( ).mkdirs( );
         FileUtils.writeStringToFile( userFile, "<configuration/>", null );
 
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-remove-central" );
 
-        archivaConfiguration.reload();
+        archivaConfiguration.reload( );
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        Configuration configuration = archivaConfiguration.getConfiguration( );
 
         RepositoryGroupConfiguration repositoryGroup =
-            (RepositoryGroupConfiguration) configuration.getRepositoryGroups().get( 0 );
+            (RepositoryGroupConfiguration) configuration.getRepositoryGroups( ).get( 0 );
         assertNotNull( repositoryGroup );
         configuration.removeRepositoryGroup( repositoryGroup );
-        assertTrue( configuration.getRepositoryGroups().isEmpty() );
+        assertTrue( configuration.getRepositoryGroups( ).isEmpty( ) );
 
-        RemoteRepositoryConfiguration repository = configuration.getRemoteRepositoriesAsMap().get( "central" );
+        RemoteRepositoryConfiguration repository = configuration.getRemoteRepositoriesAsMap( ).get( "central" );
         assertNotNull( repository );
         configuration.removeRemoteRepository( repository );
-        assertTrue( configuration.getRemoteRepositories().isEmpty() );
+        assertTrue( configuration.getRemoteRepositories( ).isEmpty( ) );
 
         ManagedRepositoryConfiguration managedRepository =
-            configuration.getManagedRepositoriesAsMap().get( "snapshots" );
+            configuration.getManagedRepositoriesAsMap( ).get( "snapshots" );
         assertNotNull( managedRepository );
         configuration.removeManagedRepository( managedRepository );
-        assertTrue( configuration.getManagedRepositories().isEmpty() );
+        assertTrue( configuration.getManagedRepositories( ).isEmpty( ) );
 
         ProxyConnectorConfiguration proxyConnector =
-            (ProxyConnectorConfiguration) configuration.getProxyConnectors().get( 0 );
+            (ProxyConnectorConfiguration) configuration.getProxyConnectors( ).get( 0 );
         assertNotNull( proxyConnector );
         configuration.removeProxyConnector( proxyConnector );
-        assertTrue( configuration.getProxyConnectors().isEmpty() );
+        assertTrue( configuration.getProxyConnectors( ).isEmpty( ) );
 
-        NetworkProxyConfiguration networkProxy = configuration.getNetworkProxiesAsMap().get( "proxy" );
+        NetworkProxyConfiguration networkProxy = configuration.getNetworkProxiesAsMap( ).get( "proxy" );
         assertNotNull( networkProxy );
         configuration.removeNetworkProxy( networkProxy );
-        assertTrue( configuration.getNetworkProxies().isEmpty() );
+        assertTrue( configuration.getNetworkProxies( ).isEmpty( ) );
 
-        LegacyArtifactPath path = (LegacyArtifactPath) configuration.getLegacyArtifactPaths().get( 0 );
+        LegacyArtifactPath path = (LegacyArtifactPath) configuration.getLegacyArtifactPaths( ).get( 0 );
         assertNotNull( path );
         configuration.removeLegacyArtifactPath( path );
-        assertTrue( configuration.getLegacyArtifactPaths().isEmpty() );
+        assertTrue( configuration.getLegacyArtifactPaths( ).isEmpty( ) );
 
-        RepositoryScanningConfiguration scanning = configuration.getRepositoryScanning();
-        String consumer = (String) scanning.getKnownContentConsumers().get( 0 );
+        RepositoryScanningConfiguration scanning = configuration.getRepositoryScanning( );
+        String consumer = (String) scanning.getKnownContentConsumers( ).get( 0 );
         assertNotNull( consumer );
         scanning.removeKnownContentConsumer( consumer );
-        assertTrue( scanning.getKnownContentConsumers().isEmpty() );
-        consumer = (String) scanning.getInvalidContentConsumers().get( 0 );
+        assertTrue( scanning.getKnownContentConsumers( ).isEmpty( ) );
+        consumer = (String) scanning.getInvalidContentConsumers( ).get( 0 );
         assertNotNull( consumer );
         scanning.removeInvalidContentConsumer( consumer );
-        assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
+        assertTrue( scanning.getInvalidContentConsumers( ).isEmpty( ) );
 
         archivaConfiguration.save( configuration );
 
         archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-read-saved" );
-        configuration = archivaConfiguration.getConfiguration();
-        assertNull( configuration.getRemoteRepositoriesAsMap().get( "central" ) );
-        assertTrue( configuration.getRepositoryGroups().isEmpty() );
-        assertNull( configuration.getManagedRepositoriesAsMap().get( "snapshots" ) );
-        assertTrue( configuration.getProxyConnectors().isEmpty() );
-        assertNull( configuration.getNetworkProxiesAsMap().get( "proxy" ) );
-        assertTrue( configuration.getLegacyArtifactPaths().isEmpty() );
-        scanning = configuration.getRepositoryScanning();
-        assertTrue( scanning.getKnownContentConsumers().isEmpty() );
-        assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
+        configuration = archivaConfiguration.getConfiguration( );
+        assertNull( configuration.getRemoteRepositoriesAsMap( ).get( "central" ) );
+        assertTrue( configuration.getRepositoryGroups( ).isEmpty( ) );
+        assertNull( configuration.getManagedRepositoriesAsMap( ).get( "snapshots" ) );
+        assertTrue( configuration.getProxyConnectors( ).isEmpty( ) );
+        assertNull( configuration.getNetworkProxiesAsMap( ).get( "proxy" ) );
+        assertTrue( configuration.getLegacyArtifactPaths( ).isEmpty( ) );
+        scanning = configuration.getRepositoryScanning( );
+        assertTrue( scanning.getKnownContentConsumers( ).isEmpty( ) );
+        assertTrue( scanning.getInvalidContentConsumers( ).isEmpty( ) );
     }
 
     /**
      * [MRM-582] Remote Repositories with empty <username> and <password> fields shouldn't be created in configuration.
      */
     @Test
-    public void testGetConfigurationFixEmptyRemoteRepoUsernamePassword()
+    public void testGetConfigurationFixEmptyRemoteRepoUsernamePassword( )
         throws Exception
     {
         ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" );
 
-        archivaConfiguration.reload();
-        Configuration configuration = archivaConfiguration.getConfiguration();
+        archivaConfiguration.reload( );
+        Configuration configuration = archivaConfiguration.getConfiguration( );
         assertConfiguration( configuration, 2, 2, 2 );
-        assertEquals( "check remote repositories", 2, configuration.getRemoteRepositories().size() );
+        assertEquals( "check remote repositories", 2, configuration.getRemoteRepositories( ).size( ) );
 
         RemoteRepositoryConfiguration repository =
-            configuration.getRemoteRepositoriesAsMap().get( "maven2-repository.dev.java.net" );
+            configuration.getRemoteRepositoriesAsMap( ).get( "maven2-repository.dev.java.net" );
 
         assertEquals( "remote repository.url", "https://maven2-repository.dev.java.net/nonav/repository",
-                      repository.getUrl() );
-        assertEquals( "remote repository.name", "Java.net Repository for Maven 2", repository.getName() );
-        assertEquals( "remote repository.id", "maven2-repository.dev.java.net", repository.getId() );
-        assertEquals( "remote repository.layout", "default", repository.getLayout() );
-        assertNull( "remote repository.username == null", repository.getUsername() );
-        assertNull( "remote repository.password == null", repository.getPassword() );
+                      repository.getUrl( ) );
+        assertEquals( "remote repository.name", "Java.net Repository for Maven 2", repository.getName( ) );
+        assertEquals( "remote repository.id", "maven2-repository.dev.java.net", repository.getId( ) );
+        assertEquals( "remote repository.layout", "default", repository.getLayout( ) );
+        assertNull( "remote repository.username == null", repository.getUsername( ) );
+        assertNull( "remote repository.password == null", repository.getPassword( ) );
     }
 }
index fdf12558943575daf8840c89ce481f8306e02124..ce8d0e883e59d043b4c1aefca0ae5c3a80a2898f 100755 (executable)
     </property>
   </bean>
 
+  <bean name="archivaConfiguration#test-upgrade-1.3"  class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+    <property name="registry" ref="registry#test-upgrade-1.3"/>
+  </bean>
+
+  <bean name="registry#test-upgrade-1.3" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+            <xml fileName="${basedir}/src/test/conf/archiva-1.3.xml"
+                 config-name="org.apache.archiva" config-at="org.apache.archiva"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>
+  </bean>
+
   <bean name="archivaConfiguration#test-configuration"  class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
     <property name="registry" ref="registry#configured"/>
   </bean>