* under the License.
*/
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Map.Entry;
+
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.spring.SpringFactory;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
import org.codehaus.plexus.registry.RegistryListener;
import org.codehaus.plexus.util.SelectorUtils;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
/**
* DefaultRepositoryProxyConnectors
*
*/
private Map<String, PostDownloadPolicy> postDownloadPolicies;
- private UrlFailureCache urlFailureCache;
-
/**
* @plexus.requirement
*/
- private SpringFactory springFactory;
+ private UrlFailureCache urlFailureCache;
private Map<String, List<ProxyConnector>> proxyConnectorMap = new HashMap<String, List<ProxyConnector>>();
{
String url = remoteRepository.getURL().getUrl() + remotePath;
- // Transfer checksum does not use the policy.
+ // Transfer checksum does not use the policy.
if ( urlFailureCache.hasFailedBefore( url + type ) )
{
return;
{
initConnectorsAndNetworkProxies();
archivaConfiguration.addChangeListener( this );
-
- urlFailureCache = (UrlFailureCache) springFactory.lookup( "urlFailureCache" );
}
}
*/
import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.common.spring.PlexusClassPathXmlApplicationContext;
import org.apache.maven.archiva.common.spring.PlexusFactory;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
{
super.setUp();
- factory = new XmlBeanFactory(
- new ClassPathResource( "/org/apache/maven/archiva/proxy/spring-context.xml" ) );
- getContainer().getContext().put( BeanFactory.class, factory );
- PlexusFactory plexusFactory = (PlexusFactory) factory.getBean( "plexusCacheFactory" );
- plexusFactory.setContainer( container );
+ factory = new PlexusClassPathXmlApplicationContext(
+ new String[] {
+ "classpath*:META-INF/plexus/components.xml",
+ "classpath*:META-INF/plexus/components-fragment.xml",
+ "classpath*:META-INF/spring/applicationContext.xml",
+ "classpath:/org/apache/maven/archiva/proxy/spring-context.xml" } );
config = (MockConfiguration) lookup( ArchivaConfiguration.class.getName(), "mock" );
{
assertTrue( "Managed File should exist: ", managedFile.exists() );
assertTrue( "Remote File should exist: ", remoteFile.exists() );
-
+
managedFile.setLastModified( remoteFile.lastModified() + 55000 );
}
{
assertTrue( "Managed File should exist: ", managedFile.exists() );
assertTrue( "Remote File should exist: ", remoteFile.exists() );
-
+
managedFile.setLastModified( remoteFile.lastModified() - 55000 );
}
protected void assertNotModified( File file, long expectedModificationTime )
{
- assertEquals( "File <" + file.getAbsolutePath() + "> not have been modified.",
+ assertEquals( "File <" + file.getAbsolutePath() + "> not have been modified.",
expectedModificationTime, file.lastModified() );
}
{
String managedLegacyPath = managedLegacyDir.getCanonicalPath();
String testFile = file.getCanonicalPath();
-
+
assertTrue( "Unit Test Failure: File <" + testFile
+ "> should be have been defined within the legacy managed path of <" + managedLegacyPath + ">", testFile
.startsWith( managedLegacyPath ) );
-
+
assertFalse( "File < " + testFile + "> should not exist in managed legacy repository.", file.exists() );
}
{
String managedDefaultPath = managedDefaultDir.getCanonicalPath();
String testFile = file.getCanonicalPath();
-
+
assertTrue( "Unit Test Failure: File <" + testFile
+ "> should be have been defined within the managed default path of <" + managedDefaultPath + ">", testFile
.startsWith( managedDefaultPath ) );
-
+
assertFalse( "File < " + testFile + "> should not exist in managed default repository.", file.exists() );
}
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="urlFailureCache" class="org.apache.maven.archiva.policies.urlcache.DefaultUrlFailureCache">
- <!-- collaborators and configuration for this bean go here -->
- <constructor-arg ref="urlCache" type="org.codehaus.plexus.cache.Cache"/>
- </bean>
- <bean id="urlCache" factory-bean="plexusCacheFactory" factory-method="createInstance"/>
- <bean id="plexusCacheFactory" class="org.apache.maven.archiva.common.spring.PlexusFactory">
- <constructor-arg index="0" value="org.codehaus.plexus.cache.Cache"/>
- <constructor-arg index="1" value="url-failures-cache"/>
+ <constructor-arg ref="cache#url-failures-cache" type="org.codehaus.plexus.cache.Cache"/>
</bean>
</beans>
\ No newline at end of file