You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/06/08 06:59:56 UTC
svn commit: r412658 - in
/maven/repository-manager/trunk/maven-repository-proxy/src:
main/java/org/apache/maven/repository/proxy/
test/java/org/apache/maven/repository/proxy/
test/java/org/apache/maven/repository/proxy/configuration/
Author: brett
Date: Wed Jun 7 21:59:55 2006
New Revision: 412658
URL: http://svn.apache.org/viewvc?rev=412658&view=rev
Log:
[MRM-118] proxy config is not a component
Modified:
maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java
maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java
maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java
maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java
maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java
Modified: maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java?rev=412658&r1=412657&r2=412658&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java (original)
+++ maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java Wed Jun 7 21:59:55 2006
@@ -52,7 +52,7 @@
* @author Edwin Punzalan
* @plexus.component role="org.apache.maven.repository.proxy.ProxyManager"
* @todo too much of wagon manager is reproduced here because checksums need to be downloaded separately - is that necessary?
- * @todo this isn't reusing the parts of wagon manager than handle snapshots [!]
+ * @todo this isn't reusing the parts of artifact resolver that handles snapshots - should this be more artifact based than file-based?
* @todo currently, cache must be in the same layout as the request, which prohibits any mapping
*/
public class DefaultProxyManager
@@ -70,20 +70,14 @@
private ArtifactRepositoryFactory repositoryFactory;
/**
- * @plexus.requirement
- */
- private ProxyConfiguration config;
-
- /**
* @plexus.requirement role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
*/
private Map repositoryLayoutMap;
- /**
- * A map
- */
private Map failuresCache = new HashMap();
+ private ProxyConfiguration config;
+
private static final int MS_PER_SEC = 1000;
/**
@@ -102,11 +96,6 @@
this.config = config;
}
- public ProxyConfiguration getConfiguration()
- {
- return config;
- }
-
/**
* @see org.apache.maven.repository.proxy.ProxyManager#get(String)
*/
@@ -120,15 +109,15 @@
File cachedFile = new File( cachePath, path );
if ( !cachedFile.exists() )
{
- cachedFile = getRemoteFile( path );
+ cachedFile = getAlways( path );
}
return cachedFile;
}
/**
- * @see org.apache.maven.repository.proxy.ProxyManager#getRemoteFile(String)
+ * @see org.apache.maven.repository.proxy.ProxyManager#getAlways(String)
*/
- public File getRemoteFile( String path )
+ public File getAlways( String path )
throws ProxyException, ResourceDoesNotExistException
{
checkConfiguration();
@@ -393,7 +382,7 @@
{
wagon = wagonManager.getWagon( repository.getProtocol() );
- //@todo configure wagonManager [!]
+ //@todo configure wagon (ssh settings, etc)
if ( useChecksum )
{
Modified: maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java?rev=412658&r1=412657&r2=412658&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java (original)
+++ maven/repository-manager/trunk/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java Wed Jun 7 21:59:55 2006
@@ -25,7 +25,6 @@
* Class used to bridge the servlet to the repository proxy implementation.
*
* @author Edwin Punzalan
- * @todo the names get() and getRemoteFile() are confusing [!]
*/
public interface ProxyManager
{
@@ -53,7 +52,7 @@
* @throws ResourceDoesNotExistException when the requested object can't be found in any of the
* configured repositories
*/
- File getRemoteFile( String path )
+ File getAlways( String path )
throws ProxyException, ResourceDoesNotExistException;
/**
@@ -62,11 +61,4 @@
* @param config the ProxyConfiguration to set the behavior of the proxy
*/
void setConfiguration( ProxyConfiguration config );
-
- /**
- * Used to retrieve the configuration describing the behavior of the proxy
- *
- * @return the ProxyConfiguration of this proxy
- */
- ProxyConfiguration getConfiguration();
}
Modified: maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java?rev=412658&r1=412657&r2=412658&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java Wed Jun 7 21:59:55 2006
@@ -34,6 +34,8 @@
{
private ProxyManager proxy;
+ private ProxyConfiguration configuration;
+
protected void setUp()
throws Exception
{
@@ -41,7 +43,8 @@
proxy = (ProxyManager) container.lookup( ProxyManager.ROLE );
- proxy.setConfiguration( getTestConfiguration() );
+ configuration = getTestConfiguration();
+ proxy.setConfiguration( configuration );
}
public void testExceptions()
@@ -70,7 +73,7 @@
File file = proxy.get( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
//test cache
proxy.get( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar" );
@@ -89,11 +92,11 @@
public void testArtifactChecksum()
throws Exception
{
- //force the downlod from the remote repository, use getRemoteFile()
- File file = proxy.getRemoteFile( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.md5" );
+ //force the downlod from the remote repository, use getAlways()
+ File file = proxy.getAlways( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar.md5" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
public void testNonArtifactWithNoChecksum()
@@ -102,7 +105,7 @@
File file = proxy.get( "/not-standard/repository/file.txt" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
public void testNonArtifactWithMD5Checksum()
@@ -111,7 +114,7 @@
File file = proxy.get( "/checksumed-md5/repository/file.txt" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
public void testNonArtifactWithSHA1Checksum()
@@ -120,7 +123,7 @@
File file = proxy.get( "/checksumed-sha1/repository/file.txt" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
protected void tearDown()
@@ -134,7 +137,7 @@
private ProxyConfiguration getTestConfiguration()
throws ComponentLookupException
{
- ProxyConfiguration config = (ProxyConfiguration) container.lookup( ProxyConfiguration.ROLE );
+ ProxyConfiguration config = new ProxyConfiguration();
config.setRepositoryCachePath( "target/proxy-cache" );
Modified: maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java?rev=412658&r1=412657&r2=412658&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java Wed Jun 7 21:59:55 2006
@@ -34,6 +34,8 @@
{
private ProxyManager proxy;
+ private ProxyConfiguration configuration;
+
protected void setUp()
throws Exception
{
@@ -41,7 +43,8 @@
proxy = (ProxyManager) container.lookup( ProxyManager.ROLE );
- proxy.setConfiguration( getTestConfiguration() );
+ configuration = getTestConfiguration();
+ proxy.setConfiguration( configuration );
}
public void testExceptions()
@@ -70,7 +73,7 @@
File file = proxy.get( "/commons-logging/jars/commons-logging-1.0.jar" );
assertTrue( "File must be downloaded: " + file.getAbsolutePath(), file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
//test cache
proxy.get( "/commons-logging/jars/commons-logging-1.0.jar" );
@@ -89,11 +92,11 @@
public void testArtifactChecksum()
throws Exception
{
- //force the downlod from the remote repository, use getRemoteFile()
- File file = proxy.getRemoteFile( "/commons-logging/jars/commons-logging-1.0.jar.md5" );
+ //force the downlod from the remote repository, use getAlways()
+ File file = proxy.getAlways( "/commons-logging/jars/commons-logging-1.0.jar.md5" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
public void testNonArtifactWithNoChecksum()
@@ -102,7 +105,7 @@
File file = proxy.get( "/not-standard/repository/file.txt" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
public void testNonArtifactWithMD5Checksum()
@@ -111,7 +114,7 @@
File file = proxy.get( "/checksumed-md5/repository/file.txt" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
public void testNonArtifactWithSHA1Checksum()
@@ -120,7 +123,7 @@
File file = proxy.get( "/checksumed-sha1/repository/file.txt" );
assertTrue( "File must be downloaded.", file.exists() );
assertTrue( "Downloaded file should be present in the cache.",
- file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
+ file.getAbsolutePath().startsWith( configuration.getRepositoryCachePath() ) );
}
protected void tearDown()
@@ -134,7 +137,7 @@
private ProxyConfiguration getTestConfiguration()
throws ComponentLookupException
{
- ProxyConfiguration config = (ProxyConfiguration) container.lookup( ProxyConfiguration.ROLE );
+ ProxyConfiguration config = new ProxyConfiguration();
config.setRepositoryCachePath( getTestFile( "target/m1-proxy-cache" ).getAbsolutePath() );
Modified: maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java?rev=412658&r1=412657&r2=412658&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java Wed Jun 7 21:59:55 2006
@@ -41,7 +41,7 @@
{
super.setUp();
- config = (ProxyConfiguration) container.lookup( ProxyConfiguration.ROLE );
+ config = new ProxyConfiguration();
}
public void testRepositoryCache()