diff options
author | Brett Porter <brett@apache.org> | 2007-02-09 15:39:41 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2007-02-09 15:39:41 +0000 |
commit | 39ef9035afc4475b1309760b669ea2b94501b452 (patch) | |
tree | 465e0c7b9825f462daaafb66459b17a2342befdc /archiva-configuration | |
parent | e4f213c88e8ac8e7a76f6b8109e63222cf8fcb68 (diff) | |
download | archiva-39ef9035afc4475b1309760b669ea2b94501b452.tar.gz archiva-39ef9035afc4475b1309760b669ea2b94501b452.zip |
move to a registry based configuration
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@505329 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-configuration')
11 files changed, 263 insertions, 416 deletions
diff --git a/archiva-configuration/pom.xml b/archiva-configuration/pom.xml index 833c594b0..8cdde8197 100644 --- a/archiva-configuration/pom.xml +++ b/archiva-configuration/pom.xml @@ -51,19 +51,24 @@ <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-registry</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> - <version>1.0-alpha-10</version> + <version>1.0-alpha-14-SNAPSHOT</version> <executions> <execution> <goals> - <goal>xpp3-writer</goal> <goal>java</goal> - <goal>xpp3-reader</goal> + <goal>registry-reader</goal> + <goal>registry-writer</goal> </goals> </execution> </executions> diff --git a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationChangeListener.java b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ArchivaConfiguration.java index 819bc060e..a914ce712 100644 --- a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationChangeListener.java +++ b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ArchivaConfiguration.java @@ -19,21 +19,35 @@ package org.apache.maven.archiva.configuration; * under the License. */ +import org.codehaus.plexus.registry.RegistryException; +import org.codehaus.plexus.registry.RegistryListener; + /** - * Component capable of noticing configuration changes and adjusting accordingly. - * This is not a Plexus role. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> + * Configuration holder for the model read from the registry. */ -public interface ConfigurationChangeListener +public interface ArchivaConfiguration { /** - * Notify the object that there has been a configuration change. + * Get the configuration. + * + * @return the configuration + */ + Configuration getConfiguration(); + + /** + * Save any updated configuration. + * + * @param configuration the configuration to save + * @throws org.codehaus.plexus.registry.RegistryException + * if there is a problem saving the registry data + */ + void save( Configuration configuration ) + throws RegistryException; + + /** + * Add a change listener so that registry changes are propogated. * - * @param configuration the new configuration - * @throws InvalidConfigurationException if there is a problem with the new configuration - * @throws ConfigurationChangeException if there is a problem changing the configuration, but the configuration is valid + * @param listener the listener */ - void notifyOfConfigurationChange( Configuration configuration ) - throws InvalidConfigurationException, ConfigurationChangeException; + void addChangeListener( RegistryListener listener ); } diff --git a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationChangeException.java b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationChangeException.java deleted file mode 100644 index 864ac1423..000000000 --- a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationChangeException.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * An error changing the configuration - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class ConfigurationChangeException - extends Exception -{ - public ConfigurationChangeException( String message, Throwable cause ) - { - super( message, cause ); - } -} diff --git a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationStore.java b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationStore.java deleted file mode 100644 index b5a338c9f..000000000 --- a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationStore.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * A component for loading the configuration into the model. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @todo this is something that could possibly be generalised into Modello. - */ -public interface ConfigurationStore -{ - /** - * The Plexus role for the component. - */ - String ROLE = ConfigurationStore.class.getName(); - - /** - * Get the configuration from the store. A cached version may be used. - * - * @return the configuration - * @throws ConfigurationStoreException if there is a problem loading the configuration - */ - Configuration getConfigurationFromStore() - throws ConfigurationStoreException; - - /** - * Save the configuration to the store. - * - * @param configuration the configuration to store - */ - void storeConfiguration( Configuration configuration ) - throws ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException; - - /** - * Add a configuration change listener. - * - * @param listener the listener - */ - void addChangeListener( ConfigurationChangeListener listener ); -} diff --git a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationStoreException.java b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationStoreException.java deleted file mode 100644 index 501c7c60b..000000000 --- a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationStoreException.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Exception occurring using the configuration store. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class ConfigurationStoreException - extends Exception -{ - public ConfigurationStoreException( String message ) - { - super( message ); - } - - public ConfigurationStoreException( String message, Throwable e ) - { - super( message, e ); - } -} diff --git a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java new file mode 100644 index 000000000..7c467c884 --- /dev/null +++ b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java @@ -0,0 +1,85 @@ +package org.apache.maven.archiva.configuration; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader; +import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryWriter; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; +import org.codehaus.plexus.registry.Registry; +import org.codehaus.plexus.registry.RegistryException; +import org.codehaus.plexus.registry.RegistryListener; + +/** + * Implementation of configuration holder that retrieves it from the registry. + * + * @plexus.component + */ +public class DefaultArchivaConfiguration + implements ArchivaConfiguration, RegistryListener, Initializable +{ + /** + * Plexus registry to read the configuration from. + * + * @plexus.requirement role-hint="commons-configuration" + */ + private Registry registry; + + /** + * The configuration that has been converted. + */ + private Configuration configuration; + + private static final String KEY = "org.apache.maven.archiva"; + + public synchronized Configuration getConfiguration() + { + if ( configuration == null ) + { + // TODO: should this be the same as section? make sure unnamed sections still work (eg, sys properties) + configuration = new ConfigurationRegistryReader().read( registry.getSubset( KEY ) ); + } + return configuration; + } + + public void save( Configuration configuration ) + throws RegistryException + { + Registry section = registry.getSection( KEY ); + new ConfigurationRegistryWriter().write( configuration, section ); + section.save(); + } + + public void addChangeListener( RegistryListener listener ) + { + registry.addChangeListener( listener ); + } + + public synchronized void notifyOfConfigurationChange( Registry registry ) + { + configuration = null; + } + + public void initialize() + throws InitializationException + { + registry.addChangeListener( this ); + } +} diff --git a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java deleted file mode 100644 index b99e7735e..000000000 --- a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.apache.maven.archiva.configuration; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.io.IOUtils; -import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Reader; -import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Writer; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -/** - * Load and store the configuration. No synchronization is used, but it is unnecessary as the old configuration object - * can continue to be used. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @todo would be great for plexus to do this for us - so the configuration would be a component itself rather than this store - * @todo would be good to monitor the store file for changes - * @todo support other implementations than XML file - * @plexus.component - */ -public class DefaultConfigurationStore - extends AbstractLogEnabled - implements ConfigurationStore -{ - /** - * @plexus.configuration default-value="${configuration.store.file}" - */ - private File file; - - /** - * The cached configuration. - */ - private Configuration configuration; - - /** - * List of listeners to configuration changes. - */ - private List/*<ConfigurationChangeListener>*/ listeners = new LinkedList(); - - public Configuration getConfigurationFromStore() - throws ConfigurationStoreException - { - if ( configuration == null ) - { - ConfigurationXpp3Reader reader = new ConfigurationXpp3Reader(); - - if ( file == null ) - { - file = new File( System.getProperty( "user.home" ), "/.m2/archiva.xml" ); - - // migration for those with the old file - if ( !file.exists() ) - { - File file = new File( System.getProperty( "user.home" ), "/.m2/repository-manager.xml" ); - if ( file.exists() ) - { - getLogger().info( "Migrating " + file + " to " + this.file ); - file.renameTo( this.file ); - } - } - } - - FileReader fileReader; - try - { - fileReader = new FileReader( file ); - } - catch ( FileNotFoundException e ) - { - getLogger().warn( "Configuration file: " + file + " not found. Using defaults." ); - configuration = new Configuration(); - return configuration; - } - - getLogger().info( "Reading configuration from " + file ); - try - { - configuration = reader.read( fileReader, false ); - configuration.sanitize(); - } - catch ( IOException e ) - { - throw new ConfigurationStoreException( e.getMessage(), e ); - } - catch ( XmlPullParserException e ) - { - throw new ConfigurationStoreException( e.getMessage(), e ); - } - finally - { - IOUtils.closeQuietly( fileReader ); - } - } - return configuration; - } - - public void storeConfiguration( Configuration configuration ) - throws ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException - { - for ( Iterator i = listeners.iterator(); i.hasNext(); ) - { - ConfigurationChangeListener listener = (ConfigurationChangeListener) i.next(); - - listener.notifyOfConfigurationChange( configuration ); - } - - ConfigurationXpp3Writer writer = new ConfigurationXpp3Writer(); - - getLogger().info( "Writing configuration to " + file ); - FileWriter fileWriter = null; - try - { - //does file directory exist ? - if ( file.getParentFile() != null && !file.getParentFile().exists() ) - { - file.getParentFile().mkdirs(); - } - - fileWriter = new FileWriter( file ); - writer.write( fileWriter, configuration ); - } - catch ( IOException e ) - { - throw new ConfigurationStoreException( e.getMessage(), e ); - } - finally - { - IOUtils.closeQuietly( fileWriter ); - } - } - - public void addChangeListener( ConfigurationChangeListener listener ) - { - listeners.add( listener ); - } -} diff --git a/archiva-configuration/src/test/conf/repository-manager.xml b/archiva-configuration/src/test/conf/repository-manager.xml index 6c38902b7..4008e2503 100644 --- a/archiva-configuration/src/test/conf/repository-manager.xml +++ b/archiva-configuration/src/test/conf/repository-manager.xml @@ -30,8 +30,6 @@ <proxiedRepository> <url>http://www.ibiblio.org/maven2/</url> <managedRepository>local</managedRepository> - <snapshotsInterval></snapshotsInterval> - <releasesInterval></releasesInterval> <useNetworkProxy>true</useNetworkProxy> <id>ibiblio</id> <name>Ibiblio</name> diff --git a/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationStoreTest.java b/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java index 87b73d4e2..c22524e24 100644 --- a/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationStoreTest.java +++ b/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java @@ -20,7 +20,6 @@ package org.apache.maven.archiva.configuration; */ import org.codehaus.plexus.PlexusTestCase; -import org.easymock.MockControl; import java.io.File; import java.util.Properties; @@ -29,17 +28,17 @@ import java.util.Properties; * Test the configuration store. * * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @noinspection JavaDoc */ -public class ConfigurationStoreTest +public class ArchivaConfigurationTest extends PlexusTestCase { - public void testInvalidFile() + public void testDefaults() throws Exception { - ConfigurationStore configurationStore = (ConfigurationStore) lookup( ConfigurationStore.ROLE, "invalid-file" ); + ArchivaConfiguration archivaConfiguration = + (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-defaults" ); - Configuration configuration = configurationStore.getConfigurationFromStore(); + Configuration configuration = archivaConfiguration.getConfiguration(); // check default configuration assertNotNull( "check configuration returned", configuration ); @@ -49,29 +48,13 @@ public class ConfigurationStoreTest assertTrue( "check configuration has default elements", configuration.getRepositories().isEmpty() ); } - public void testCorruptFile() - throws Exception - { - ConfigurationStore configurationStore = (ConfigurationStore) lookup( ConfigurationStore.ROLE, "corrupt-file" ); - - try - { - configurationStore.getConfigurationFromStore(); - fail( "Configuration should not have succeeded" ); - } - catch ( ConfigurationStoreException e ) - { - // expected - assertTrue( true ); - } - } - public void testGetConfiguration() throws Exception { - ConfigurationStore configurationStore = (ConfigurationStore) lookup( ConfigurationStore.ROLE, "default" ); + ArchivaConfiguration archivaConfiguration = + (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-configuration" ); - Configuration configuration = configurationStore.getConfigurationFromStore(); + Configuration configuration = archivaConfiguration.getConfiguration(); assertEquals( "check indexPath", ".index", configuration.getIndexPath() ); assertEquals( "check localRepository", "local-repository", configuration.getLocalRepository() ); @@ -113,45 +96,44 @@ public class ConfigurationStoreTest assertEquals( "check synced repositories", properties, syncedRepository.getProperties() ); } - public void testStoreConfiguration() + public void testGetConfigurationSystemOverride() throws Exception { - ConfigurationStore configurationStore = (ConfigurationStore) lookup( ConfigurationStore.ROLE, "save-file" ); - - Configuration configuration = new Configuration(); - configuration.setIndexPath( "index-path" ); + ArchivaConfiguration archivaConfiguration = + (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-configuration" ); - File file = getTestFile( "target/test/test-file.xml" ); - file.delete(); - assertFalse( file.exists() ); + System.setProperty( "org.apache.maven.archiva.localRepository", "system-repository" ); - configurationStore.storeConfiguration( configuration ); + Configuration configuration = archivaConfiguration.getConfiguration(); - assertTrue( "Check file exists", file.exists() ); - - // read it back - configuration = configurationStore.getConfigurationFromStore(); - assertEquals( "check value", "index-path", configuration.getIndexPath() ); + assertEquals( "check localRepository", "system-repository", configuration.getLocalRepository() ); + assertEquals( "check indexPath", ".index", configuration.getIndexPath() ); } - /** - * @noinspection JUnitTestMethodWithNoAssertions - */ - public void testChangeListeners() + public void testStoreConfiguration() throws Exception { - ConfigurationStore configurationStore = (ConfigurationStore) lookup( ConfigurationStore.ROLE, "save-file" ); + File file = getTestFile( "target/test/test-file.xml" ); + file.delete(); + assertFalse( file.exists() ); - MockControl control = MockControl.createControl( ConfigurationChangeListener.class ); - ConfigurationChangeListener mock = (ConfigurationChangeListener) control.getMock(); - configurationStore.addChangeListener( mock ); + ArchivaConfiguration archivaConfiguration = + (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-save" ); Configuration configuration = new Configuration(); - mock.notifyOfConfigurationChange( configuration ); - control.replay(); + configuration.setIndexPath( "index-path" ); - configurationStore.storeConfiguration( configuration ); + archivaConfiguration.save( configuration ); - control.verify(); + assertTrue( "Check file exists", file.exists() ); + + // check it + configuration = archivaConfiguration.getConfiguration(); + assertEquals( "check value", "index-path", configuration.getIndexPath() ); + + // read it back + archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-read-saved" ); + configuration = archivaConfiguration.getConfiguration(); + assertEquals( "check value", "index-path", configuration.getIndexPath() ); } } diff --git a/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.xml b/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.xml new file mode 100644 index 000000000..fcdc6e1b9 --- /dev/null +++ b/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<component-set> + <components> + <component> + <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> + <role-hint>test-defaults</role-hint> + <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> + <requirements> + <requirement> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>empty</role-hint> + </requirement> + </requirements> + </component> + <component> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>empty</role-hint> + <implementation>org.codehaus.plexus.registry.CommonsConfigurationRegistry</implementation> + <configuration> + </configuration> + </component> + + <component> + <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> + <role-hint>test-configuration</role-hint> + <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> + <requirements> + <requirement> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>configured</role-hint> + </requirement> + </requirements> + </component> + <component> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>configured</role-hint> + <implementation>org.codehaus.plexus.registry.CommonsConfigurationRegistry</implementation> + <configuration> + <properties> + <system/> + <xml fileName="${basedir}/src/test/conf/repository-manager.xml" + config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> + </properties> + </configuration> + </component> + + <component> + <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> + <role-hint>test-save</role-hint> + <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> + <requirements> + <requirement> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>save</role-hint> + </requirement> + </requirements> + </component> + <component> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>save</role-hint> + <implementation>org.codehaus.plexus.registry.CommonsConfigurationRegistry</implementation> + <configuration> + <properties> + <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true" + config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> + </properties> + </configuration> + </component> + + <component> + <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> + <role-hint>test-read-saved</role-hint> + <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> + <requirements> + <requirement> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>read-saved</role-hint> + </requirement> + </requirements> + </component> + <component> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>read-saved</role-hint> + <implementation>org.codehaus.plexus.registry.CommonsConfigurationRegistry</implementation> + <configuration> + <properties> + <xml fileName="${basedir}/target/test/test-file.xml" config-optional="true" config-forceCreate="true" + config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> + </properties> + </configuration> + </component> + </components> +</component-set> diff --git a/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml b/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml deleted file mode 100644 index 5b6491796..000000000 --- a/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<component-set> - <components> - <component> - <role>org.apache.maven.archiva.configuration.ConfigurationStore</role> - <role-hint>default</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultConfigurationStore</implementation> - <configuration> - <file>${basedir}/src/test/conf/repository-manager.xml</file> - </configuration> - </component> - <component> - <role>org.apache.maven.archiva.configuration.ConfigurationStore</role> - <role-hint>corrupt-file</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultConfigurationStore</implementation> - <configuration> - <file>${basedir}/src/test/conf/corrupt.xml</file> - </configuration> - </component> - <component> - <role>org.apache.maven.archiva.configuration.ConfigurationStore</role> - <role-hint>invalid-file</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultConfigurationStore</implementation> - <configuration> - <file>${basedir}/src/test/conf/nada.txt</file> - </configuration> - </component> - <component> - <role>org.apache.maven.archiva.configuration.ConfigurationStore</role> - <role-hint>save-file</role-hint> - <implementation>org.apache.maven.archiva.configuration.DefaultConfigurationStore</implementation> - <configuration> - <file>${basedir}/target/test/test-file.xml</file> - </configuration> - </component> - </components> -</component-set> |