mirror of
https://github.com/apache/archiva.git
synced 2025-03-03 23:19:08 +00:00
[MRM-300] add test and update to latest modello to fix the saving of proxied repositories
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@515833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
053b62e3c5
commit
21f5499a29
@ -48,12 +48,12 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.registry</groupId>
|
||||
<artifactId>plexus-registry-api</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
<version>1.0-alpha-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.registry</groupId>
|
||||
<artifactId>plexus-registry-commons</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
<version>1.0-alpha-2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Test Deps -->
|
||||
@ -74,7 +74,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello-maven-plugin</artifactId>
|
||||
<version>1.0-alpha-14</version>
|
||||
<version>1.0-alpha-15-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -27,6 +27,8 @@
|
||||
import org.codehaus.plexus.registry.RegistryException;
|
||||
import org.codehaus.plexus.registry.RegistryListener;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Implementation of configuration holder that retrieves it from the registry.
|
||||
*
|
||||
@ -60,7 +62,7 @@ public synchronized Configuration getConfiguration()
|
||||
configuration.setIndexPath( removeExpressions( configuration.getIndexPath() ) );
|
||||
configuration.setMinimalIndexPath( removeExpressions( configuration.getMinimalIndexPath() ) );
|
||||
configuration.setLocalRepository( removeExpressions( configuration.getLocalRepository() ) );
|
||||
for ( java.util.Iterator i = configuration.getRepositories().iterator(); i.hasNext(); )
|
||||
for ( Iterator i = configuration.getRepositories().iterator(); i.hasNext(); )
|
||||
{
|
||||
RepositoryConfiguration c = (RepositoryConfiguration) i.next();
|
||||
c.setDirectory( removeExpressions( c.getDirectory() ) );
|
||||
|
44
archiva-configuration/src/test/conf/with-proxied-repos.xml
Normal file
44
archiva-configuration/src/test/conf/with-proxied-repos.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||
~ or more contributor license agreements. See the NOTICE file
|
||||
~ distributed with this work for additional information
|
||||
~ regarding copyright ownership. The ASF licenses this file
|
||||
~ to you under the Apache License, Version 2.0 (the
|
||||
~ "License"); you may not use this file except in compliance
|
||||
~ with the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<repositories>
|
||||
<repository>
|
||||
<directory>managed-repository</directory>
|
||||
<id>local</id>
|
||||
<name>local</name>
|
||||
</repository>
|
||||
</repositories>
|
||||
<proxiedRepositories>
|
||||
<proxiedRepository>
|
||||
<url>http://www.ibiblio.org/maven2/</url>
|
||||
<managedRepository>local</managedRepository>
|
||||
<useNetworkProxy>true</useNetworkProxy>
|
||||
<id>ibiblio</id>
|
||||
<name>Ibiblio</name>
|
||||
</proxiedRepository>
|
||||
<proxiedRepository>
|
||||
<url>http://repository.codehaus.org/</url>
|
||||
<managedRepository>local</managedRepository>
|
||||
<id>codehaus</id>
|
||||
<name>Codehaus</name>
|
||||
</proxiedRepository>
|
||||
</proxiedRepositories>
|
||||
</configuration>
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
import java.io.File;
|
||||
@ -140,4 +141,34 @@ public void testStoreConfiguration()
|
||||
configuration = archivaConfiguration.getConfiguration();
|
||||
assertEquals( "check value", "index-path", configuration.getIndexPath() );
|
||||
}
|
||||
|
||||
public void testRemoveProxiedRepositoryAndStoreConfiguration()
|
||||
throws Exception
|
||||
{
|
||||
// MRM-300
|
||||
|
||||
File src = getTestFile( "src/test/conf/with-proxied-repos.xml" );
|
||||
File dest = getTestFile( "target/test/with-proxied-repos.xml" );
|
||||
FileUtils.copyFile( src, dest );
|
||||
|
||||
ArchivaConfiguration archivaConfiguration =
|
||||
(ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-remove-proxied-repo" );
|
||||
|
||||
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||
configuration.getProxiedRepositories().remove( 0 );
|
||||
|
||||
archivaConfiguration.save( configuration );
|
||||
|
||||
// check it
|
||||
configuration = archivaConfiguration.getConfiguration();
|
||||
assertEquals( 1, configuration.getProxiedRepositories().size() );
|
||||
|
||||
release( archivaConfiguration );
|
||||
|
||||
// read it back
|
||||
archivaConfiguration =
|
||||
(ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-read-back-remove-proxied-repo" );
|
||||
configuration = archivaConfiguration.getConfiguration();
|
||||
assertEquals( 1, configuration.getProxiedRepositories().size() );
|
||||
}
|
||||
}
|
||||
|
@ -108,5 +108,50 @@
|
||||
</properties>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
|
||||
<role-hint>test-remove-proxied-repo</role-hint>
|
||||
<implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.registry.Registry</role>
|
||||
<role-hint>read-remove-proxied-repo</role-hint>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.codehaus.plexus.registry.Registry</role>
|
||||
<role-hint>read-remove-proxied-repo</role-hint>
|
||||
<implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
|
||||
<configuration>
|
||||
<properties>
|
||||
<xml fileName="${basedir}/target/test/with-proxied-repos.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-read-back-remove-proxied-repo</role-hint>
|
||||
<implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.registry.Registry</role>
|
||||
<role-hint>read-back-remove-proxied-repo</role-hint>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.codehaus.plexus.registry.Registry</role>
|
||||
<role-hint>read-back-remove-proxied-repo</role-hint>
|
||||
<implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
|
||||
<configuration>
|
||||
<properties>
|
||||
<xml fileName="${basedir}/target/test/with-proxied-repos.xml"
|
||||
config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/>
|
||||
</properties>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
||||
|
Loading…
x
Reference in New Issue
Block a user