mirror of
https://github.com/apache/archiva.git
synced 2025-02-07 10:39:02 +00:00
- plexus compilant ClassPathXmlApplicationContext
- plexus-2-spring xslt now creates simple class name aliases for plexus FQCN roles - attempt to use plexus to spring bridge in CachedFailuresPolicyTest git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@629852 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
401c68e004
commit
ae5e322b02
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.common.spring.SpringFactory;
|
||||
import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||
@ -41,7 +40,7 @@
|
||||
*/
|
||||
public class CachedFailuresPolicy
|
||||
extends AbstractLogEnabled
|
||||
implements PreDownloadPolicy, Initializable
|
||||
implements PreDownloadPolicy
|
||||
{
|
||||
/**
|
||||
* The NO policy setting means that the the existence of old failures is <strong>not</strong> checked.
|
||||
@ -55,14 +54,12 @@ public class CachedFailuresPolicy
|
||||
*/
|
||||
public static final String YES = "yes";
|
||||
|
||||
private UrlFailureCache urlFailureCache;
|
||||
|
||||
private List<String> options = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private SpringFactory springFactory;
|
||||
private UrlFailureCache urlFailureCache;
|
||||
|
||||
private List<String> options = new ArrayList<String>();
|
||||
|
||||
public CachedFailuresPolicy()
|
||||
{
|
||||
@ -115,10 +112,4 @@ public List<String> getOptions()
|
||||
{
|
||||
return options;
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
throws InitializationException
|
||||
{
|
||||
urlFailureCache = (UrlFailureCache) springFactory.lookup( "urlFailureCache" );
|
||||
}
|
||||
}
|
||||
|
@ -19,16 +19,14 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.archiva.common.spring.PlexusFactory;
|
||||
import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.archiva.common.spring.PlexusClassPathXmlApplicationContext;
|
||||
import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
* CachedFailuresPolicyTest
|
||||
*
|
||||
@ -38,12 +36,12 @@
|
||||
public class CachedFailuresPolicyTest
|
||||
extends PlexusTestCase
|
||||
{
|
||||
private BeanFactory factory;
|
||||
private ApplicationContext factory;
|
||||
|
||||
private DownloadPolicy lookupPolicy()
|
||||
throws Exception
|
||||
{
|
||||
return (DownloadPolicy) lookup( PreDownloadPolicy.class.getName(), "cache-failures" );
|
||||
return (DownloadPolicy) factory.getBean( PreDownloadPolicy.class.getName() + "#cache-failures" );
|
||||
}
|
||||
|
||||
private File getFile()
|
||||
@ -111,10 +109,11 @@ protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
factory = new XmlBeanFactory(
|
||||
new ClassPathResource( "/org/apache/maven/archiva/policies/CachedFailuresPolicyTest-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",
|
||||
"/org/apache/maven/archiva/policies/CachedFailuresPolicyTest-context.xml" } );
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,6 @@
|
||||
|
||||
<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>
|
Loading…
x
Reference in New Issue
Block a user